8000 [PhpUnitBridge] Adjust output parsing of CoverageListenerTrait for PHPUnit 9.3 by derrabus · Pull Request #38071 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[PhpUnitBridge] Adjust output parsing of CoverageListenerTrait for PHPUnit 9.3 #38071

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 5, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[PhpUnitBridge] Adjust output parsing for PHPUnit 9.3.
  • Loading branch information
derrabus committed Sep 5, 2020
commit a3831dc0f25108fe888ec4f356127aeec4c01018
14 changes: 10 additions & 4 deletions src/Symfony/Bridge/PhpUnit/Tests/CoverageListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
0