This commit is contained in:
Nuno Maduro
2020-05-11 18:38:30 +02:00
commit de2929077b
112 changed files with 6211 additions and 0 deletions

View 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.');
}
}