NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist
Packagist, #1140 most downloaded on Packagist
Find and report on slow tests in your PHPUnit test suite
Latest stable
v4.0.1
Last release 4 years ago
no release in 18 months
Ships fairly regularly
a new release about every 8 months
Most releases are documented
notes for 9 of 12 stable releases
Nothing withdrawn
no release was ever pulled
12 years old
13 releases · first in 2015
Drag across the ruler to compare, or tap a release to open it.
README documents working with Symfony Framework simple-phpunit
simple-phpunitPR #81 Reformat slow test case output for compatibility with PHPUnit --filter option
v3.3.0...v.4.0.0)stopOnSlow stops execution upon first slow test. Default: false.@slowThreshold 0 disables checks for individual tests.simple-phpunitThis is the last release compatible with PHP < 7.2 and PHPUnit < 8.0. SpeedTrap v5.0.0 will be upgrading to the PHPUnit Extension system instead of the TestListener system.
Despite being a new feature in v4.0.0, the stopOnSlow configuration will be removed in v5.0.0 because the new PHPUnit Extension system does not support Extensions stopping the test runner.
You may encounter a backwards compatibility break if you programmatically parse the console output from SpeedTrap.
Prior to 4.0 the slowness report displayed the qualified class name in a human-readable format:
1. 800ms to run JohnKary\PHPUnit\Listener\Tests\SomeSlowTest:testWithDataProvider with data set "Rock"
Starting at 4.0 the slowness report displays class names in a format ready to be used with PHPUnit's --filter option by adding slashes to the namespace delimiter and adding a colon between the class and method name:
1. 800ms to run JohnKary\\PHPUnit\\Listener\\Tests\\SomeSlowTest::testWithDataProvider with data set "Rock"
An individual slow test case can now be re-run by copying and pasting the output into a new command:
vendor/bin/phpunit --filter 'JohnKary\\PHPUnit\\Listener\\Tests\\SomeSlowTest::testWithDataProvider with data set "Rock"'
Note that PHPUnit uses single quotes for the --filter option value. See the --filter option documentation for all supported matching patterns.
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Version 3.3.0 is backwards compatible with all prior version 3.0 releases. There are no breaking changes.
🎊 Version 3.3.0 has been released! 🎊
If you encounter issues please open a new Issue or create a new Discussion.
Version 3.3.0 is backwards compatible with all prior version 3.0 releases. There are no breaking changes.
{
"require": {
"johnkary/phpunit-speedtrap": "^3.3"
}
}
$ composer update johnkary/phpunit-speedtrap
Thank you @mvorisek for communicating with Sebastian on the fix and proposing PR #73 fixing the issue. And thank you to everyone upvoting that the fix worked!
SpeedTrapListener profiles for slow tests when enabled in phpunit.xml. But using an environment variable named PHPUNIT_SPEEDTRAP can enable or disable the listener.
$ PHPUNIT_SPEEDTRAP="disabled" ./vendor/bin/phpunit
Travis CI is popular for running tests in the cloud after pushing new code to a repository.
Step 1) Enable SpeedTrapListener in phpunit.xml, but set PHPUNIT_SPEEDTRAP="disabled" to disable profiling when running tests.
<phpunit bootstrap="vendor/autoload.php">
...
<php>
<env name="PHPUNIT_SPEEDTRAP" value="disabled" />
</php>
<listeners>
<listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener" />
</listeners>
</phpunit>
Step 2) Configure .travis.yml with PHPUNIT_SPEEDTRAP="enabled" to profile for slow tests when running on Travis CI:
language: php
php:
- 7.3
env:
- PHPUNIT_SPEEDTRAP="enabled"
Step 3) View the Travis CI build output and read the slowness report printed in the console.
Travis CI Documentation - Environment Variables
Step 1) Enable SpeedTrapListener in phpunit.xml. The slowness report will output during all test suite executions.
<phpunit bootstrap="vendor/autoload.php">
...
<listeners>
<listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener" />
</listeners>
</phpunit>
Step 2) Configure .travis.yml with PHPUNIT_SPEEDTRAP="disabled" to turn off profiling when running on Travis CI:
language: php
php:
- 7.3
env:
- PHPUNIT_SPEEDTRAP="disabled"
Step 3) View the Travis CI build output and confirm the slowness report is not printed in the console.
Useful when you only want to profile slow tests once in a while.
Step 1) Setup phpunit.xml to enable SpeedTrapListener, but disable slowness profiling by setting PHPUNIT_SPEEDTRAP="disabled" like this:
<phpunit bootstrap="vendor/autoload.php">
...
<php>
<env name="PHPUNIT_SPEEDTRAP" value="disabled" />
</php>
<listeners>
<listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener" />
</listeners>
</phpunit>
Step 2) When executing phpunit from the command-line, enable slowness profiling only for this run by passing the environment variable PHPUNIT_SPEEDTRAP="enabled" like this:
$ PHPUNIT_SPEEDTRAP=enabled ./vendor/bin/phpunit
Version 3.3 adds supports for PHPUnit 9.5+, and a way to enable or disable the SpeedTrap listener using environment variables.
Exclude testing PHPUnit 9 with unsupported PHP versions
Exclude testing PHPUnit 9 with unsupported PHP versions
Version 3.2 introduces supports for PHPUnit 9.0+. If your use of SpeedTrap depends on specific text output from SpeedTrap slowness report, see below wording changes that may require updating your implementation.
Added compatibility with PHPUnit 8.0+ via composer.json.
Added compatibility with PHPUnit 8.0+ via composer.json.
No changes required.
Link to RSpec repository
Link to RSpec repository
Version 3.0 introduces support for PHPUnit 7.0+ and PHP 7.1+.
Changes may be required if you have extended SpeedTrapListener. See UPGRADE.md for upgrading your subclass to support 3.0.
Version 2.0 introduces support for PHPUnit 6.0+, PHP 7.0+ and PSR-4 autoloading.
Version 2.0 introduces support for PHPUnit 6.0+, PHP 7.0+ and PSR-4 autoloading.
Changes are required if you have extended SpeedTrapListener. See UPGRADE.md for upgrading your subclass to support 2.0.
Nothing published for this version
Merge branch '1.0' into 1.1
Merge branch '1.0' into 1.1
PHPUnit 6 switched to using vendor namespaces.
PHPUnit 6 switched to using vendor namespaces.
If you require PHPUnit 6+ support please use phpunit-speedtrap
dev-master or 2.0 release branch.
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per quarter.