You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PHPUnit (or rather php-code-coverage currently lets Xdebug collect all code coverage information and then filters it itself (in PHP code) based on the configured whitelist. Delegating this filter operation to Xdebug (where it's implemented in C) would lead to significant improvements in resource consumption.
This ticket proposes the addition of a new command-line option to PHPUnit, --dump-xdebug-filter, that instructs PHPUnit to load the phpunit.xml configuration file for a project and dump the configured whitelist to a PHP script. This PHP script contains the code to configure Xdebug's whitelist. It needs to be loaded as early as possible to have an impact on code coverage related resource consumption. Early experience shows that it is for many scenarios already "good enough" to use this generated script as (part of) the PHPUnit bootstrap script (--bootstrap, bootstrap= in phpunit.xml).
Using the PHP script generated by the new command-line option proposed above will not prevent php-code-coverage from applying the same whitelist a second time. However, a performance improvement can still be observed. A next step could be to not perform the whitelist filtering in php-code-coverage when it has already been performed by Xdebug.
The text was updated successfully, but these errors were encountered:
This adds the new CLI option --dump-xdebug-filter which will generate a PHP
script that can be used to set a whitelist filter for XDebug's code coverage
collector in order to speed up test runs.
The whitelist is based on the filter configuration in PHPUnit's XML
configuration. If the configuration only contains includes for files and
directories without prefixes and suffixes other than '.php', the XDebug script
will contain the same whitelist items.
If, however, the filter configuration is more complex, the XDebug script will
contain the resolved list of files, which will have a negative impact on
performance.
XDebugFilterScriptGenerator now completely ignores the <exclude>
part of the filter configuration and always creates the script
based on the whitelist only. Letting PHPUnit filter out the
excluded paths proved to be much faster than providing a long
list of individual files to xdebug_set_filter().
PHPUnit (or rather php-code-coverage currently lets Xdebug collect all code coverage information and then filters it itself (in PHP code) based on the configured whitelist. Delegating this filter operation to Xdebug (where it's implemented in C) would lead to significant improvements in resource consumption.
In Xdebug 2.6, @derickr added filter capabilities to tracing, stack traces, and code coverage. Xdebug's filter must be configured, though, before any of the sourcecode files that are to be filtered are loaded. This means that leveraging this new feature of Xdebug for PHPUnit is not as simple as originally anticipated.
This ticket proposes the addition of a new command-line option to PHPUnit,
--dump-xdebug-filter
, that instructs PHPUnit to load thephpunit.xml
configuration file for a project and dump the configured whitelist to a PHP script. This PHP script contains the code to configure Xdebug's whitelist. It needs to be loaded as early as possible to have an impact on code coverage related resource consumption. Early experience shows that it is for many scenarios already "good enough" to use this generated script as (part of) the PHPUnit bootstrap script (--bootstrap
,bootstrap=
inphpunit.xml
).Using the PHP script generated by the new command-line option proposed above will not prevent php-code-coverage from applying the same whitelist a second time. However, a performance improvement can still be observed. A next step could be to not perform the whitelist filtering in php-code-coverage when it has already been performed by Xdebug.
The text was updated successfully, but these errors were encountered: