Skip to content

Prepare IntegrationTestCase for static data providers#4266

Merged
fabpot merged 1 commit into
twigphp:3.xfrom
derrabus:improvement/integration-test-static-providers
Sep 3, 2024
Merged

Prepare IntegrationTestCase for static data providers#4266
fabpot merged 1 commit into
twigphp:3.xfrom
derrabus:improvement/integration-test-static-providers

Conversation

@derrabus

@derrabus derrabus commented Sep 3, 2024

Copy link
Copy Markdown
Contributor

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

derrabus commented Sep 3, 2024

Copy link
Copy Markdown
Contributor Author

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

stof commented Sep 3, 2024

Copy link
Copy Markdown
Member

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

Comment thread CHANGELOG Outdated
@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

fabpot commented Sep 3, 2024

Copy link
Copy Markdown
Contributor

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

fabpot commented Sep 3, 2024

Copy link
Copy Markdown
Contributor

Thank you @derrabus.

@fabpot fabpot merged commit 722a5fb into twigphp:3.x Sep 3, 2024
@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
Copy Markdown
Contributor

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

Comment thread doc/deprecated.rst
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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

typo

@GromNaN

GromNaN commented Jan 10, 2025

Copy link
Copy Markdown
Contributor

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

@williamdes

This comment was marked as outdated.

@williamdes

Copy link
Copy Markdown
Contributor

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

Update: I am trying to cleanup my TODO lists. I will not be the one making the doc update :/

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