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

minor fixes

This commit is contained in:
Samuel Štancl 2025-06-02 20:58:17 +02:00
parent 820faf1e25
commit 0a8e5a141f

View file

@ -1200,6 +1200,7 @@ test('resource creation works correctly when central resource provides defaults
test('resource syncing works correctly when using a global scope on a tenant model', function (bool $scopeGetModelQuery) { test('resource syncing works correctly when using a global scope on a tenant model', function (bool $scopeGetModelQuery) {
if ($scopeGetModelQuery) { if ($scopeGetModelQuery) {
// Add a scope that bypasses the global scope
UpdateOrCreateSyncedResource::$scopeGetModelQuery = function (Builder $query) { UpdateOrCreateSyncedResource::$scopeGetModelQuery = function (Builder $query) {
if ($query->getModel()->hasGlobalScope(TestingScope::class)) { if ($query->getModel()->hasGlobalScope(TestingScope::class)) {
$query->withoutGlobalScope(TestingScope::class); $query->withoutGlobalScope(TestingScope::class);
@ -1207,10 +1208,12 @@ test('resource syncing works correctly when using a global scope on a tenant mod
}; };
} }
$centralUser = CentralUser::firstOrCreate( $centralUser = CentralUser::create([
['email' => 'user@test.cz'], 'email' => 'user@test.cz',
['name' => 'User', 'password' => bcrypt('****'), 'role' => 'admin'] 'name' => 'User',
); 'password' => bcrypt('****'),
'role' => 'admin',
]);
[$tenant1, $tenant2] = createTenantsAndRunMigrations(); [$tenant1, $tenant2] = createTenantsAndRunMigrations();