mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 17:24:03 +00:00
Use randomly generated tenant key instead of 'acme' in failing test (#10)
This commit is contained in:
parent
2d500f9780
commit
4d4639450e
1 changed files with 3 additions and 8 deletions
|
|
@ -159,28 +159,23 @@ test('tenancy is initialized when retrying jobs', function (bool $shouldEndTenan
|
||||||
});
|
});
|
||||||
})->with([true, false]);
|
})->with([true, false]);
|
||||||
|
|
||||||
// todo0 this test appears to be affected by race conditions/similar
|
|
||||||
test('the tenant used by the job doesnt change when the current tenant changes', function () {
|
test('the tenant used by the job doesnt change when the current tenant changes', function () {
|
||||||
withTenantDatabases();
|
withTenantDatabases();
|
||||||
|
|
||||||
$tenant1 = Tenant::create([
|
$tenant1 = Tenant::create();
|
||||||
'id' => 'acme',
|
|
||||||
]);
|
|
||||||
|
|
||||||
tenancy()->initialize($tenant1);
|
tenancy()->initialize($tenant1);
|
||||||
|
|
||||||
dispatch(new TestJob(pest()->valuestore));
|
dispatch(new TestJob(pest()->valuestore));
|
||||||
|
|
||||||
$tenant2 = Tenant::create([
|
$tenant2 = Tenant::create();
|
||||||
'id' => 'foobar',
|
|
||||||
]);
|
|
||||||
|
|
||||||
tenancy()->initialize($tenant2);
|
tenancy()->initialize($tenant2);
|
||||||
|
|
||||||
expect(pest()->valuestore->has('tenant_id'))->toBeFalse();
|
expect(pest()->valuestore->has('tenant_id'))->toBeFalse();
|
||||||
pest()->artisan('queue:work --once');
|
pest()->artisan('queue:work --once');
|
||||||
|
|
||||||
expect(pest()->valuestore->get('tenant_id'))->toBe('The current tenant id is: acme');
|
expect(pest()->valuestore->get('tenant_id'))->toBe('The current tenant id is: ' . $tenant1->getTenantKey());
|
||||||
});
|
});
|
||||||
|
|
||||||
function createValueStore(): void
|
function createValueStore(): void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue