zenstruck / browser

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

Add compatibility with PHPUnit 10.* #118

Closed majermi4 closed 6 months ago

majermi4 commented 1 year ago

Hi,

I've tried upgrading my project to PHPUnit 10.* today and ran into errors like this when running my tests:

1) Sworp\Tests\MyTest:testSomething
Error: Interface "PHPUnit\Runner\BeforeFirstTestHook" not found

/Users/michalmajer/Projects/Sworp/hub/vendor/zenstruck/browser/src/Browser/Test/BrowserExtension.php:16

Looks like this is due to the BrowserExtension using these hooks:

use PHPUnit\Runner\AfterLastTestHook;
use PHPUnit\Runner\AfterTestErrorHook;
use PHPUnit\Runner\AfterTestFailureHook;
use PHPUnit\Runner\AfterTestHook;
use PHPUnit\Runner\BeforeFirstTestHook;
use PHPUnit\Runner\BeforeTestHook;

which have been deprecated in PHPUnit 10 and replaced by a new event system. https://thephp.cc/presentations/phpunit-10-the-new-event-subsystem

kbond commented 1 year ago

Yep, I think we'll need a phpunit 10 specific subscriber.

kbond commented 1 year ago

https://localheinz.com/articles/2023/02/14/extending-phpunit-with-its-new-event-system/

nikophil commented 1 year ago

I was thinking symfony bridge was not compatible yet?

kbond commented 1 year ago

Correct, my plan was to wait until the bridge supports phpunit 10 before digging into this.

The bridge isn't required by browser so if someone wants to create a PR in the meantime, that'd be cool.

benr77 commented 11 months ago

Hi Kevin. Is there anything in the pipeline for PHPUnit 10 support yet? Thanks.

kbond commented 11 months ago

I'm still waiting for symfony/phpunit-bridge to support phpunit 10. I wouldn't use phpunit w/o the bridge so I don't have much motivation to implement yet.

raneomik commented 8 months ago

Hello,

I also bumped on this issue, and feeled free to inspire myself from what was done for Panther.

So here's my proposal for this issue : https://github.com/zenstruck/browser/pull/137

Chris53897 commented 6 months ago

This can be closed as supported (with the linked PR).

nikophil commented 6 months ago

indeed, thanks!