View Issue Details

IDProjectCategoryView StatusLast Update
0001932XdebugCode Coveragepublic2021-01-23 12:35
Reportermateusz Assigned Toderick  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version3.0.2 
Target Version3.0devFixed in Version3.0.3 
Summary0001932: One line in multi-line string concatenation is not covered
Description

One line in multi-line string concatenation is not showed as covered by unit tests.
When this multi-line string concatenation is written in one line - line is showed as covered by unit test.

Steps To Reproduce
  1. Run unit test ExampleTest.php with --coverage-text or --coverage-html
  2. Line number 10 (. '/') will be showed as uncovered for Exampel.php. If you use Example.php-v2, coverage will show 100% code is covered by test.
Tagscoverage, error
Attached Files
Example.php (512 bytes)   
<?php

namespace Service;

class Example
{
    public function executeAction(): bool
    {
        $path = $this->getBasicPath()
            . '/'
            . $this->getFileName();

        return $this->runAction($path);
    }

    private function getBasicPath(): string
    {
        return '/var/www';
    }

    private function getFileName(): string
    {
        return 'file.csv';
    }

    private function runAction(string $path): bool
    {
        return true;
    }
}
Example.php (512 bytes)   
Example.php-v2.php (486 bytes)   
<?php

namespace Service;

class Example
{
    public function executeAction(): bool
    {
        $path = $this->getBasicPath() . '/' . $this->getFileName();

        return $this->runAction($path);
    }

    private function getBasicPath(): string
    {
        return '/var/www';
    }

    private function getFileName(): string
    {
        return 'file.csv';
    }

    private function runAction(string $path): bool
    {
        return true;
    }
}
Example.php-v2.php (486 bytes)   
ExampleTest.php (395 bytes)   
<?php

namespace Test;

use PHPUnit\Framework\TestCase;
use Service\Example;

class ExampleTest extends TestCase
{
    private $testObject;

    public function setUp(): void
    {
        $this->testObject = new Example();
    }

    public function testExecuteAction()
    {
        $result = $this->testObject->executeAction();
        $this->assertTrue($result);
    }
}
ExampleTest.php (395 bytes)   
Operating SystemUbuntu
PHP Version7.3.20-7.3.29

Activities

Issue History

Date Modified Username Field Change
2021-01-13 14:00 mateusz New Issue
2021-01-13 14:00 mateusz Tag Attached: coverage
2021-01-13 14:00 mateusz Tag Attached: error
2021-01-13 14:00 mateusz File Added: Example.php
2021-01-13 14:00 mateusz File Added: Example.php-v2.php
2021-01-13 14:00 mateusz File Added: ExampleTest.php
2021-01-20 11:50 derick Assigned To => derick
2021-01-20 11:50 derick Status new => confirmed
2021-01-20 11:50 derick Target Version => 3.0dev
2021-01-20 11:50 derick Description Updated
2021-01-20 11:50 derick Steps to Reproduce Updated
2021-01-22 15:26 derick Summary One line in multi-line string concatenation is not showed as covered by unit tests => One line in multi-line string concatenation is not covered
2021-01-22 15:26 derick Note Added: 0005650
2021-01-23 12:35 derick Status confirmed => closed
2021-01-23 12:35 derick Resolution open => fixed
2021-01-23 12:35 derick Fixed in Version => 3.0.3