mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 08:24:04 +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]);
|
||||
|
||||
// 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 () {
|
||||
withTenantDatabases();
|
||||
|
||||
$tenant1 = Tenant::create([
|
||||
'id' => 'acme',
|
||||
]);
|
||||
$tenant1 = Tenant::create();
|
||||
|
||||
tenancy()->initialize($tenant1);
|
||||
|
||||
dispatch(new TestJob(pest()->valuestore));
|
||||
|
||||
$tenant2 = Tenant::create([
|
||||
'id' => 'foobar',
|
||||
]);
|
||||
$tenant2 = Tenant::create();
|
||||
|
||||
tenancy()->initialize($tenant2);
|
||||
|
||||
expect(pest()->valuestore->has('tenant_id'))->toBeFalse();
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue