From ecc08fc8664bf008d9b11fa196b7e6fe4338bc92 Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Thu, 12 Jan 2023 15:01:16 +0100 Subject: [PATCH] Add test to reach 100% coverage --- fixtures/NoProphecy.php | 17 +++++++++++++++++ tests/ProphecyTraitTest.php | 14 ++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 fixtures/NoProphecy.php diff --git a/fixtures/NoProphecy.php b/fixtures/NoProphecy.php new file mode 100644 index 0000000..ca29935 --- /dev/null +++ b/fixtures/NoProphecy.php @@ -0,0 +1,17 @@ +assertTrue(true); + } +} diff --git a/tests/ProphecyTraitTest.php b/tests/ProphecyTraitTest.php index 6e6a168..aec18a3 100644 --- a/tests/ProphecyTraitTest.php +++ b/tests/ProphecyTraitTest.php @@ -6,6 +6,7 @@ use PHPUnit\Runner\BaseTestRunner; use Prophecy\PhpUnit\Tests\Fixtures\Error; use Prophecy\PhpUnit\Tests\Fixtures\MockFailure; +use Prophecy\PhpUnit\Tests\Fixtures\NoProphecy; use Prophecy\PhpUnit\Tests\Fixtures\SpyFailure; use Prophecy\PhpUnit\Tests\Fixtures\Success; @@ -73,4 +74,17 @@ public function testDoublingError(): void $this->assertSame(0, $test->getNumAssertions()); $this->assertSame(BaseTestRunner::STATUS_ERROR, $test->getStatus()); } + + public function testNoProphecy(): void + { + $test = new NoProphecy('testMethod'); + + $result = $test->run(); + + $this->assertSame(0, $result->errorCount()); + $this->assertSame(0, $result->failureCount()); + $this->assertCount(1, $result); + $this->assertSame(1, $test->getNumAssertions()); + $this->assertSame(BaseTestRunner::STATUS_PASSED, $test->getStatus()); + } }