Skip to content
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

Prepare IntegrationTestCase for static data providers #4266

Merged

Conversation

derrabus
Copy link
Contributor

@derrabus derrabus commented Sep 3, 2024

Data providers need to be static in PHPUnit 11. Because of this, I'd like to declare the two methods we use as data providers in IntegrationTestCase as static in 4.0. This PR prepares that change:

  • The non-static getFixturesDir() method is replaced with a static getFixturesDirectory().
  • Both methods getTests() and getLegacyTests() are marked as final, so we can declare them static in the next major.

This however means that we're delaying PHPUnit 11 compatibility of integration tests to Twig 4.0. If that's too late for us, we could deprecate the whole IntegrationTestCase in favor of a compatible replacement. That's a bigger change, but I would work on it if you think it's worth it.

@derrabus
Copy link
Contributor Author

derrabus commented Sep 3, 2024

The failures in the extra packages happen because we pull a version of Twig as dependency that does not include my changes. How do we deal with this kind of failure on this repo?

@stof
Copy link
Member

stof commented Sep 3, 2024

@derrabus accept it for now, as it will be resolved after the merge-up in the 4.x branch.

CHANGELOG Outdated Show resolved Hide resolved
@derrabus derrabus force-pushed the improvement/integration-test-static-providers branch 2 times, most recently from ae35b7a to a57f35e Compare September 3, 2024 10:37
@fabpot
Copy link
Contributor

fabpot commented Sep 3, 2024

Having PHPUnit 11 support only in 4.0 sounds good to me.

@derrabus derrabus force-pushed the improvement/integration-test-static-providers branch from a57f35e to 18f4203 Compare September 3, 2024 13:08
@derrabus derrabus mentioned this pull request Sep 3, 2024
10 tasks
@fabpot
Copy link
Contributor

fabpot commented Sep 3, 2024

Thank you @derrabus.

@fabpot fabpot merged commit 722a5fb into twigphp:3.x Sep 3, 2024
13 of 49 checks passed
@derrabus derrabus deleted the improvement/integration-test-static-providers branch September 3, 2024 20:28
fabpot added a commit that referenced this pull request Sep 4, 2024
This PR was squashed before being merged into the 4.x branch.

Discussion
----------

PHPUnit 11

This PR switches our CI to PHPUnit 11.

TODO:

- [x] #4262
- [x] #4263
- [x] #4264
- [x] #4265
- [x] #4268
- [x] #4266
- [x] #4270
- [x] #4271
- [x] #4272
- [x] #4274

Commits
-------

f2053bb PHPUnit 11
@williamdes
Copy link

The documentation example is missing an update https://github.com/twigphp/Twig/blob/4.x/doc/advanced.rst#testing-an-extension

instead, which will be abstract in 4.0.

* The data providers ``getTests()`` and ``getLegacyTests()`` on
``Twig\Test\IntegrationTestCase`` are considered final als of Twig 3.13.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

@GromNaN
Copy link
Contributor

GromNaN commented Jan 10, 2025

@williamdes Would you like to open a PR to improve documentation?

@williamdes
Copy link

@williamdes Would you like to open a PR to improve documentation?

🇫🇷 I will try soon :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants