mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 11:14:03 +00:00
Assert tenants are accessible
This commit is contained in:
parent
86469dd357
commit
4f9b8be2c1
1 changed files with 14 additions and 2 deletions
|
|
@ -72,6 +72,8 @@ test('resource syncing works using a single pivot table for multiple models when
|
|||
|
||||
$centralUser->tenants()->attach('t1');
|
||||
|
||||
expect($centralUser->tenants()->count())->toBe(1); // Assert `tenants` are accessible
|
||||
|
||||
// Assert User resource is synced
|
||||
$tenant1->run(function () use ($centralUser) {
|
||||
$tenantUser = TenantUserUsingPolymorphic::first()->toArray();
|
||||
|
|
@ -96,6 +98,8 @@ test('resource syncing works using a single pivot table for multiple models when
|
|||
|
||||
$centralCompany->tenants()->attach('t2');
|
||||
|
||||
expect($centralCompany->tenants()->count())->toBe(1); // Assert `tenants` are accessible
|
||||
|
||||
// Assert Company resource is synced
|
||||
$tenant2->run(function () use ($centralCompany) {
|
||||
$tenantCompany = TenantCompanyUsingPolymorphic::first()->toArray();
|
||||
|
|
@ -123,7 +127,11 @@ test('resource syncing works using a single pivot table for multiple models when
|
|||
tenancy()->end();
|
||||
|
||||
// Assert User resource is synced
|
||||
$centralUser = CentralUserUsingPolymorphic::first()->toArray();
|
||||
$centralUser = CentralUserUsingPolymorphic::first();
|
||||
|
||||
expect($centralUser->tenants()->count())->toBe(1); // Assert `tenants` are accessible
|
||||
|
||||
$centralUser = $centralUser->toArray();
|
||||
$tenantUser = $tenantUser->toArray();
|
||||
unset($centralUser['id'], $tenantUser['id']);
|
||||
|
||||
|
|
@ -146,7 +154,11 @@ test('resource syncing works using a single pivot table for multiple models when
|
|||
tenancy()->end();
|
||||
|
||||
// Assert Company resource is synced
|
||||
$centralCompany = CentralCompanyUsingPolymorphic::first()->toArray();
|
||||
$centralCompany = CentralCompanyUsingPolymorphic::first();
|
||||
|
||||
expect($centralCompany->tenants()->count())->toBe(1); // Assert `tenants` are accessible
|
||||
|
||||
$centralCompany = $centralCompany->toArray();
|
||||
$tenantCompany = $tenantCompany->toArray();
|
||||
unset($centralCompany['id'], $tenantCompany['id']);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue