phpunit-speedtrap icon indicating copy to clipboard operation
phpunit-speedtrap copied to clipboard

Use PHPUnit Extension system instead of Listener

Open johnkary opened this issue 3 years ago • 1 comments

PHPUnit 8 introduced the Hooks Extension system which deprecated the Listener system. PHPUnit 9 then removed the deprecated Listener system.

This PR completes the work started by @vlaurier in #67 to implement the Hooks Extension system, and will close issue #60.

New minimum version constraints

PHPUnit 8.0+ PHP 7.2+ (required by PHPUnit 8)

New namespace and method signatures

The SpeedTrap class has moved:

Old: JohnKary\PHPUnit\Listener\SpeedTrapListener
New: JohnKary\PHPUnit\Extension\SpeedTrap

Various method signature within the SpeedTrap class have also been changed. Updates are required if you have extended SpeedTrap for other uses.

New way to register SpeedTrap with phpunit.xml

PHPUnit extensions are registered slightly differently in phpunit.xml:

<phpunit bootstrap="vendor/autoload.php">
...
    <extensions>
        <extension class="JohnKary\PHPUnit\Extension\SpeedTrap" />
    </extensions>
</phpunit>

Remove option stopOnSlow

Prior to this PR SpeedTrap supported an option stopOnSlow to prematurely stop the test runner after encountering a slow test.

The PHPUnit Extension system does not allow Extensions to alter the test runner. The test runner cannot be stopped without killing the current PHP process. So the stopOnSlow feature had to be removed.

TODO

  • [ ] Document upgrade path in UPGRADE.md

johnkary avatar Mar 14 '21 18:03 johnkary

Hello, what is the status of this PR ?

fchastanet avatar Oct 18 '21 14:10 fchastanet