Skip to content

fix(tests): make data provider methods static for PHPUnit 11 - #1263

Merged
ggottwald merged 1 commit into
stablefrom
fix/phpunit11-static-data-providers
Sep 3, 2026
Merged

fix(tests): make data provider methods static for PHPUnit 11#1263
ggottwald merged 1 commit into
stablefrom
fix/phpunit11-static-data-providers

Conversation

@ggottwald

Copy link
Copy Markdown
Member

Summary

  • PHPUnit 11 requires @dataProvider methods to be static; this failed with "Data Provider method ... is not static" for 9 providers across 5 test files, causing 18 errors.
  • Converted all 9 providers to static and removed their remaining dependency on instance state so they still work as static methods:
    • CustomerServiceFeatureTest: $genders property made static, provider methods use self::$genders instead of $this->genders.
    • NotificationServiceFeatureTest: provider now builds its own \Faker\Factory::create() instance instead of $this->fake.
    • VariationSearchFactoryTest, CheckoutServiceShippingTest, UrlQueryTest: providers had no $this usage, just added static.

Test plan

  • php -l on all 5 changed files (PHP 8.2 and PHP 8.5)
  • phpcs --standard=PSR12 shows no new violations on any changed line (pre-existing violations elsewhere in these files are untouched)
  • Full PHPUnit 11 run in CI (requires the parent app; not runnable standalone in this checkout)

PHPUnit 11 requires @dataProvider methods to be static. Convert the
non-static providers and remove their remaining dependency on $this
(static gender list, per-call Faker instance) so they can run as
static methods.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@ggottwald
ggottwald requested a review from a team as a code owner September 3, 2026 13:22
@ggottwald
ggottwald merged commit 53dacd7 into stable Sep 3, 2026
2 checks passed
@ggottwald
ggottwald deleted the fix/phpunit11-static-data-providers branch September 3, 2026 13:37
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.

2 participants