mirror of
https://github.com/archtechx/tenancy.git
synced 2026-08-06 06:54:03 +00:00
Add regression test for tenants:seed/db:seed command name collision
This commit is contained in:
parent
d2c96bb913
commit
c74761201f
1 changed files with 12 additions and 0 deletions
|
|
@ -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();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue