View Issue Details

IDProjectCategoryView StatusLast Update
0001932XdebugCode Coveragepublic2021-01-13 14:00
Reportermateusz Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version3.0.2 
Summary0001932: One line in multi-line string concatenation is not showed as covered by unit tests
DescriptionOne 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 Reproduce1. 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
Operating SystemUbuntu
PHP Version7.3.20-7.3.29

Activities

mateusz

2021-01-13 14:00

reporter  

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)   

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