diff --git a/tests/CommandsTest.php b/tests/CommandsTest.php index faa897bf..1318cb8e 100644 --- a/tests/CommandsTest.php +++ b/tests/CommandsTest.php @@ -16,7 +16,9 @@ use Stancl\Tenancy\Jobs\DeleteDatabase; use Illuminate\Database\DatabaseManager; use Stancl\Tenancy\Events\TenantCreated; use Stancl\Tenancy\Events\TenantDeleted; +use Stancl\Tenancy\Commands\Seed; use Stancl\Tenancy\Tests\Etc\TestSeeder; +use Illuminate\Database\Console\Seeds\SeedCommand; use Stancl\Tenancy\Events\DeletingTenant; use Stancl\Tenancy\Events\DatabaseMigrated; use Stancl\Tenancy\Tests\Etc\ExampleSeeder; @@ -288,6 +290,16 @@ test('seed command works', function () { }); }); +test('tenants:seed does not overwrite db:seed', function () { + $commands = Artisan::all(); + + expect($commands)->toHaveKey('db:seed') + ->and($commands)->toHaveKey('tenants:seed') + ->and($commands['db:seed'])->toBeInstanceOf(SeedCommand::class) + ->and($commands['db:seed'])->not()->toBeInstanceOf(Seed::class) + ->and($commands['tenants:seed'])->toBeInstanceOf(Seed::class); +}); + test('database connection is switched to default after running commands', function (bool $initializeTenancy) { $tenant = Tenant::create();