zenstruck / browser

A fluent interface for your Symfony functional tests.
MIT License
185 stars 17 forks source link

phpunit 10 support proposal #137

Closed raneomik closed 8 months ago

raneomik commented 8 months ago

proposal for #118 issue

Chris53897 commented 8 months ago

thanks for your work @raneomik Could you change the PHPUnit version in composer.json to "phpunit/phpunit": "^9.5|^10.4", ? I guess this would trigger the ci to test with PHPUnit 10 if possible.

Or did i oversee a testrun fo PHPUnit 10?

raneomik commented 8 months ago

thanks for your work @raneomik Could you change the PHPUnit version in composer.json to "phpunit/phpunit": "^9.5|^10.4", ? I guess this would trigger the ci to test with PHPUnit 10 if possible.

Or did i oversee a testrun fo PHPUnit 10?

besides some deprecations and a different phpunit config needed /suggested (does CI support a dedicated "phpunit10.xml" file ?), all seems good

kbond commented 8 months ago

This looks great @raneomik! Is enabling the extension in phpunit 10 identical to: https://github.com/zenstruck/browser#installation?

raneomik commented 8 months ago

@kbond yes, with a small adaptation required by phpunit 10 ("bootstrap" instead of "extension"), like this :

<phpunit>
    ...
    <extensions>
        <bootstrap class="Zenstruck\Browser\Test\BrowserExtension" />
    </extensions>
</phpunit>

might be worth mentioning it in the readme, like it is the case for example in this extension : https://github.com/dmaicher/doctrine-test-bundle#using-the-bundle-with-phpunit ?

raneomik commented 8 months ago

Hello @nikophil,

sadly, I've still not used phpunit 10, so I don't understand fully this PR.

I really not am fluent in using it either, it's the first project with functional tests using zenstruck/browser which we are trying to migrate to phpunit 10... this PR basicaly just takes what was done in other phpunit extension projects to make it compatible with phpunit10 & previous version at the same time (for example : panther, DAMA, speedtrap example referenced in #118...) (including some other updates to drop some phpunit10 deprecations in its own tests - aka static dataproviders)

I'm wondering if we should not change the CI to test with both phpunit version ?

it is exactly what I was wondering here 😅 The update in composer.json suggested by @Chris53897 already makes the CI use phpunit 10, only with some deprecations and it doesn't seem to affect the coverage reports. Adding this file will drop this deprecation/new file suggest but only in the job that use the phpunit10 dedicated file (panther's phpunit 10 in CI for example)

kbond commented 8 months ago

might be worth mentioning it in the readme

Do you mind adding in this PR?

kbond commented 8 months ago

Thanks for this @raneomik!