mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 21:34:03 +00:00
wip
This commit is contained in:
parent
77c5ae1f32
commit
f13460d91f
3 changed files with 46 additions and 2 deletions
|
|
@ -763,6 +763,25 @@ function creatingResourceInTenantDatabaseCreatesAndMapInCentralDatabase()
|
|||
expect(ResourceUser::first()->role)->toBe('commenter');
|
||||
}
|
||||
|
||||
test('resources are synced only when sync is enabled', function () {
|
||||
[$tenant1, $tenant2] = createTenantsAndRunMigrations();
|
||||
|
||||
tenancy()->initialize($tenant1);
|
||||
|
||||
TenantUserWithDisabledSync::create([
|
||||
'global_id' => 'absd',
|
||||
'name' => 'John Doe',
|
||||
'email' => 'john@localhost',
|
||||
'password' => 'password',
|
||||
'role' => 'commenter',
|
||||
]);
|
||||
|
||||
tenancy()->end();
|
||||
|
||||
expect(CentralUser::all())->toHaveCount(0);
|
||||
|
||||
})->group('current');
|
||||
|
||||
/**
|
||||
* Create two tenants and run migrations for those tenants.
|
||||
*/
|
||||
|
|
@ -979,3 +998,19 @@ class ResourceUserProvidingMixture extends ResourceUser
|
|||
];
|
||||
}
|
||||
}
|
||||
|
||||
class CentralUserWithDisabledSync extends CentralUser
|
||||
{
|
||||
public function shouldSync(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class TenantUserWithDisabledSync extends CentralUser
|
||||
{
|
||||
public function shouldSync(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue