Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Non-static data providers are deprecated in PHPUnit 10 #48281

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

Closed
IonBazan opened this issue Nov 22, 2022 · 7 comments
Closed

Non-static data providers are deprecated in PHPUnit 10 #48281

IonBazan opened this issue Nov 22, 2022 · 7 comments
Assignees

Comments

@IonBazan
Copy link
Contributor

Description

PHPUnit 10 (still unreleased) is deprecating non-static data providers (see sebastianbergmann/phpunit@9caafe2).

While this is still not a released change, it is worth preparing for upcoming change. It will not only affect Symfony tests, but also libraries and applications using base test classes (like \Symfony\Component\Mailer\Test\TransportFactoryTestCase, etc.).

Example

No response

@wouterj
Copy link
Member

wouterj commented Nov 22, 2022

Thanks for creating the issue.

For your information, we are already aware of this and IIRC @OskarStark started working on making the data providers static.

I'm not sure how we should handle the classes Test namespace, given it's a BC break to transform a non-static method to static as far as I know.

@OskarStark
Copy link
Contributor

For your information, we are already aware of this and IIRC @OskarStark started working on making the data providers static.

Yes 💪

I'm not sure how we should handle the classes Test namespace, given it's a BC break to transform a non-static method to static as far as I know.

Nor sure yet, but this should be handled in a separate PR, I would first replace all internal used data providers by a static one.

@OskarStark OskarStark self-assigned this Nov 22, 2022
OskarStark added a commit to OskarStark/symfony that referenced this issue Nov 22, 2022
@OskarStark
Copy link
Contributor

OskarStark commented Nov 22, 2022

Todo

@IonBazan
Copy link
Contributor Author

@wouterj thanks, I'll keep this issue so we can keep track of the progress.

@OskarStark Thanks for picking it up, really good job 🚀

@OskarStark
Copy link
Contributor

nicolas-grekas added a commit that referenced this issue Feb 14, 2023
… (OskarStark)

This PR was squashed before being merged into the 5.4 branch.

Discussion
----------

Migrate to `static` data providers using `rector/rector`

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | #48281
| License       | MIT
| Doc PR        | n/a

`@nicolas`-grekas it can be executed by running:
```bash
tools/vendor/bin/rector process --config=tools/rector.php
```

Review commit by commit.
We need to check now where we use object context in static providers and fix them manually, an maybe merge them manually, unmerge them and apply rector one by one to every branch.

Commits
-------

2ec54e9 Migrate to `static` data providers using `rector/rector`
@carsonbot
Copy link

Thank you for this issue.
There has not been a lot of activity here for a while. Has this been resolved?

@OskarStark
Copy link
Contributor

Done

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

No branches or pull requests

4 participants