Skip to content

Instantly share code, notes, and snippets.

@alister
Created September 19, 2018 21:46
Show Gist options
  • Save alister/5a2da51a88cc5e8644e2c885a5c1319e to your computer and use it in GitHub Desktop.
Save alister/5a2da51a88cc5e8644e2c885a5c1319e to your computer and use it in GitHub Desktop.
Speeding up your tests, and also your code coverage!
<?php declare(strict_types=1);
require __DIR__ . '/../vendor/autoload.php';
if (extension_loaded('xdebug') &&
version_compare('2.6.0', phpversion('xdebug'), '<=')) {
xdebug_set_filter(
XDEBUG_FILTER_CODE_COVERAGE,
XDEBUG_PATH_WHITELIST,
[dirname( __DIR__ ) . '/src']
);
}
// more
<target name="phpunit-ci" description="Run unit tests with PHPUnit (full XDebug coverage)">
<exec executable="/usr/bin/php" failonerror="false">
<arg line=" -d zend_extension=xdebug.so -dxdebug.remote_enable=on vendor/bin/phpunit"/>
<arg line="--configuration=${basedir}/phpunit.xml.dist"/>
<arg line="--coverage-html=${basedir}/build/artifacts/coverage"/>
<arg line="--coverage-xml=${basedir}/build/artifacts/coverage/xml"/>
<arg line="--log-junit=${basedir}/build/artifacts/logs/junit.xml"/>
<arg line="--coverage-clover=${basedir}/build/artifacts/logs/clover.xml"/>
</exec>
</target>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/7.2/phpunit.xsd"
bootstrap = "app/bootstrap_test.php"
... other configs
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment