8000 [Tests] Declare static data providers by alexandre-daubois · Pull Request #48953 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Tests] Declare static data providers #48953

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

alexandre-daubois
Copy link
Member
@alexandre-daubois alexandre-daubois commented Jan 11, 2023
Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets NA
License MIT
Doc PR NA

As announced, PHPUnit 10 will be deprecating non static data providers. This is my take on changing framework's data providers to static ones. There are some providers left without static, the reason being they are using $this and they need a refactoring to be declared static.

The process of adding static has been the following:

  1. Running Rector on the project with the [StaticDataProviderClassMethodRector](https://github.com/rectorphp/rector-phpunit/blob/main/src/Rector/Class_/StaticDataProviderClassMethodRector.php) rule as described here: Add a rector turning data providers into static methods rectorphp/rector-phpunit#126
  2. Going through abstract data providers to declare their implementations as static
  3. Removing static from not-ready data providers (those using $this)
  4. Keep a trace of the remaining data providers

The PR is huge, the only thing that changed in the static keyword in front of data providers that allowed it.

List of remaining non-static data providers, if needed for a meta-issue
  • src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php
  • src/Symfony/Component/Filesystem/Tests/PathTest.php
  • src/Symfony/Component/Security/Core/Tests/Authorization/Strategy/AffirmativeStrategyTest.php
  • src/Symfony/Component/Yaml/Tests/ParserTest.php
  • src/Symfony/Component/Security/Http/Tests/Authentication/AuthenticatorManagerTest.php
  • src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php
  • src/Symfony/Component/Security/Http/Tests/EventListener/PasswordMigratingListenerTest.php
  • src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php
  • src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
  • src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php
  • src/Symfony/Component/Workflow/Tests/Dumper/MermaidDumperTest.php
  • src/Symfony/Component/Workflow/Tests/Dumper/PlantUmlDumperTest.php
  • src/Symfony/Component/Security/Csrf/Tests/CsrfTokenManagerTest.php
  • src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php
  • src/Symfony/Component/Asset/Tests/VersionStrategy/JsonManifestVersionStrategyTest.php
  • src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTest.php
  • src/Symfony/Component/Lock/Tests/Store/StoreFactoryTest.php
  • src/Symfony/Component/Messenger/Tests/Middleware/HandleMessageMiddlewareTest.php
  • src/Symfony/Component/Finder/Tests/Iterator/DateRangeFilterIteratorTest.php
  • src/Symfony/Component/DomCrawler/Tests/Html5ParserCrawlerTest.php
  • src/Symfony/Component/ExpressionLanguage/Tests/Node/AbstractNodeTest.php
  • src/Symfony/Component/Security/Core/Tests/Auth 8000 entication/Token/AbstractTokenTest.php
  • src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php
  • src/Symfony/Component/Security/Core/Tests/Authorization/TraceableAccessDecisionManagerTest.php
  • src/Symfony/Component/Security/Core/Tests/Authorization/Voter/ExpressionVoterTest.php
  • src/Symfony/Component/Mailer/Test/TransportFactoryTestCase.php implementations
  • src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php
  • src/Symfony/Component/HttpKernel/Tests/EventListener/ErrorListenerTest.php
  • src/Symfony/Component/Finder/Tests/Iterator/DepthRangeFilterIteratorTest.php
  • src/Symfony/Component/Finder/Tests/Iterator/ExcludeDirectoryFilterIteratorTest.php
  • src/Symfony/Component/Finder/Tests/Iterator/FileTypeFilterIteratorTest.php
  • src/Symfony/Component/Finder/Tests/Iterator/SortableIteratorTest.php
  • src/Symfony/Component/Translation/Test/ProviderTestCase.php
  • src/Symfony/Component/Security/Core/Tests/Authorization/Voter/VoterTest.php
  • src/Symfony/Component/Notifier/Test/TransportTestCase.php
  • src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/ProfilerControllerTest.php
  • src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/TextDescriptorTest.php
  • src/Symfony/Bundle/SecurityBundle/Tests/DataCollector/SecurityDataCollectorTest.php
  • src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php
  • src/Symfony/Component/Translation/Tests/PseudoLocalizationTranslatorTest.php
  • src/Symfony/Component/ExpressionLanguage/Tests/ParserTest.php
  • src/Symfony/Component/Validator/Tests/Constraints/CountValidatorTest.php

@GromNaN
Copy link
Member
GromNaN commented Jan 12, 2023

Hello @alexandre-daubois, @OskarStark is already working on this topic and opened #48668. The issue was created 2 months ago #48281.

  1. Going through abstract data providers to declare their implementations as static

There is breaking changes #48668 (review). We are looking for the best solution that respects our BC policy.

@alexandre-daubois
Copy link
Member Author
alexandre-daubois commented Jan 12, 2023

Alright thanks @GromNaN, I'll see if I can help there! 👌

@alexandre-daubois alexandre-daubois deleted the fix/phpunit-static-data-provider branch January 12, 2023 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0