mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +01:00
Compare lines without involving linebreaks
Fixes tests failing under Windows environments for any linebreak character differences
This commit is contained in:
@ -1,3 +1,3 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
it('example')->assertTrue(true);
|
it('example 1')->assertTrue(true);
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
it('example')->assertTrue(true);
|
it('example 2')->assertTrue(true);
|
||||||
|
|||||||
@ -11,24 +11,19 @@ $run = function (string $target) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
test('allows to run a single test', function () use ($run) {
|
test('allows to run a single test', function () use ($run) {
|
||||||
assertStringContainsString(<<<EOF
|
$output = $run('tests/Fixtures/DirectoryWithTests/ExampleTest.php');
|
||||||
PASS Tests\Fixtures\DirectoryWithTests\ExampleTest
|
assertStringContainsString(' PASS Tests\Fixtures\DirectoryWithTests\ExampleTest', $output);
|
||||||
✓ it example
|
assertStringContainsString(' ✓ it example 1', $output);
|
||||||
|
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) {
|
||||||
assertStringContainsString(<<<EOF
|
$output = $run('tests/Fixtures');
|
||||||
PASS Tests\Fixtures\DirectoryWithTests\ExampleTest
|
assertStringContainsString(' PASS Tests\Fixtures\DirectoryWithTests\ExampleTest', $output);
|
||||||
✓ it example
|
assertStringContainsString(' ✓ it example 1', $output);
|
||||||
|
assertStringContainsString(' PASS Tests\Fixtures\ExampleTest', $output);
|
||||||
PASS Tests\Fixtures\ExampleTest
|
assertStringContainsString(' ✓ it example 2', $output);
|
||||||
✓ it example
|
assertStringContainsString(' Tests: 2 passed', $output);
|
||||||
|
|
||||||
Tests: 2 passed
|
|
||||||
EOF, $run('tests/Fixtures'));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('has ascii chars (decorated printer)', function () {
|
it('has ascii chars (decorated printer)', function () {
|
||||||
@ -40,12 +35,9 @@ it('has ascii chars (decorated printer)', function () {
|
|||||||
|
|
||||||
$process->run();
|
$process->run();
|
||||||
$output = $process->getOutput();
|
$output = $process->getOutput();
|
||||||
assertStringContainsString(<<<EOF
|
assertStringContainsString(" \e[30;42;1m PASS \e[39;49;22m\e[39m Tests\Fixtures\DirectoryWithTests\ExampleTest\e[39m", $output);
|
||||||
\e[30;42;1m PASS \e[39;49;22m\e[39m Tests\Fixtures\DirectoryWithTests\ExampleTest\e[39m
|
assertStringContainsString(" \e[32;1m✓\e[39;22m\e[39m \e[2mit example 1\e[22m\e[39m", $output);
|
||||||
\e[32;1m✓\e[39;22m\e[39m \e[2mit example\e[22m\e[39m
|
assertStringContainsString(" \e[37;1mTests: \e[39;22m\e[32;1m1 passed\e[39;22m", $output);
|
||||||
|
|
||||||
\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 () {
|
||||||
@ -58,10 +50,7 @@ it('disable decorating printer when colors is set to never', function () {
|
|||||||
$process->run();
|
$process->run();
|
||||||
$output = $process->getOutput();
|
$output = $process->getOutput();
|
||||||
|
|
||||||
assertStringContainsString(<<<EOF
|
assertStringContainsString(' PASS Tests\Fixtures\DirectoryWithTests\ExampleTest', $output);
|
||||||
PASS Tests\Fixtures\DirectoryWithTests\ExampleTest
|
assertStringContainsString(" ✓ \e[2mit example 1\e[22m", $output);
|
||||||
✓ \e[2mit example\e[22m
|
assertStringContainsString(' Tests: 1 passed', $output);
|
||||||
|
|
||||||
Tests: 1 passed
|
|
||||||
EOF, $output);
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user