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

Skip to content

[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

Merged

Conversation

alexandre-daubois
Copy link
Member
Q A
Branch? 5.4
Bug fix? yes-ish
New feature? no
Deprecations? no
Tickets Related to #48668
License MIT
Doc PR NA

Migrating data providers to static ones, based on the failing CI of #48668

cc @OskarStark 👋

{
$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()));
Copy link
Member

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.)

Copy link
Member Author

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!

@nicolas-grekas
Copy link
Member

Thank you @alexandre-daubois.

@nicolas-grekas nicolas-grekas merged commit 7d3175e into symfony:5.4 Feb 6, 2023
@alexandre-daubois alexandre-daubois deleted the static-data-providers branch February 6, 2023 08:50
@localheinz localheinz mentioned this pull request Feb 7, 2023
1 task
nicolas-grekas added a commit that referenced this pull request Feb 10, 2023
…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
symfony-splitter pushed a commit to symfony/web-profiler-bundle that referenced this pull request Feb 10, 2023
…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
nicolas-grekas added a commit that referenced this pull request Feb 10, 2023
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
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.

4 participants
0