From b03fe9b63ca5cfa9798e7e29ee6c6ecdf0ccdc3c Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Sun, 28 Apr 2024 11:32:33 +0200 Subject: [PATCH 1/3] Ignore empty template methods from code coverage (as they are never called) --- src/Framework/TestCase.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Framework/TestCase.php b/src/Framework/TestCase.php index 0c7e86a157..a6fd59eb99 100644 --- a/src/Framework/TestCase.php +++ b/src/Framework/TestCase.php @@ -333,6 +333,8 @@ public function __construct(string $name) /** * This method is called before the first test of this test class is run. + * + * @codeCoverageIgnore */ public static function setUpBeforeClass(): void { @@ -340,6 +342,8 @@ public static function setUpBeforeClass(): void /** * This method is called after the last test of this test class is run. + * + * @codeCoverageIgnore */ public static function tearDownAfterClass(): void { @@ -347,6 +351,8 @@ public static function tearDownAfterClass(): void /** * This method is called before each test. + * + * @codeCoverageIgnore */ protected function setUp(): void { @@ -356,6 +362,8 @@ protected function setUp(): void * Performs assertions shared by all tests of a test case. * * This method is called between setUp() and test. + * + * @codeCoverageIgnore */ protected function assertPreConditions(): void { @@ -365,6 +373,8 @@ protected function assertPreConditions(): void * Performs assertions shared by all tests of a test case. * * This method is called between test and tearDown(). + * + * @codeCoverageIgnore */ protected function assertPostConditions(): void { @@ -372,6 +382,8 @@ protected function assertPostConditions(): void /** * This method is called after each test. + * + * @codeCoverageIgnore */ protected function tearDown(): void { From 2ef62d851be17fb7f6457498d77a92633957c07a Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Sun, 28 Apr 2024 11:35:27 +0200 Subject: [PATCH 2/3] Delete unused method --- src/Framework/TestCase.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/Framework/TestCase.php b/src/Framework/TestCase.php index a6fd59eb99..7019ccdfd0 100644 --- a/src/Framework/TestCase.php +++ b/src/Framework/TestCase.php @@ -926,14 +926,6 @@ final public function setInIsolation(bool $inIsolation): void $this->inIsolation = $inIsolation; } - /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit - */ - final public function isInIsolation(): bool - { - return $this->inIsolation; - } - /** * @internal This method is not covered by the backward compatibility promise for PHPUnit */ From 83097133da42b2882cd5c2c87bdf55324bd6f378 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Sun, 28 Apr 2024 11:37:15 +0200 Subject: [PATCH 3/3] Ignore methods from code coverage that are only called when code coverage information cannot be collected --- src/Framework/TestCase.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Framework/TestCase.php b/src/Framework/TestCase.php index 7019ccdfd0..e11e8c7935 100644 --- a/src/Framework/TestCase.php +++ b/src/Framework/TestCase.php @@ -920,6 +920,8 @@ final public function setPreserveGlobalState(bool $preserveGlobalState): void /** * @internal This method is not covered by the backward compatibility promise for PHPUnit + * + * @codeCoverageIgnore */ final public function setInIsolation(bool $inIsolation): void { @@ -928,6 +930,8 @@ final public function setInIsolation(bool $inIsolation): void /** * @internal This method is not covered by the backward compatibility promise for PHPUnit + * + * @codeCoverageIgnore */ final public function result(): mixed {