diff --git a/Tests/CoverageListenerTest.php b/Tests/CoverageListenerTest.php index d69aee70..3882b77c 100644 --- a/Tests/CoverageListenerTest.php +++ b/Tests/CoverageListenerTest.php @@ -31,13 +31,19 @@ public function test() $dir = __DIR__.'/../Tests/Fixtures/coverage'; $phpunit = $_SERVER['argv'][0]; - exec("$php $phpunit -c $dir/phpunit-without-listener.xml.dist $dir/tests/ --coverage-text 2> /dev/null", $output); + exec("$php $phpunit -c $dir/phpunit-without-listener.xml.dist $dir/tests/ --coverage-text --colors=never 2> /dev/null", $output); $output = implode("\n", $output); - $this->assertStringContainsString('FooCov', $output); + $this->assertMatchesRegularExpression('/FooCov\n\s*Methods:\s+100.00%[^\n]+Lines:\s+100.00%/', $output); - exec("$php $phpunit -c $dir/phpunit-with-listener.xml.dist $dir/tests/ --coverage-text 2> /dev/null", $output); + exec("$php $phpunit -c $dir/phpunit-with-listener.xml.dist $dir/tests/ --coverage-text --colors=never 2> /dev/null", $output); $output = implode("\n", $output); - $this->assertStringNotContainsString('FooCov', $output); + + if (false === strpos($output, 'FooCov')) { + $this->addToAssertionCount(1); + } else { + $this->assertMatchesRegularExpression('/FooCov\n\s*Methods:\s+0.00%[^\n]+Lines:\s+0.00%/', $output); + } + $this->assertStringContainsString("SutNotFoundTest::test\nCould not find the tested class.", $output); $this->assertStringNotContainsString("CoversTest::test\nCould not find the tested class.", $output); $this->assertStringNotContainsString("CoversDefaultClassTest::test\nCould not find the tested class.", $output);