View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001922 | Xdebug | Code Coverage | public | 2020-12-26 12:30 | 2022-03-15 17:17 |
Reporter | thierrydraper | Assigned To | derick | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 3.0.1 | ||||
Target Version | 3.0dev | Fixed in Version | 3.0.2 | ||
Summary | 0001922: Code coverage misses array assignment lines | ||||
Description | Since upgrading to Xdebug 3.0, the code coverage is no longer including the first line in some multi-line assignments. Running the attached example I would expected 100% code coverage returned, however with Xdebug 3.0.1 it only returns 18 / 21 (missing lines 28, 34 and 43 when put through PHPUnit's --coverage-html). Rolling back to Xdebug 2.9.8 and re-running the test returns 100% code coverage as expected. | ||||
Steps To Reproduce | Run the example unit test through PHPUnit 8.5.0: | ||||
Additional Information | $ php -v | ||||
Tags | No tags attached. | ||||
Attached Files | ExampleTest.php (1,301 bytes)
<?php use PHPUnit\Framework\TestCase; class ExampleTest extends TestCase { public function testCodeCoverage(): void { $arr = $this->arrayBuild(); $this->assertCount(6, $arr); $this->assertEquals(0, $arr[0]['num']); $this->assertEquals(1, $arr[1]['num']); $this->assertEquals(2, $arr[2]['num']); $this->assertEquals(42, $arr['string-index']['num']); $this->assertEquals('b', $arr['string-index']['sub']['a']); $this->assertEquals('scalar', $arr['multiline-scalar-1']); $this->assertEquals('scalar', $arr['multiline-scalar-2']); } protected function arrayBuild(): array { $arr = []; // Append to array. $arr[] = [ 'num' => 0, ]; for ($i = 1; $i < 3; $i++) { $arr[] = [ 'num' => $i, ]; } // Explicit index. list($a, $c, $e) = ['b', 'd', 'f']; $arr['string-index'] = [ 'num' => 42, 'sub' => [ 'a' => $a, 'c' => $c, 'e' => $e, ], ]; // Multi-line assignment $arr['multiline-scalar-1'] = $arr['multiline-scalar-2'] = 'scalar'; return $arr; } } | ||||
Operating System | Fedora 33 with httpd and php-fpm | ||||
PHP Version | 7.4.10-7.4.19 | ||||
|
I think I see the problem, the ASSIGN_DIM opcode isn't overloaded for just coverage, just like ASSIGN_OBJ from 0001910. |
|
|
|
Issue seems to be back? |
Date Modified | Username | Field | Change |
---|---|---|---|
2020-12-26 12:30 | thierrydraper | New Issue | |
2020-12-26 12:30 | thierrydraper | File Added: ExampleTest.php | |
2020-12-26 14:45 | derick | Status | new => assigned |
2020-12-26 14:45 | derick | Target Version | => 3.0dev |
2020-12-26 14:45 | derick | Description Updated | |
2020-12-26 14:45 | derick | Steps to Reproduce Updated | |
2020-12-26 14:45 | derick | Additional Information Updated | |
2020-12-26 14:45 | derick | Note Added: 0005619 | |
2020-12-30 12:33 | derick | Summary | Code Coverage in Xdebug 3.0 misses lines counted in Xdebug 2.9 => Code coverage misses array assignment lines |
2020-12-30 12:33 | derick | Note Added: 0005625 | |
2020-12-30 16:38 | derick | Assigned To | => derick |
2020-12-30 16:38 | derick | Status | assigned => closed |
2020-12-30 16:38 | derick | Resolution | open => fixed |
2020-12-30 16:38 | derick | Fixed in Version | => 3.0.2 |
2022-03-15 17:17 | bradkent | Note Added: 0006246 |