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

[Twig 4] Add PHPUnit as dev dependency #4472

Merged
merged 1 commit into from
Dec 1, 2024
Merged

Conversation

ruudk
Copy link
Contributor

@ruudk ruudk commented Nov 24, 2024

This makes it easier to run the tests locally.

I understand we didn't do this previously (Twig 3) because of symfony/simple-phpunit. But that is now removed in Twig 4, so maybe we can do this as well?

@fabpot
Copy link
Contributor

fabpot commented Nov 25, 2024

@ruudk That works for me. We used to have PHPunit 11.3. Here, you're suggesting to bump to 11.5, but tests don't pass, can you have a look?

@ruudk
Copy link
Contributor Author

ruudk commented Nov 25, 2024

@sebastianbergmann
Copy link

you're suggesting to bump to 11.5

I am also interested in why you propose to use a development version of PHPUnit.

@ruudk
Copy link
Contributor Author

ruudk commented Nov 25, 2024

@sebastianbergmann I did not do this on purpose. I ran composer require phpunit/phpunit --dev and it picked ^11.5. Even when I manually choose ^11.4 is still installs the dev version.

I think we need to change this:

"minimum-stability": "dev",

I was unaware of this setting.

@ruudk ruudk force-pushed the v4-require-phpunit branch 2 times, most recently from 4c9f92c to bc9ed35 Compare November 25, 2024 10:50
@ruudk
Copy link
Contributor Author

ruudk commented Nov 25, 2024

PR is ready for review now.

@@ -5,7 +5,6 @@
"keywords": ["templating"],
"homepage": "https://twig.symfony.com",
"license": "BSD-3-Clause",
"minimum-stability": "dev",
Copy link
Member

Choose a reason for hiding this comment

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

using dev stability for our dependencies was done on purpose. You should use phpunit/phpunit": "^11.4@stable" to override it only for phpunit instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it really needed? Looking at the dependencies:

Twig/composer.json

Lines 26 to 35 in c192cbf

"require": {
"php": ">=8.2",
"symfony/deprecation-contracts": "^2.5|^3",
"symfony/polyfill-mbstring": "^1.3",
"symfony/polyfill-ctype": "^1.8"
},
"require-dev": {
"psr/container": "^1.0|^2.0",
"phpstan/phpstan": "^2.0"
},

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Btw, the same thing happened when @VincentLanglet added PHPStan. It was installing the dev version without anybody noticing it.

Copy link
Contributor

Choose a reason for hiding this comment

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

"phpstan/phpstan": "^2.0@stable"

should be preferred too then

@fabpot
Copy link
Contributor

fabpot commented Dec 1, 2024

Thank you @ruudk.

@fabpot fabpot merged commit 196c9dc into twigphp:4.x Dec 1, 2024
7 checks passed
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