mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-13 23:18:10 +00:00
40 lines
1.2 KiB
PHP
40 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Database\Seeders\ExampleRecipesSeeder;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
test('example recipes seeder command calls seeder with correct user id', function (): void {
|
|
$seeder = Mockery::mock(ExampleRecipesSeeder::class);
|
|
$seeder->shouldReceive('run')
|
|
->once()
|
|
->with('123');
|
|
|
|
$this->app->instance(ExampleRecipesSeeder::class, $seeder);
|
|
|
|
$this->artisan('recipes:seed', ['user_id' => '123'])
|
|
->assertExitCode(0);
|
|
});
|
|
|
|
test('example recipes seeder command has correct signature', function (): void {
|
|
$command = $this->app->make(App\Console\Commands\ExampleRecipesSeederCommand::class);
|
|
|
|
expect($command->getName())->toBe('recipes:seed');
|
|
expect($command->getDescription())->toBe('Seed example recipes');
|
|
});
|
|
|
|
test('example recipes seeder command prompts for missing input', function (): void {
|
|
$seeder = Mockery::mock(ExampleRecipesSeeder::class);
|
|
$seeder->shouldReceive('run')
|
|
->once()
|
|
->with('456');
|
|
|
|
$this->app->instance(ExampleRecipesSeeder::class, $seeder);
|
|
|
|
$this->artisan('recipes:seed')
|
|
->expectsQuestion('What is the user_id?', '456')
|
|
->assertExitCode(0);
|
|
});
|