1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-05-06 15:24:03 +00:00
This commit is contained in:
lukinovec 2026-05-04 08:47:55 +02:00 committed by GitHub
commit 01fc80975f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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');