chore: uses snapshot testing in some visual testing

This commit is contained in:
Nuno Maduro
2023-06-17 13:36:39 +01:00
parent 36b585835d
commit b1c6f247e0
8 changed files with 14 additions and 31 deletions

View File

@ -1,8 +1,6 @@
<?php
test('visual snapshot of help command output', function () {
$snapshot = __DIR__.'/../.snapshots/help-command.txt';
$output = function () {
$process = (new Symfony\Component\Process\Process(['php', 'bin/pest', '--help'], null, ['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true']));
@ -11,11 +9,5 @@ test('visual snapshot of help command output', function () {
return preg_replace('#\\x1b[[][^A-Za-z]*[A-Za-z]#', '', $process->getOutput());
};
if (getenv('REBUILD_SNAPSHOTS')) {
file_put_contents($snapshot, $output());
$this->markTestSkipped('Snapshot rebuilt.');
}
expect($output())->toContain(file_get_contents($snapshot));
expect($output())->toMatchSnapshot();
})->skipOnWindows();