[Bridge\PhpUnit] Use phpdbg instead of xdebug in tests

This commit is contained in:
Nicolas Grekas 2017-11-12 20:24:28 +01:00
parent b215ed5c23
commit abe3404a5b

View File

@ -16,20 +16,24 @@ class CoverageListenerTest extends TestCase
$this->markTestSkipped('This test cannot be run on HHVM.');
}
exec('php --ri xdebug -d zend_extension=xdebug.so 2> /dev/null', $output, $returnCode);
if (0 !== $returnCode) {
$this->markTestSkipped('Xdebug is required to run this test.');
if (\PHP_VERSION_ID >= 70000) {
$php = 'phpdbg -qrr';
} else {
exec('php --ri xdebug -d zend_extension=xdebug.so 2> /dev/null', $output, $returnCode);
if (0 !== $returnCode) {
$this->markTestSkipped('Xdebug is required to run this test.');
}
$php = 'php -d zend_extension=xdebug.so';
}
$dir = __DIR__.'/../Tests/Fixtures/coverage';
$php = PHP_BINARY;
$phpunit = $_SERVER['argv'][0];
exec("$php -d zend_extension=xdebug.so $phpunit -c $dir/phpunit-without-listener.xml.dist $dir/tests/ --coverage-text", $output);
exec("$php $phpunit -c $dir/phpunit-without-listener.xml.dist $dir/tests/ --coverage-text", $output);
$output = implode("\n", $output);
$this->assertContains('FooCov', $output);
exec("$php -d zend_extension=xdebug.so $phpunit -c $dir/phpunit-with-listener.xml.dist $dir/tests/ --coverage-text", $output);
exec("$php $phpunit -c $dir/phpunit-with-listener.xml.dist $dir/tests/ --coverage-text", $output);
$output = implode("\n", $output);
$this->assertNotContains('FooCov', $output);
$this->assertContains("SutNotFoundTest::test\nCould not find the tested class.", $output);