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

Clarify test

This commit is contained in:
lukinovec 2025-06-04 15:58:59 +02:00
parent 03bf20732f
commit 17a1fbc123

View file

@ -111,10 +111,12 @@ afterEach(function () {
UpdateOrCreateSyncedResource::$scopeGetModelQuery = null; UpdateOrCreateSyncedResource::$scopeGetModelQuery = null;
}); });
test('creating the same user across multiple tenants does not create multiple central resources', function () { test('resources created with the same global id in different tenant dbs will be synced with a single central resource', function () {
$tenants = [Tenant::create(), Tenant::create(), Tenant::create()]; $tenants = [Tenant::create(), Tenant::create(), Tenant::create()];
migrateUsersTableForTenants(); migrateUsersTableForTenants();
// No unique constraint exception will be thrown.
// The syncing logic ensures that there's a single central resource
tenancy()->runForMultiple($tenants, function () { tenancy()->runForMultiple($tenants, function () {
// Create a user with the same global_id in each tenant DB // Create a user with the same global_id in each tenant DB
TenantUser::create([ TenantUser::create([