From 4d4639450e9a70c7599896c8dcaae061b09c7ffd Mon Sep 17 00:00:00 2001 From: lukinovec Date: Fri, 25 Aug 2023 17:01:47 +0200 Subject: [PATCH] Use randomly generated tenant key instead of 'acme' in failing test (#10) --- tests/QueueTest.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/tests/QueueTest.php b/tests/QueueTest.php index 1c55eb5c..2ff72bb7 100644 --- a/tests/QueueTest.php +++ b/tests/QueueTest.php @@ -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