diff --git a/composer.json b/composer.json index c7140ad6..6dfc06cd 100644 --- a/composer.json +++ b/composer.json @@ -71,7 +71,7 @@ "test:unit": "php bin/pest --colors=always --exclude-group=integration --compact", "test:inline": "php bin/pest --colors=always --configuration=phpunit.inline.xml", "test:parallel": "php bin/pest --colors=always --exclude-group=integration --parallel --processes=10", - "test:integration": "php bin/pest --colors=always --group=integration -v", + "test:integration": "php bin/pest --colors=always --group=integration", "update:snapshots": "REBUILD_SNAPSHOTS=true php bin/pest --colors=always", "test": [ "@test:refacto", diff --git a/tests/.snapshots/allows-to-run-a-directory.txt b/tests/.snapshots/allows-to-run-a-directory.txt index b64fc582..b8903802 100644 --- a/tests/.snapshots/allows-to-run-a-directory.txt +++ b/tests/.snapshots/allows-to-run-a-directory.txt @@ -1,7 +1,11 @@ + WARN Tests\Fixtures\CollisionTest + - error + - success + PASS Tests\Fixtures\DirectoryWithTests\ExampleTest ✓ it example 1 PASS Tests\Fixtures\ExampleTest ✓ it example 2 - Tests: 2 passed (2 assertions) + Tests: 2 skipped, 2 passed (2 assertions) diff --git a/tests/.snapshots/collision-parallel.txt b/tests/.snapshots/collision-parallel.txt new file mode 100644 index 00000000..83e57d59 --- /dev/null +++ b/tests/.snapshots/collision-parallel.txt @@ -0,0 +1,23 @@ + + ⨯. + ──────────────────────────────────────────────────────────────────────────── + FAILED Tests\Fixtures\CollisionTest > success Exception + error + + at tests/Fixtures/CollisionTest.php:4 + 1▕ skip(! isset($_SERVER['COLLISION_TEST'])); + 6▕ + 7▕ test('success', function () { + 8▕ expect(true)->toBeTrue(); + 9▕ })->skip(! isset($_SERVER['COLLISION_TEST'])); + + 1 tests/Fixtures/CollisionTest.php:4 + 2 src/Factories/TestCaseMethodFactory.php:100 + + + Tests: 1 failed, 1 passed (1 assertions) + Duration: 0.16s \ No newline at end of file diff --git a/tests/.snapshots/collision.txt b/tests/.snapshots/collision.txt new file mode 100644 index 00000000..7c2a96a1 --- /dev/null +++ b/tests/.snapshots/collision.txt @@ -0,0 +1,22 @@ + + FAIL Tests\Fixtures\CollisionTest + ⨯ error + ✓ success + ──────────────────────────────────────────────────────────────────────────── + FAILED Tests\Fixtures\CollisionTest > error Exception + error + + at tests/Fixtures/CollisionTest.php:4 + 1▕ skip(! isset($_SERVER['COLLISION_TEST'])); + 6▕ + 7▕ test('success', function () { + 8▕ expect(true)->toBeTrue(); + 9▕ })->skip(! isset($_SERVER['COLLISION_TEST'])); + + 1 tests/Fixtures/CollisionTest.php:4 + 2 src/Factories/TestCaseMethodFactory.php:100 + diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index 23581808..8a194356 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -779,6 +779,10 @@ ! warning → Undefined property: P\Tests\Features\Warnings::$fooqwdfwqdfqw ! user warning → This is a warning description + WARN Tests\Fixtures\CollisionTest + - error + - success + PASS Tests\Fixtures\DirectoryWithTests\ExampleTest ✓ it example 1 @@ -969,6 +973,10 @@ PASS Tests\Visual\BeforeEachTestName ✓ latest description + PASS Tests\Visual\Collision + ✓ collision with (['']) + ✓ collision with (['--parallel']) + PASS Tests\Visual\Help ✓ visual snapshot of help command output @@ -994,4 +1002,4 @@ PASS Tests\Visual\Version ✓ visual snapshot of help command output - Tests: 2 deprecated, 3 warnings, 4 incomplete, 1 notice, 4 todos, 12 skipped, 699 passed (1696 assertions) \ No newline at end of file + Tests: 2 deprecated, 3 warnings, 4 incomplete, 1 notice, 4 todos, 14 skipped, 701 passed (1698 assertions) \ No newline at end of file diff --git a/tests/Fixtures/CollisionTest.php b/tests/Fixtures/CollisionTest.php new file mode 100644 index 00000000..316f9709 --- /dev/null +++ b/tests/Fixtures/CollisionTest.php @@ -0,0 +1,9 @@ +skip(! isset($_SERVER['COLLISION_TEST'])); + +test('success', function () { + expect(true)->toBeTrue(); +})->skip(! isset($_SERVER['COLLISION_TEST'])); diff --git a/tests/Visual/Collision.php b/tests/Visual/Collision.php new file mode 100644 index 00000000..d40aae4a --- /dev/null +++ b/tests/Visual/Collision.php @@ -0,0 +1,38 @@ + 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true', 'COLLISION_TEST' => true] + )); + + $process->run(); + + return preg_replace('#\\x1b[[][^A-Za-z]*[A-Za-z]#', '', $process->getOutput()); + }; + + if (getenv('REBUILD_SNAPSHOTS')) { + $outputContent = explode("\n", $output()); + array_pop($outputContent); + array_pop($outputContent); + array_pop($outputContent); + array_pop($outputContent); + + file_put_contents($snapshot, implode("\n", $outputContent)); + + $this->markTestSkipped('Snapshot rebuilt.'); + } + + expect($output())->toContain(file_get_contents($snapshot)); +})->with([ + [['']], + [['--parallel']], +])->skip(PHP_OS_FAMILY === 'Windows'); diff --git a/tests/Visual/Parallel.php b/tests/Visual/Parallel.php index 0d9117cd..7496ccd3 100644 --- a/tests/Visual/Parallel.php +++ b/tests/Visual/Parallel.php @@ -15,6 +15,6 @@ $run = function () { }; test('parallel', function () use ($run) { - expect($run())->toContain('Tests: 2 deprecated, 3 warnings, 4 incomplete, 1 notice, 4 todos, 9 skipped, 690 passed (1684 assertions)') + expect($run())->toContain('Tests: 2 deprecated, 3 warnings, 4 incomplete, 1 notice, 4 todos, 11 skipped, 690 passed (1684 assertions)') ->toContain('Parallel: 3 processes'); })->skip(PHP_OS_FAMILY === 'Windows');