mirror of
https://github.com/pestphp/pest.git
synced 2026-12-04 23:15:06 +01:00
67d3733eb2
Co-authored-by: haranishi <223786623+haranishi@users.noreply.github.com> Co-authored-by: Punyapal Shah <53343069+MrPunyapal@users.noreply.github.com> Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
36 lines
1.2 KiB
PHP
36 lines
1.2 KiB
PHP
<?php
|
|
|
|
use Symfony\Component\Process\Process;
|
|
use Tests\Fixtures\Tia\Project;
|
|
|
|
test('visual snapshot of help command output', function (): void {
|
|
$output = function (): ?string {
|
|
$process = (new Process(['php', 'bin/pest', '--version'], null, ['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true', 'PAO_DISABLE' => '1']));
|
|
|
|
$process->run();
|
|
|
|
return removeAnsiEscapeSequences($process->getOutput());
|
|
};
|
|
|
|
expect($output())->toMatchSnapshot();
|
|
})->skipOnWindows()->skip(! getenv('REBUILD_SNAPSHOTS') && getenv('EXCLUDE'));
|
|
|
|
test('prints information when the tests directory is missing', function (string $option, string $expected): void {
|
|
$project = Project::withoutGit();
|
|
|
|
try {
|
|
rename($project->path('tests'), $project->path('fixtures'));
|
|
unlink($project->path('phpunit.xml'));
|
|
|
|
$result = $project->pest($option);
|
|
|
|
expect($result->exitCode)->toBe(0, $result->describe())
|
|
->and($result->output)->toContain($expected);
|
|
} finally {
|
|
Project::destroyAll();
|
|
}
|
|
})->with([
|
|
'help' => ['--help', '--init'],
|
|
'version' => ['--version', 'Pest Testing Framework'],
|
|
]);
|