Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a3831dc

Browse filesBrowse files
committed
[PhpUnitBridge] Adjust output parsing for PHPUnit 9.3.
1 parent 99c98bd commit a3831dc
Copy full SHA for a3831dc

File tree

1 file changed

+10
-4
lines changed
Filter options

1 file changed

+10
-4
lines changed

‎src/Symfony/Bridge/PhpUnit/Tests/CoverageListenerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/Tests/CoverageListenerTest.php
+10-4Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,19 @@ public function test()
3131
$dir = __DIR__.'/../Tests/Fixtures/coverage';
3232
$phpunit = $_SERVER['argv'][0];
3333

34-
exec("$php $phpunit -c $dir/phpunit-without-listener.xml.dist $dir/tests/ --coverage-text 2> /dev/null", $output);
34+
exec("$php $phpunit -c $dir/phpunit-without-listener.xml.dist $dir/tests/ --coverage-text --colors=never 2> /dev/null", $output);
3535
$output = implode("\n", $output);
36-
$this->assertStringContainsString('FooCov', $output);
36+
$this->assertMatchesRegularExpression('/FooCov\n\s*Methods:\s+100.00%[^\n]+Lines:\s+100.00%/', $output);
3737

38-
exec("$php $phpunit -c $dir/phpunit-with-listener.xml.dist $dir/tests/ --coverage-text 2> /dev/null", $output);
38+
exec("$php $phpunit -c $dir/phpunit-with-listener.xml.dist $dir/tests/ --coverage-text --colors=never 2> /dev/null", $output);
3939
$output = implode("\n", $output);
40-
$this->assertStringNotContainsString('FooCov', $output);
40+
41+
if (false === strpos($output, 'FooCov')) {
42+
$this->addToAssertionCount(1);
43+
} else {
44+
$this->assertMatchesRegularExpression('/FooCov\n\s*Methods:\s+0.00%[^\n]+Lines:\s+0.00%/', $output);
45+
}
46+
4147
$this->assertStringContainsString("SutNotFoundTest::test\nCould not find the tested class.", $output);
4248
$this->assertStringNotContainsString("CoversTest::test\nCould not find the tested class.", $output);
4349
$this->assertStringNotContainsString("CoversDefaultClassTest::test\nCould not find the tested class.", $output);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.