mirror of
https://github.com/pestphp/pest.git
synced 2026-03-10 09:47:23 +01:00
first
This commit is contained in:
50
src/Laravel/Commands/PestInstallCommand.php
Normal file
50
src/Laravel/Commands/PestInstallCommand.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Pest\Laravel\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Pest\Exceptions\InvalidConsoleArgument;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class PestInstallCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'pest:install';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Creates Pest resources in your current PHPUnit test suite';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
/* @phpstan-ignore-next-line */
|
||||
$target = base_path('tests/Pest.php');
|
||||
|
||||
if (File::exists($target)) {
|
||||
throw new InvalidConsoleArgument(sprintf('%s already exist', $target));
|
||||
}
|
||||
|
||||
File::copy(implode(DIRECTORY_SEPARATOR, [
|
||||
dirname(__DIR__, 3),
|
||||
'stubs',
|
||||
'Pest.php',
|
||||
]), $target);
|
||||
|
||||
$this->output->success('`tests/Pest.php` created successfully.');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user