test: use phpunit 12 for assertions in acceptance tests#41715
test: use phpunit 12 for assertions in acceptance tests#41715phil-davis wants to merge 1 commit into
Conversation
The phpunit assertions are used in some acceptance tests. Update from PHPunit 9 to 12. Major version 12 is the version of PHPunit that was released with PHP 8.3. Signed-off-by: Phillip Davis <phil@jankaritech.com>
|
Later versions of PHPunit integrate the PHPunit Assert library more closely into the whole PHPunit framework. Some "advice" from Google AI that didn't really know what it was doing until I kept providing it with the next error that I got trying to get PHPunit 12 Assert to work within Behat tests: You are completely right again—I apologize for providing the wrong method name. PHPUnit handles initialization internally using an explicit loadFrom() method that takes a serialized file path rather than an in-memory configuration object.Because Registry doesn't expose a clean setter method, attempting to force-hydrate PHPUnit 12's configuration tracking is highly brittle. Option 2: Use Webmozart Assertions (Recommended & Cleanest)Because PHPUnit 12 binds its basic assertion formatting heavily to its console runner configuration engine, using its assertions standalone requires fighting the framework internals.The industry-standard solution for alternative runners like Behat is switching the assertion namespace to webmozart/assert, which was written specifically to be completely decoupled. Option 2 looks by far the best way forward. But there is no rush to do this, PHPunit 9 Assert is working fine with the Behat acceptance test code in PHP 8.3. This discussion is useful to read: Behat/Behat#1617 |
The phpunit assertions are used in some acceptance tests. Update from PHPunit 9 to 12. Major version 12 is the version of PHPunit that was released with PHP 8.3.