Skip to content

Commit ad9aef7

Browse files
committed
Add failing test for parent constructor call coverage
1 parent a687b9b commit ad9aef7

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
class Foo extends Exception
4+
{
5+
public function __construct()
6+
{
7+
parent::__construct(
8+
'some message',
9+
42
10+
);
11+
}
12+
}

tests/tests/Data/RawCodeCoverageDataTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,4 +694,18 @@ public function testCoverageForFileWithInlineAnnotations(): void
694694
$coverage->functionCoverage()[$filename]
695695
);
696696
}
697+
698+
public function testParentConstructorCallIsCovered(): void
699+
{
700+
$file = TEST_FILES_PATH . 'source_with_parent_constructor_call.php';
701+
702+
$this->assertEquals(
703+
[
704+
7,
705+
8,
706+
9,
707+
],
708+
array_keys(RawCodeCoverageData::fromUncoveredFile($file, new ParsingFileAnalyser(true, true))->lineCoverage()[$file])
709+
);
710+
}
697711
}

0 commit comments

Comments
 (0)