mirror of
https://github.com/archtechx/tenancy.git
synced 2026-05-06 19:04:04 +00:00
dump command: test dump content
The TenantDump command should generate a dump with tenant tables only.
This commit is contained in:
parent
fb654e7a6b
commit
3ecaddca12
1 changed files with 24 additions and 0 deletions
|
|
@ -259,6 +259,30 @@ test('dump command generates dump at the path specified in the tenancy migration
|
||||||
expect($schemaPath)->toBeFile();
|
expect($schemaPath)->toBeFile();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('dump command generates a dump that only contains tenant tables', function () {
|
||||||
|
$schemaPath = 'tests/Etc/tenant-schema-test.dump';
|
||||||
|
$centralTables = ['domains', 'tenants'];
|
||||||
|
$tenantTables = ['users'];
|
||||||
|
|
||||||
|
$tenant1 = Tenant::create();
|
||||||
|
|
||||||
|
Artisan::call('tenants:migrate');
|
||||||
|
|
||||||
|
Artisan::call("tenants:dump --tenant='$tenant1->id' --path='$schemaPath'");
|
||||||
|
|
||||||
|
$dumpContent = file_get_contents($schemaPath);
|
||||||
|
|
||||||
|
// The dump includes tenant tables
|
||||||
|
foreach ($tenantTables as $table) {
|
||||||
|
expect($dumpContent)->toContain("CREATE TABLE `$table`");
|
||||||
|
}
|
||||||
|
|
||||||
|
// The dump doesn't include central-only tables
|
||||||
|
foreach ($centralTables as $table) {
|
||||||
|
expect($dumpContent)->not()->toContain("CREATE TABLE `$table`");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
test('rollback command works', function () {
|
test('rollback command works', function () {
|
||||||
$tenant = Tenant::create();
|
$tenant = Tenant::create();
|
||||||
Artisan::call('tenants:migrate');
|
Artisan::call('tenants:migrate');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue