mirror of
https://github.com/pestphp/pest.git
synced 2026-12-04 15:05:09 +01:00
Allow help and version before the test suite is initialized (#2051)
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>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Process\Process;
|
||||
use Tests\Fixtures\Tia\Project;
|
||||
|
||||
test('visual snapshot of help command output', function (): void {
|
||||
$output = function (): ?string {
|
||||
@@ -13,3 +14,22 @@ test('visual snapshot of help command output', function (): void {
|
||||
|
||||
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'],
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user