-
Notifications
You must be signed in to change notification settings - Fork 62
Closed
Labels
Milestone
Description
PHPUnit may be configured with runtime options that alter its output or generated reports, such as --coverage-html or --log-junit or --testdox-html
Currently the slowness report is output on every test suite execution when SpeedTrapListener is enabled in phpunit.xml. This may not be desired when running PHPUnit with other options. For example, generating code coverage via --coverage-html is an opt-in runtime option. SpeedTrap should behave similarly.
Instead, the slowness report should only output when at least one of the following is true:
- Providing runtime command-line argument:
--speedtrap - PHP environment variable
PHPUNIT_SPEEDTRAPhas a string value of "enabled"
PHP environment variables can be set in php.ini or any method supported by PHP.
PHP environment variables can also be set using phpunit.xml:
<phpunit>
<php>
<env name="PHPUNIT_SPEEDTRAP" value="enabled" />
</php>
</phpunit>
Feedback requested
- Are there any other ways we should support opt-in slowness reporting?
- What do you think of the name
--speedtrapfor runtime option? I'm not sure if/how this option's presence can be detected by the listener, but it can probably be done. - What do you think of the name
PHPUNIT_SPEEDTRAPfor the environment variable? This name scopes it into a fake namespace (PHPUNIT) and specific to this library (SPEEDTRAP). - Suggestions for PHPUNIT_SPEEDTRAP variable value to declare the listener should be enabled? I proposed string "enabled" because: 1) environment variables should always assume to be strings; 2) using a word prevents accidental type casting (i.e. "true" could become a boolean, "1" could be come an int or boolean; 3) the word definition of "enabled" declares exactly its effect on the listener behavior.