From 1e699671841c06399d029807112689a20cfeb254 Mon Sep 17 00:00:00 2001 From: Dylan Pulver Date: Sat, 31 Oct 2026 11:37:28 -0400 Subject: [PATCH] Add the missing Test attribute to five tests that never ran Statamic names its tests in snake_case and marks each one with `#[Test]`. Five methods assert but carry no attribute, so PHPUnit never collects them. Two of the five are halves of a matched pair, which is what makes the omission plain: - `AssetQueryBuilderTest::assets_are_found_using_where_null` has no attribute while `assets_are_found_using_where_not_null` directly below it has one. - `EntryQueryBuilderTest::entries_are_found_using_where_null` has no attribute while `entries_are_found_using_where_not_null` directly below it has one. So `whereNull` had no coverage on either query builder while `whereNotNull` did. The other three are `AddonTest::it_gets_the_autoloaded_directory`, `UserGroupTest::it_adds_a_role_using_handle` and `TemplateFieldtypeScaffoldingTest::it_scaffolds_nested_template_fieldtype_blade`. All five pass as written, so nothing beyond the attribute needed touching. Per file, tests and assertions before and after: AddonTest 32/62 -> 33/63 UserGroupTest 19/62 -> 20/64 AssetQueryBuilderTest 43/123 -> 44/125 EntryQueryBuilderTest 109/266 -> 110/268 TemplateFieldtypeScaffoldingTest 3/3 -> 4/4 Pint reports PASS on all five files. --- tests/Addons/AddonTest.php | 1 + tests/Auth/UserGroupTest.php | 1 + tests/Data/Assets/AssetQueryBuilderTest.php | 1 + tests/Data/Entries/EntryQueryBuilderTest.php | 1 + .../Scaffolding/Fieldtypes/TemplateFieldtypeScaffoldingTest.php | 1 + 5 files changed, 5 insertions(+) diff --git a/tests/Addons/AddonTest.php b/tests/Addons/AddonTest.php index 967f1ad1acf..efe202d63c7 100644 --- a/tests/Addons/AddonTest.php +++ b/tests/Addons/AddonTest.php @@ -314,6 +314,7 @@ public function it_checks_if_commercial() $this->assertFalse($this->makeFromPackage([])->isCommercial()); } + #[Test] public function it_gets_the_autoloaded_directory() { $addon = $this->makeFromPackage(['autoload' => 'src']); diff --git a/tests/Auth/UserGroupTest.php b/tests/Auth/UserGroupTest.php index 2d48b1bce1f..029ffc57700 100644 --- a/tests/Auth/UserGroupTest.php +++ b/tests/Auth/UserGroupTest.php @@ -113,6 +113,7 @@ public function handle(?string $handle = null) $this->assertEquals($group, $return); } + #[Test] public function it_adds_a_role_using_handle() { $role = new class extends Role diff --git a/tests/Data/Assets/AssetQueryBuilderTest.php b/tests/Data/Assets/AssetQueryBuilderTest.php index cf5a146f974..1514117c56f 100644 --- a/tests/Data/Assets/AssetQueryBuilderTest.php +++ b/tests/Data/Assets/AssetQueryBuilderTest.php @@ -173,6 +173,7 @@ public function assets_are_found_using_where_time() $this->assertEquals(['a', 'd'], $assets->map->filename()->all()); } + #[Test] public function assets_are_found_using_where_null() { Asset::find('test::a.jpg')->data(['text' => 'Text 1'])->save(); diff --git a/tests/Data/Entries/EntryQueryBuilderTest.php b/tests/Data/Entries/EntryQueryBuilderTest.php index fbdaa23b8c2..723b367d4f4 100644 --- a/tests/Data/Entries/EntryQueryBuilderTest.php +++ b/tests/Data/Entries/EntryQueryBuilderTest.php @@ -333,6 +333,7 @@ private function createWhereDateTestEntries() EntryFactory::id('5')->slug('post-5')->collection('posts')->data(['title' => 'Post 5', 'test_date' => null])->create(); } + #[Test] public function entries_are_found_using_where_null() { EntryFactory::id('1')->slug('post-1')->collection('posts')->data(['title' => 'Post 1', 'text' => 'Text 1'])->create(); diff --git a/tests/View/Scaffolding/Fieldtypes/TemplateFieldtypeScaffoldingTest.php b/tests/View/Scaffolding/Fieldtypes/TemplateFieldtypeScaffoldingTest.php index fd4ac32f04b..32cb8eb1f1a 100644 --- a/tests/View/Scaffolding/Fieldtypes/TemplateFieldtypeScaffoldingTest.php +++ b/tests/View/Scaffolding/Fieldtypes/TemplateFieldtypeScaffoldingTest.php @@ -44,6 +44,7 @@ public function it_scaffolds_template_fieldtype_blade() ); } + #[Test] public function it_scaffolds_nested_template_fieldtype_blade() { $result = $this->scaffoldBladeField($this->nestedField());