mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-13 15:07:49 +00:00
This commit is contained in:
parent
4f251bf37e
commit
42b515e322
21 changed files with 2212 additions and 32 deletions
40
tests/Feature/Console/ExampleRecipesSeederCommandTest.php
Normal file
40
tests/Feature/Console/ExampleRecipesSeederCommandTest.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?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 () {
|
||||
$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 () {
|
||||
$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 () {
|
||||
$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);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue