99 */
1010namespace SebastianBergmann \CodeCoverage \Driver ;
1111
12+ use SebastianBergmann \CodeCoverage \Filter ;
1213use SebastianBergmann \CodeCoverage \TestCase ;
1314
1415final class Xdebug2DriverTest extends TestCase
@@ -36,6 +37,67 @@ protected function setUp(): void
3637 }
3738 }
3839
40+ public function testSupportsBranchAndPathCoverage (): void
41+ {
42+ $ this ->assertTrue ($ this ->driver ()->canCollectBranchAndPathCoverage ());
43+ }
44+
45+ public function testBranchAndPathCoverageCanBeDisabled (): void
46+ {
47+ $ driver = $ this ->driver ();
48+
49+ $ driver ->disableBranchAndPathCoverage ();
50+
51+ $ this ->assertFalse ($ driver ->collectsBranchAndPathCoverage ());
52+ }
53+
54+ public function testBranchAndPathCoverageCanBeEnabled (): void
55+ {
56+ $ driver = $ this ->driver ();
57+
58+ $ driver ->enableBranchAndPathCoverage ();
59+
60+ $ this ->assertTrue ($ driver ->collectsBranchAndPathCoverage ());
61+ }
62+
63+ public function testBranchAndPathCoverageIsNotCollectedByDefault (): void
64+ {
65+ $ this ->assertFalse ($ this ->driver ()->collectsBranchAndPathCoverage ());
66+ }
67+
68+ public function testSupportsDeadCodeDetection (): void
69+ {
70+ $ this ->assertTrue ($ this ->driver ()->canDetectDeadCode ());
71+ }
72+
73+ public function testDeadCodeDetectionCanBeDisabled (): void
74+ {
75+ $ driver = $ this ->driver ();
76+
77+ $ driver ->disableDeadCodeDetection ();
78+
79+ $ this ->assertFalse ($ driver ->detectsDeadCode ());
80+ }
81+
82+ public function testDeadCodeDetectionCanBeEnabled (): void
83+ {
84+ $ driver = $ this ->driver ();
85+
86+ $ driver ->enableDeadCodeDetection ();
87+
88+ $ this ->assertTrue ($ driver ->detectsDeadCode ());
89+ }
90+
91+ public function testDeadCodeIsNotDetectedByDefault (): void
92+ {
93+ $ this ->assertFalse ($ this ->driver ()->detectsDeadCode ());
94+ }
95+
96+ public function testHasNameAndVersion (): void
97+ {
98+ $ this ->assertStringMatchesFormat ('Xdebug %s ' , $ this ->driver ()->nameAndVersion ());
99+ }
100+
39101 public function testFilterWorks (): void
40102 {
41103 $ bankAccount = TEST_FILES_PATH . 'BankAccount.php ' ;
@@ -44,4 +106,9 @@ public function testFilterWorks(): void
44106
45107 $ this ->assertArrayNotHasKey ($ bankAccount , \xdebug_get_code_coverage ());
46108 }
109+
110+ private function driver (): Xdebug2Driver
111+ {
112+ return new Xdebug2Driver (new Filter );
113+ }
47114}
0 commit comments