From e7f0fec8e78488f93221d5ba3f4a93e21bb23d2f Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Mon, 26 Jan 2026 11:24:36 +0000 Subject: [PATCH 1/3] wip --- src/Testing/AddonTestCase.php | 2 -- tests/TestCase.php | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/Testing/AddonTestCase.php b/src/Testing/AddonTestCase.php index ceb982d2676..6fc6055346b 100644 --- a/src/Testing/AddonTestCase.php +++ b/src/Testing/AddonTestCase.php @@ -32,11 +32,9 @@ protected function setUp(): void } Version::shouldReceive('get')->zeroOrMoreTimes()->andReturn(Composer::create(__DIR__.'/../')->installedVersion(Statamic::PACKAGE)); - $this->addToAssertionCount(-1); \Statamic\Facades\CP\Nav::shouldReceive('build')->zeroOrMoreTimes()->andReturn(collect()); \Statamic\Facades\CP\Nav::shouldReceive('clearCachedUrls')->zeroOrMoreTimes(); - $this->addToAssertionCount(-2); // Dont want to assert this } protected function tearDown(): void diff --git a/tests/TestCase.php b/tests/TestCase.php index 5cc07c2d32b..d9ef598b140 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -38,13 +38,11 @@ protected function setUp(): void if ($this->shouldFakeVersion) { \Facades\Statamic\Version::shouldReceive('get')->zeroOrMoreTimes()->andReturn('3.0.0-testing'); - $this->addToAssertionCount(-1); // Dont want to assert this } if ($this->shouldPreventNavBeingBuilt) { \Statamic\Facades\CP\Nav::shouldReceive('build')->zeroOrMoreTimes()->andReturn(collect()); \Statamic\Facades\CP\Nav::shouldReceive('clearCachedUrls')->zeroOrMoreTimes(); - $this->addToAssertionCount(-2); // Dont want to assert this } $this->addGqlMacros(); From cb78d214b1ec4e4582a3702db23a2504f7cc07d5 Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Mon, 26 Jan 2026 12:14:48 +0000 Subject: [PATCH 2/3] wip --- tests/Markdown/ManagerTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Markdown/ManagerTest.php b/tests/Markdown/ManagerTest.php index 2d74a75632d..ab9cd89c738 100644 --- a/tests/Markdown/ManagerTest.php +++ b/tests/Markdown/ManagerTest.php @@ -105,7 +105,6 @@ public function parser_instances_can_be_saved_and_retrieved() #[Test] public function it_throws_an_exception_if_extending_without_returning_a_parser() { - $this->expectNotToPerformAssertions(); $this->expectException(UnexpectedValueException::class); $this->expectExceptionMessage('A ['.Markdown\Parser::class.'] instance is expected.'); From af3024011dfa971c0abb0a503f3cf0d81a80b0c8 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Mon, 26 Jan 2026 10:20:02 -0500 Subject: [PATCH 3/3] remove more assertion negations. remove zeroOrMoreTimes. --- src/Testing/AddonTestCase.php | 6 +++--- tests/FrontendTest.php | 4 +--- tests/Licensing/AddonLicenseTest.php | 2 -- tests/Licensing/LicenseManagerTest.php | 3 +-- tests/TestCase.php | 6 +++--- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/Testing/AddonTestCase.php b/src/Testing/AddonTestCase.php index 6fc6055346b..34460db886b 100644 --- a/src/Testing/AddonTestCase.php +++ b/src/Testing/AddonTestCase.php @@ -31,10 +31,10 @@ protected function setUp(): void $this->preventSavingStacheItemsToDisk(); } - Version::shouldReceive('get')->zeroOrMoreTimes()->andReturn(Composer::create(__DIR__.'/../')->installedVersion(Statamic::PACKAGE)); + Version::shouldReceive('get')->andReturn(Composer::create(__DIR__.'/../')->installedVersion(Statamic::PACKAGE)); - \Statamic\Facades\CP\Nav::shouldReceive('build')->zeroOrMoreTimes()->andReturn(collect()); - \Statamic\Facades\CP\Nav::shouldReceive('clearCachedUrls')->zeroOrMoreTimes(); + \Statamic\Facades\CP\Nav::shouldReceive('build')->andReturn(collect()); + \Statamic\Facades\CP\Nav::shouldReceive('clearCachedUrls'); } protected function tearDown(): void diff --git a/tests/FrontendTest.php b/tests/FrontendTest.php index f7447d99078..30af419dd27 100644 --- a/tests/FrontendTest.php +++ b/tests/FrontendTest.php @@ -17,7 +17,6 @@ use Statamic\Facades\Blueprint; use Statamic\Facades\Cascade; use Statamic\Facades\Collection; -use Statamic\Facades\Entry; use Statamic\Facades\User; use Statamic\Tags\Tags; use Statamic\View\Antlers\Language\Utilities\StringUtilities; @@ -38,8 +37,7 @@ public function setUp(): void private function withStandardBlueprints() { - $this->addToAssertionCount(-1); - Blueprint::shouldReceive('in')->withAnyArgs()->zeroOrMoreTimes()->andReturn(collect([new \Statamic\Fields\Blueprint])); + Blueprint::shouldReceive('in')->withAnyArgs()->andReturn(collect([new \Statamic\Fields\Blueprint])); } #[Test] diff --git a/tests/Licensing/AddonLicenseTest.php b/tests/Licensing/AddonLicenseTest.php index e93e5dfce88..687b3584267 100644 --- a/tests/Licensing/AddonLicenseTest.php +++ b/tests/Licensing/AddonLicenseTest.php @@ -14,9 +14,7 @@ class AddonLicenseTest extends TestCase protected function license($response = []) { Addon::shouldReceive('get')->with('test/addon') - ->zeroOrMoreTimes() ->andReturn(new FakeAddonLicenseAddon('Test Addon', '1.2.3', 'rad')); - $this->addToAssertionCount(-1); // dont need to assert this. return new AddonLicense('test/addon', $response); } diff --git a/tests/Licensing/LicenseManagerTest.php b/tests/Licensing/LicenseManagerTest.php index 6138092b38a..44a37e27384 100644 --- a/tests/Licensing/LicenseManagerTest.php +++ b/tests/Licensing/LicenseManagerTest.php @@ -191,8 +191,7 @@ private function managerWithResponse(array $response) { $outpost = $this->mock(Outpost::class); - $this->addToAssertionCount(-1); // Dont want to assert this - $outpost->shouldReceive('response')->zeroOrMoreTimes()->andReturn($response); + $outpost->shouldReceive('response')->andReturn($response); return new LicenseManager($outpost); } diff --git a/tests/TestCase.php b/tests/TestCase.php index d9ef598b140..7836f9017d5 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -37,12 +37,12 @@ protected function setUp(): void } if ($this->shouldFakeVersion) { - \Facades\Statamic\Version::shouldReceive('get')->zeroOrMoreTimes()->andReturn('3.0.0-testing'); + \Facades\Statamic\Version::shouldReceive('get')->andReturn('3.0.0-testing'); } if ($this->shouldPreventNavBeingBuilt) { - \Statamic\Facades\CP\Nav::shouldReceive('build')->zeroOrMoreTimes()->andReturn(collect()); - \Statamic\Facades\CP\Nav::shouldReceive('clearCachedUrls')->zeroOrMoreTimes(); + \Statamic\Facades\CP\Nav::shouldReceive('build')->andReturn(collect()); + \Statamic\Facades\CP\Nav::shouldReceive('clearCachedUrls'); } $this->addGqlMacros();