Skip to content

[6.x] Add the missing Test attribute to five tests that never ran - #15758

Open
dylanpulver wants to merge 1 commit into
statamic:6.xfrom
dylanpulver:fix/collect-tests-missing-test-attribute
Open

dylanpulver wants to merge 1 commit into
statamic:6.xfrom
dylanpulver:fix/collect-tests-missing-test-attribute

Conversation

@dylanpulver

Copy link
Copy Markdown

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 and they have never run.

Two of the five are halves of a matched pair, which is what makes the omission plain:

Test Attribute
AssetQueryBuilderTest::assets_are_found_using_where_null missing
AssetQueryBuilderTest::assets_are_found_using_where_not_null present, directly below it
EntryQueryBuilderTest::entries_are_found_using_where_null missing
EntryQueryBuilderTest::entries_are_found_using_where_not_null present, directly below it

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, before and after:

AddonTest                          32 tests /  62 assertions  ->  33 / 63
UserGroupTest                      19 tests /  62 assertions  ->  20 / 64
AssetQueryBuilderTest              43 tests / 123 assertions  ->  44 / 125
EntryQueryBuilderTest             109 tests / 266 assertions  -> 110 / 268
TemplateFieldtypeScaffoldingTest    3 tests /   3 assertions  ->   4 / 4

vendor/bin/pint --test reports PASS on all five files.

To answer question 2 in the template: yes, AI tools were used. Found with a static check for PHPUnit methods that assert but cannot be collected, and written with Claude Code. The counts above are from running each file before and after, and the matched-pair asymmetry was confirmed by reading the surrounding methods rather than inferred.

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.
@dylanpulver dylanpulver changed the title Add the missing Test attribute to five tests that never ran [6.x] Add the missing Test attribute to five tests that never ran Oct 31, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant