Reverting changes from c05df432

This commit is contained in:
Dimitrios Karvounaris
2020-06-05 19:24:56 +02:00
parent 38584bec93
commit d24830121e
2 changed files with 28 additions and 23 deletions

View File

@ -126,7 +126,6 @@
✓ it does not allow to add the same test description twice ✓ it does not allow to add the same test description twice
PASS Tests\Visual\SingleTestOrDirectory PASS Tests\Visual\SingleTestOrDirectory
✓ output contains full test path
✓ allows to run a single test ✓ allows to run a single test
✓ allows to run a directory ✓ allows to run a directory
✓ it has ascii chars (decorated printer) ✓ it has ascii chars (decorated printer)
@ -135,5 +134,5 @@
WARN Tests\Visual\Success WARN Tests\Visual\Success
s visual snapshot of test suite on success s visual snapshot of test suite on success
Tests: 6 skipped, 72 passed Tests: 6 skipped, 71 passed
Time: 2.89s Time: 2.89s

View File

@ -10,25 +10,25 @@ $run = function (string $target) {
return preg_replace('#\\x1b[[][^A-Za-z]*[A-Za-z]#', '', $process->getOutput()); return preg_replace('#\\x1b[[][^A-Za-z]*[A-Za-z]#', '', $process->getOutput());
}; };
test('output contains full test path', function() use ($run) {
$output = $run('tests/Fixtures/DirectoryWithTests/ExampleTest.php');
assertStringContainsString(' PASS Tests\Fixtures\DirectoryWithTests\ExampleTest', $output);
});
test('allows to run a single test', function () use ($run) { test('allows to run a single test', function () use ($run) {
$output = $run('tests/Fixtures/DirectoryWithTests/ExampleTest.php'); assertStringContainsString(<<<EOF
assertStringContainsString(' PASS Tests\Fixtures\DirectoryWithTests\ExampleTest', $output); PASS Tests\Fixtures\DirectoryWithTests\ExampleTest
assertStringContainsString(' ✓ it example 1', $output); it example 1
assertStringContainsString(' Tests: 1 passed', $output);
Tests: 1 passed
EOF, $run('tests/Fixtures/DirectoryWithTests/ExampleTest.php'));
}); });
test('allows to run a directory', function () use ($run) { test('allows to run a directory', function () use ($run) {
$output = $run('tests/Fixtures'); assertStringContainsString(<<<EOF
assertStringContainsString(' PASS Tests\Fixtures\DirectoryWithTests\ExampleTest', $output); PASS Tests\Fixtures\DirectoryWithTests\ExampleTest
assertStringContainsString(' ✓ it example 1', $output); it example 1
assertStringContainsString(' PASS Tests\Fixtures\ExampleTest', $output);
assertStringContainsString(' ✓ it example 2', $output); PASS Tests\Fixtures\ExampleTest
assertStringContainsString(' Tests: 2 passed', $output); it example 2
Tests: 2 passed
EOF, $run('tests/Fixtures'));
}); });
it('has ascii chars (decorated printer)', function () { it('has ascii chars (decorated printer)', function () {
@ -40,9 +40,12 @@ it('has ascii chars (decorated printer)', function () {
$process->run(); $process->run();
$output = $process->getOutput(); $output = $process->getOutput();
assertStringContainsString(" \e[30;42;1m PASS \e[39;49;22m\e[39m Tests\Fixtures\DirectoryWithTests\ExampleTest\e[39m", $output); assertStringContainsString(<<<EOF
assertStringContainsString(" \e[32;1m✓\e[39;22m\e[39m \e[2mit example 1\e[22m\e[39m", $output); \e[30;42;1m PASS \e[39;49;22m\e[39m Tests\Fixtures\DirectoryWithTests\ExampleTest\e[39m
assertStringContainsString(" \e[37;1mTests: \e[39;22m\e[32;1m1 passed\e[39;22m", $output); \e[32;1m✓\e[39;22m\e[39m \e[2mit example\e[22m\e[39m
\e[37;1mTests: \e[39;22m\e[32;1m1 passed\e[39;22m
EOF, $output);
}); });
it('disable decorating printer when colors is set to never', function () { it('disable decorating printer when colors is set to never', function () {
@ -55,7 +58,10 @@ it('disable decorating printer when colors is set to never', function () {
$process->run(); $process->run();
$output = $process->getOutput(); $output = $process->getOutput();
assertStringContainsString(' PASS Tests\Fixtures\DirectoryWithTests\ExampleTest', $output); assertStringContainsString(<<<EOF
assertStringContainsString("\e[2mit example 1\e[22m", $output); \e[30;42;1m PASS \e[39;49;22m\e[39m Tests\Fixtures\DirectoryWithTests\ExampleTest\e[39m
assertStringContainsString(' Tests: 1 passed', $output); \e[32;1m✓\e[39;22m\e[39m \e[2mit example\e[22m\e[39m
\e[37;1mTests: \e[39;22m\e[32;1m1 passed\e[39;22m
EOF, $output);
}); });