mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 20:14:04 +00:00
Test that migrate:fresh deletes tenant databases
This commit is contained in:
parent
76a3e269c8
commit
6d303d1b2e
1 changed files with 19 additions and 0 deletions
|
|
@ -267,6 +267,25 @@ test('run command works when sub command asks questions and accepts arguments',
|
||||||
expect($user->email)->toBe('email@localhost');
|
expect($user->email)->toBe('email@localhost');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('migrate fresh command deletes tenant databases', function() {
|
||||||
|
/** @var Tenant[] $tenants */
|
||||||
|
$tenants = [
|
||||||
|
Tenant::create(),
|
||||||
|
Tenant::create(),
|
||||||
|
Tenant::create(),
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($tenants as $tenant) {
|
||||||
|
expect($tenant->database()->manager()->databaseExists($tenant->database()->getName()))->toBeTrue();
|
||||||
|
}
|
||||||
|
|
||||||
|
pest()->artisan('migrate:fresh');
|
||||||
|
|
||||||
|
foreach ($tenants as $tenant) {
|
||||||
|
expect($tenant->database()->manager()->databaseExists($tenant->database()->getName()))->toBeFalse();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// todo@tests
|
// todo@tests
|
||||||
function runCommandWorks(): void
|
function runCommandWorks(): void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue