mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 04:34:03 +00:00
Revert change to test adding unnecessary complexity
This commit is contained in:
parent
bcf1f641ca
commit
bffa494436
1 changed files with 5 additions and 7 deletions
|
|
@ -47,7 +47,6 @@ use Illuminate\Database\Eloquent\Scope;
|
||||||
use Illuminate\Database\Eloquent\Attributes\ScopedBy;
|
use Illuminate\Database\Eloquent\Attributes\ScopedBy;
|
||||||
use Illuminate\Database\QueryException;
|
use Illuminate\Database\QueryException;
|
||||||
use function Stancl\Tenancy\Tests\pest;
|
use function Stancl\Tenancy\Tests\pest;
|
||||||
use Illuminate\Database\UniqueConstraintViolationException;
|
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
config(['tenancy.bootstrappers' => [
|
config(['tenancy.bootstrappers' => [
|
||||||
|
|
@ -118,8 +117,7 @@ test('resources created with the same global id in different tenant dbs will be
|
||||||
|
|
||||||
// Only a single central user is created since the same global_id is used for each tenant user
|
// Only a single central user is created since the same global_id is used for each tenant user
|
||||||
// Therefore all of these tenant users are synced to a single global user
|
// Therefore all of these tenant users are synced to a single global user
|
||||||
expect(function () use ($tenants) {
|
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([
|
||||||
'global_id' => 'acme',
|
'global_id' => 'acme',
|
||||||
|
|
@ -129,10 +127,10 @@ test('resources created with the same global id in different tenant dbs will be
|
||||||
'role' => 'commenter',
|
'role' => 'commenter',
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
})->not()
|
|
||||||
// The central resource is only created once,
|
// Only a single central user is created
|
||||||
// so the unique constraint violation exception isn't thrown
|
expect(CentralUser::all())->toHaveCount(1);
|
||||||
->toThrow(UniqueConstraintViolationException::class);
|
expect(CentralUser::first()->global_id)->toBe('acme');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('SyncedResourceSaved event gets triggered when resource gets created or when its synced attributes get updated', function () {
|
test('SyncedResourceSaved event gets triggered when resource gets created or when its synced attributes get updated', function () {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue