mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +01:00
feat(helpers): adds helpers file
This commit is contained in:
@ -22,6 +22,7 @@ final class LoadStructure
|
||||
*/
|
||||
private const STRUCTURE = [
|
||||
'Datasets.php',
|
||||
'Helpers.php',
|
||||
'Pest.php',
|
||||
'Datasets',
|
||||
];
|
||||
|
||||
@ -33,18 +33,29 @@ final class PestInstallCommand extends Command
|
||||
public function handle(): void
|
||||
{
|
||||
/* @phpstan-ignore-next-line */
|
||||
$target = base_path('tests/Pest.php');
|
||||
$pest = base_path('tests/Pest.php');
|
||||
/* @phpstan-ignore-next-line */
|
||||
$helpers = base_path('tests/Helpers.php');
|
||||
|
||||
if (File::exists($target)) {
|
||||
throw new InvalidConsoleArgument(sprintf('%s already exist', $target));
|
||||
foreach ([$pest, $helpers] as $file) {
|
||||
if (File::exists($file)) {
|
||||
throw new InvalidConsoleArgument(sprintf('%s already exist', $file));
|
||||
}
|
||||
}
|
||||
|
||||
File::copy(implode(DIRECTORY_SEPARATOR, [
|
||||
dirname(__DIR__, 3),
|
||||
'stubs',
|
||||
'Pest.php',
|
||||
]), $target);
|
||||
]), $pest);
|
||||
|
||||
File::copy(implode(DIRECTORY_SEPARATOR, [
|
||||
dirname(__DIR__, 3),
|
||||
'stubs',
|
||||
'Helpers.php',
|
||||
]), $helpers);
|
||||
|
||||
$this->output->success('`tests/Pest.php` created successfully.');
|
||||
$this->output->success('`tests/Helpers.php` created successfully.');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user