Skip to content
This repository was archived by the owner on Oct 20, 2023. It is now read-only.

Commit c4ac1c8

Browse files
committed
Example completed with uncovered lines for both cases
1 parent f4afaee commit c4ac1c8

File tree

5 files changed

+64
-0
lines changed

5 files changed

+64
-0
lines changed

lib/D.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace My;
6+
7+
class D
8+
{
9+
public function inArray(): bool
10+
{
11+
return \in_array(1, [
12+
DType::OPT,
13+
], true);
14+
}
15+
}

lib/DType.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace My;
6+
7+
class DType
8+
{
9+
public const OPT = 1;
10+
}

phpunit.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<file>./lib/A.php</file>
1313
<file>./lib/B.php</file>
1414
<file>./lib/C.php</file>
15+
<file>./lib/D.php</file>
1516
</include>
1617
</coverage>
1718
<testsuite name="Foo">

tests/CTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace MyTest;
6+
7+
use PHPUnit\Framework\TestCase;
8+
9+
/**
10+
* @covers \My\C
11+
*/
12+
final class CTest extends TestCase
13+
{
14+
public function testMe(): void
15+
{
16+
self::assertTrue(true);
17+
}
18+
}

tests/DTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace MyTest;
6+
7+
use My\BType;
8+
use My\DType;
9+
use PHPUnit\Framework\TestCase;
10+
11+
/**
12+
* @covers \My\D
13+
*/
14+
final class DTest extends TestCase
15+
{
16+
public function testMe(): void
17+
{
18+
self::assertSame(1, DType::OPT);
19+
}
20+
}

0 commit comments

Comments
 (0)