mirror of
https://github.com/pestphp/pest.git
synced 2026-12-04 23:15:06 +01:00
Run the generated Pest suite without a Tests autoload mapping (#2054)
Co-authored-by: haranishi <223786623+haranishi@users.noreply.github.com>
This commit is contained in:
+11
-1
@@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
test('init creates a suite when the tests directory is missing', function (): void {
|
||||
test('init creates a runnable suite when the tests directory is missing', function (): void {
|
||||
$root = makeInitProject();
|
||||
|
||||
try {
|
||||
@@ -17,6 +17,11 @@ test('init creates a suite when the tests directory is missing', function (): vo
|
||||
->and($root.DIRECTORY_SEPARATOR.'tests'.DIRECTORY_SEPARATOR.'Pest.php')->toBeFile()
|
||||
->and($root.DIRECTORY_SEPARATOR.'tests'.DIRECTORY_SEPARATOR.'TestCase.php')->toBeFile()
|
||||
->and($root.DIRECTORY_SEPARATOR.'tests'.DIRECTORY_SEPARATOR.'Unit'.DIRECTORY_SEPARATOR.'ExampleTest.php')->toBeFile();
|
||||
|
||||
$suite = runInitProject($root, '--colors=never');
|
||||
|
||||
expect($suite->getExitCode())->toBe(0)
|
||||
->and($suite->getOutput())->toContain('2 passed (2 assertions)');
|
||||
} finally {
|
||||
removeInitProject($root);
|
||||
}
|
||||
@@ -85,6 +90,11 @@ function makeInitProject(): string
|
||||
true,
|
||||
);
|
||||
|
||||
file_put_contents(
|
||||
$root.DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'autoload.php',
|
||||
"<?php\n\nreturn require_once {$autoload};\n",
|
||||
);
|
||||
|
||||
file_put_contents($root.DIRECTORY_SEPARATOR.'run.php', <<<PHP
|
||||
<?php
|
||||
|
||||
|
||||
Reference in New Issue
Block a user