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

Revert change to test adding unnecessary complexity

This commit is contained in:
Samuel Štancl 2025-06-05 17:25:27 +02:00
parent bcf1f641ca
commit bffa494436

View file

@ -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,7 +117,6 @@ 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([
@ -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 () {