beyondcode / dusk-dashboard

A beautiful dashboard for your Laravel Dusk tests
https://pociot.dev/8-introducing-laravel-dusk-dashboard
MIT License
559 stars 63 forks source link

Fatal Error: incompatible declarations #38

Closed ricardoboss closed 5 years ago

ricardoboss commented 5 years ago

After installation I ran php artisan dusk:dashboard and got the usual messages:

Started Dusk Dashboard on port 9773
Your Dusk tests are now being watched.
If the dashboard does not automatically open, visit: http://localhost:9773/dashboard

After opening the dashboard in Chrome and clicking on "Start Tests" nothing happens visually (looking at the network activity I was able to see messages were sent via a websocket).

I tried to run tests in the console using php artisan dusk and got this error message for every test:

Fatal error: Declaration of BeyondCode\DuskDashboard\Testing\TestCase::onNotSuccessfulTest(Throwable $t) must be compatible with PHPUnit\Framework\TestCase::onNotSuccessfulTest(Throwable $t): void in xxx\vendor\beyondcode\dusk-dashboard\src\Testing\TestCase.php on line 16

After editing the TestCase#onNotSuccessfulTest(Throwable $t) to return void I was able to start dusk from console and also from the dashboard.

ricardoboss commented 5 years ago

Some additional Information on this problem: this only occurs when using PHPUnit 8+ since they added type hinting to their codebase. This was a breaking change (hence the major version increase).

To fix this issue, we could add type hinting to this codebase (#39) or add an incompatibility with PHPUnit 8+ (in composer.json).

I'm willing to create the pull requests but I want to hear what others think.