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

revert to unset change

This commit is contained in:
Abrar Ahmad 2022-11-30 15:21:50 +05:00
parent 1a67300615
commit 144df028a0

View file

@ -284,10 +284,14 @@ test('sync resource creation works when central model provides mixture and tenan
tenancy()->end();
$centralUser = CentralUserProvidingMixture::whereGlobalId('acmey')->first()->only(['name', 'email', 'password', 'role']);
$centralUser = CentralUserProvidingMixture::whereGlobalId('acmey')->first();
expect($resourceUser->getSyncedCreationAttributes())->toBeNull();
$resourceUser = $resourceUser->only(['name', 'email', 'password', 'role']);
$centralUser = $centralUser->toArray();
$resourceUser = $resourceUser->toArray();
unset($centralUser['id']);
unset($resourceUser['id']);
// Assert central user created as 1:1 copy of resource model except "id"
expect($centralUser)->toBe($resourceUser);
});
@ -315,8 +319,12 @@ test('sync resource creation works when central model provides nothing and tenan
expect($centralUser->getSyncedCreationAttributes())->toBeNull();
$tenant1->run(function () use ($centralUser) {
$resourceUser = TenantUserProvidingMixture::first()->only(['name', 'email', 'password', 'role']);
$centralUser = $centralUser->only(['name', 'email', 'password', 'role']);
$resourceUser = TenantUserProvidingMixture::first();
expect($resourceUser)->not()->toBeNull();
$resourceUser = $resourceUser->toArray();
$centralUser = $centralUser->withoutRelations()->toArray();
unset($resourceUser['id']);
unset($centralUser['id']);
expect($resourceUser)->toBe($centralUser);
});