-
-
Notifications
You must be signed in to change notification settings - Fork 377
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework how code coverage settings are propagated to the driver
- Loading branch information
Showing
11 changed files
with
353 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/Exception/BranchAndPathCoverageNotSupportedException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php declare(strict_types=1); | ||
/* | ||
* This file is part of phpunit/php-code-coverage. | ||
* | ||
* (c) Sebastian Bergmann <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
namespace SebastianBergmann\CodeCoverage; | ||
|
||
/** | ||
* Exception that is raised when branch and path coverage is not supported by the driver but is attempted to be used. | ||
*/ | ||
final class BranchAndPathCoverageNotSupportedException extends RuntimeException | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php declare(strict_types=1); | ||
/* | ||
* This file is part of phpunit/php-code-coverage. | ||
* | ||
* (c) Sebastian Bergmann <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
namespace SebastianBergmann\CodeCoverage; | ||
|
||
/** | ||
* Exception that is raised when dead code detection is not supported by the driver but is attempted to be used. | ||
*/ | ||
final class DeadCodeDetectionNotSupportedException extends RuntimeException | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php declare(strict_types=1); | ||
/* | ||
* This file is part of phpunit/php-code-coverage. | ||
* | ||
* (c) Sebastian Bergmann <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
namespace SebastianBergmann\CodeCoverage; | ||
|
||
use SebastianBergmann\CodeCoverage\Driver\PCOV; | ||
use SebastianBergmann\Environment\Runtime; | ||
|
||
class PCOVTest extends TestCase | ||
{ | ||
protected function setUp(): void | ||
{ | ||
$runtime = new Runtime; | ||
|
||
if (!$runtime->hasPCOV()) { | ||
$this->markTestSkipped('This test is only applicable to PCOV'); | ||
} | ||
} | ||
|
||
public function testDefaultValueOfDeadCodeDetection(): void | ||
{ | ||
$driver = new PCOV(new Filter()); | ||
|
||
$this->assertFalse($driver->detectingDeadCode()); | ||
} | ||
|
||
public function testEnablingDeadCodeDetection(): void | ||
{ | ||
$this->expectException(DeadCodeDetectionNotSupportedException::class); | ||
|
||
$driver = new PCOV(new Filter()); | ||
|
||
$driver->detectDeadCode(true); | ||
} | ||
|
||
public function testDisablingDeadCodeDetection(): void | ||
{ | ||
$driver = new PCOV(new Filter()); | ||
|
||
$driver->detectDeadCode(false); | ||
$this->assertFalse($driver->detectingDeadCode()); | ||
} | ||
|
||
public function testEnablingBranchAndPathCoverage(): void | ||
{ | ||
$this->expectException(BranchAndPathCoverageNotSupportedException::class); | ||
|
||
$driver = new PCOV(new Filter()); | ||
|
||
$driver->collectBranchAndPathCoverage(true); | ||
$this->assertTrue($driver->collectingBranchAndPathCoverage()); | ||
} | ||
|
||
public function testDisablingBranchAndPathCoverage(): void | ||
{ | ||
$driver = new PCOV(new Filter()); | ||
|
||
$driver->collectBranchAndPathCoverage(false); | ||
$this->assertFalse($driver->collectingBranchAndPathCoverage()); | ||
} | ||
} |
Oops, something went wrong.