liip / LiipFunctionalTestBundle

Some helper classes for writing functional tests in Symfony
http://liip.ch
MIT License
640 stars 181 forks source link

Add support for phpunit 10 #610

Closed mzk closed 1 year ago

alexislefebvre commented 1 year ago

Thanks for the PR, please note that PHPUnit 10 isn't fully supported by Symfony yet: https://github.com/symfony/symfony/issues/49069

alexislefebvre commented 1 year ago

Do you need help to fix the error? The liip_functional_test.validator service and PHPUnit\Framework\MockObject\MockBuilder::setMethods() are missing when PHPUnit 10 is used. We may need a compatibility layer with something like if (method_exists(…, 'setMethods')) {…} else {…} for the mocks.

alexislefebvre commented 1 year ago

It looks like the error in the tests comes from there: https://github.com/liip/LiipFunctionalTestBundle/blob/07f5dcb429214da8cb57ec15cbb52054c308c774/src/DependencyInjection/Compiler/OptionalValidatorPass.php#L23-L25

With Symfony ^5.4 or ^6.0 and PHP 8.1+, a different set of dependencies is installed. For some reason the validator is not available in this context, which removes the validator.

I wonder why tests break in this PR but not on the main branch (e.g. it works in #611).

alexislefebvre commented 1 year ago

Coud you please push only the commit 0b57717 on a separate PR? Once it will be merged, you'll be able to run the Actions without requiring the permission from the maintainers.

mzk commented 1 year ago

@alexislefebvre done in MR https://github.com/liip/LiipFunctionalTestBundle/pull/619 .

alexislefebvre commented 1 year ago

Thanks! Please rebase this PR, the issue with PHP-CS-Fixer is fixed on the main branch.

mzk commented 1 year ago

rebased @alexislefebvre

alexislefebvre commented 1 year ago

We had to change a warning to a failing test and update the PHPUnit config. Thanks!

Please try the last release: https://github.com/liip/LiipFunctionalTestBundle/releases/tag/4.9.0