Skip to content

Commit

Permalink
Make RunUselessTestsCest compatible with PHPUnit 5.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Naktibalda committed May 24, 2022
1 parent cfb48bb commit f0f540b
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions tests/cli/RunUselessTestsCest.php
Expand Up @@ -5,7 +5,7 @@ class RunUselessTestsCest
public function checkOutput(CliGuy $I)
{
$I->amInPath('tests/data/useless');
$I->executeCommand('run');
$I->executeCommand('run -v');
// $I->seeInShellOutput('U UselessCept: Make no assertions');
// $I->seeInShellOutput('U UselessCest: Make no assertions');
$I->seeInShellOutput('U UselessTest: Make no assertions');
Expand Down Expand Up @@ -107,19 +107,33 @@ public function checkReports(CliGuy $I)
$I->seeInShellOutput('UselessTest: Make no assertions............................................Useless');

$I->seeFileFound('report.xml', 'tests/_output');
$I->seeInThisFile(
"<testsuite name=\"unit\" tests=\"4\" assertions=\"$assertions\" errors=\"$useless\" failures=\"0\" skipped=\"$skipped\" time=\""
);

if (version_compare(\PHPUnit\Runner\Version::id(), '6.0.0', '>=')) {
$I->seeInThisFile(
"<testsuite name=\"unit\" tests=\"4\" assertions=\"$assertions\" errors=\"$useless\" failures=\"0\" skipped=\"$skipped\" time=\""
);
} else {
$I->seeInThisFile(
"<testsuite name=\"unit\" tests=\"4\" assertions=\"$assertions\" failures=\"0\" errors=\"2\" time=\""
);
}
// $I->seeInThisFile('<testcase name="Useless"');
// $I->seeInThisFile('<testcase name="makeNoAssertions" class="UselessCest"');
$I->seeInThisFile('<testcase name="testMakeNoAssertions" class="UselessTest" file="');
$I->seeInThisFile('<testcase name="testMakeUnexpectedAssertion" class="UselessTest" file="');
$I->seeInThisFile('Risky Test');

$I->seeFileFound('phpunit-report.xml', 'tests/_output');
$I->seeInThisFile(
"<testsuite name=\"unit\" tests=\"4\" assertions=\"$assertions\" errors=\"$useless\" failures=\"0\" skipped=\"$skipped\" time=\""
);

if (version_compare(\PHPUnit\Runner\Version::id(), '6.0.0', '>=')) {
$I->seeInThisFile(
"<testsuite name=\"unit\" tests=\"4\" assertions=\"$assertions\" errors=\"$useless\" failures=\"0\" skipped=\"$skipped\" time=\""
);
} else {
$I->seeInThisFile(
"<testsuite name=\"unit\" tests=\"4\" assertions=\"$assertions\" failures=\"0\" errors=\"2\" time=\""
);
}
// $I->seeInThisFile('<testcase name="Useless"');
// $I->seeInThisFile('<testcase name="makeNoAssertions" class="UselessCest"');
$I->seeInThisFile('<testcase name="testMakeNoAssertions" class="UselessTest" file="');
Expand Down

0 comments on commit f0f540b

Please sign in to comment.