1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-08-06 08:54:03 +00:00

Add regression test for tenants:seed/db:seed command name collision

This commit is contained in:
Lucas Michot 2026-08-05 12:11:58 +02:00
parent d2c96bb913
commit c74761201f

View file

@ -16,7 +16,9 @@ use Stancl\Tenancy\Jobs\DeleteDatabase;
use Illuminate\Database\DatabaseManager; use Illuminate\Database\DatabaseManager;
use Stancl\Tenancy\Events\TenantCreated; use Stancl\Tenancy\Events\TenantCreated;
use Stancl\Tenancy\Events\TenantDeleted; use Stancl\Tenancy\Events\TenantDeleted;
use Stancl\Tenancy\Commands\Seed;
use Stancl\Tenancy\Tests\Etc\TestSeeder; use Stancl\Tenancy\Tests\Etc\TestSeeder;
use Illuminate\Database\Console\Seeds\SeedCommand;
use Stancl\Tenancy\Events\DeletingTenant; use Stancl\Tenancy\Events\DeletingTenant;
use Stancl\Tenancy\Events\DatabaseMigrated; use Stancl\Tenancy\Events\DatabaseMigrated;
use Stancl\Tenancy\Tests\Etc\ExampleSeeder; 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) { test('database connection is switched to default after running commands', function (bool $initializeTenancy) {
$tenant = Tenant::create(); $tenant = Tenant::create();