-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Tests] Migrate data providers to static ones #49244
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
[Tests] Migrate data providers to static ones #49244
Conversation
aae261e
to
f6bfca6
Compare
{ | ||
$data = []; | ||
foreach ($objects as $name => $object) { | ||
$description = file_get_contents(sprintf('%s/../Fixtures/%s.%s', __DIR__, $name, $this->getFormat())); | ||
$description = file_get_contents(sprintf('%s/../Fixtures/%s.%s', __DIR__, $name, static::getFormat())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd rather use self::
IMHO because this is more specific. We don't want to open test cases to extensibility (unless abstract test cases of course, for calls that are designed for that.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taking note for the next ones. Thank you very much for taking care of this!
f6bfca6
to
36bc5ae
Compare
Thank you @alexandre-daubois. |
…e-daubois) This PR was merged into the 5.4 branch. Discussion ---------- [Tests] Migrate tests to static data providers | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes-ish | New feature? | no | Deprecations? | no | Tickets | Continuing #48668 (comment) | License | MIT | Doc PR | _NA_ This is yet another PR to continue the manual work needed for the migration of data providers to static ones. I also took the opportunity to pass a few `static::` to `self::` calls, as pointed out by Nicolas in this comment: #49244 (comment) cc `@OskarStark` 👋 Commits ------- 3b8b070 [Tests] Migrate tests to static data providers
…e-daubois) This PR was merged into the 5.4 branch. Discussion ---------- [Tests] Migrate tests to static data providers | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes-ish | New feature? | no | Deprecations? | no | Tickets | Continuing symfony/symfony#48668 (comment) | License | MIT | Doc PR | _NA_ This is yet another PR to continue the manual work needed for the migration of data providers to static ones. I also took the opportunity to pass a few `static::` to `self::` calls, as pointed out by Nicolas in this comment: symfony/symfony#49244 (comment) cc `@OskarStark` 👋 Commits ------- 3b8b07037b [Tests] Migrate tests to static data providers
This PR was merged into the 5.4 branch. Discussion ---------- Split and clean up tests | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | n/a | License | MIT | Doc PR | n/a This pull request - [x] splits a test and removes a data provider to avoid creating test doubles in data providers Follows #49244. 💁♂️ This follows a brief discussion on Twitter (see https://twitter.com/VotrubaT/status/1622995017756291074). I do not expect this to be merged, but in my opinion, creating - test doubles - the system under test (not the case here, but I have observed it elsewhere) in data providers are anti-patterns. ~~Other than that, I have no idea what we are testing here.~~ Commits ------- 66e9fe1 Fix: Split and clean up tests
Migrating data providers to static ones, based on the failing CI of #48668
cc @OskarStark 👋