From 3e896f560332adc0eae2e6dbff55920fbadd9e95 Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Mon, 25 Sep 2023 17:23:54 +0200 Subject: [PATCH 01/35] Add support to queued closures --- config/multitenancy.php | 2 + .../TenantAwareJobs/QueuedClosuresTest.php | 44 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 tests/Feature/TenantAwareJobs/QueuedClosuresTest.php diff --git a/config/multitenancy.php b/config/multitenancy.php index 334c724..4fb1f10 100644 --- a/config/multitenancy.php +++ b/config/multitenancy.php @@ -4,6 +4,7 @@ use Illuminate\Events\CallQueuedListener; use Illuminate\Mail\SendQueuedMailable; use Illuminate\Notifications\SendQueuedNotifications; +use Illuminate\Queue\CallQueuedClosure; use Spatie\Multitenancy\Actions\ForgetCurrentTenantAction; use Spatie\Multitenancy\Actions\MakeQueueTenantAwareAction; use Spatie\Multitenancy\Actions\MakeTenantCurrentAction; @@ -95,6 +96,7 @@ 'queueable_to_job' => [ SendQueuedMailable::class => 'mailable', SendQueuedNotifications::class => 'notification', + CallQueuedClosure::class => 'closure', CallQueuedListener::class => 'class', BroadcastEvent::class => 'event', ], diff --git a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php new file mode 100644 index 0000000..c7f082f --- /dev/null +++ b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php @@ -0,0 +1,44 @@ +set('multitenancy.queues_are_tenant_aware_by_default', true); + + config()->set('queue.default', 'database'); + config()->set('multitenancy.tenant_aware_jobs', [TestJob::class]); + + $this->tenant1 = Tenant::factory()->create(); + $this->tenant2 = Tenant::factory()->create(); + + Event::assertNotDispatched(JobFailed::class); +}); + +it('succeeds with closure jobs', function () { + $this->tenant1->execute(function (Tenant $tenant1) { + dispatch(function () use ($tenant1) { + $tenant = Tenant::current(); + + expect($tenant)->not->toBeNull() + ->and($tenant->name)->toBe($tenant1->name); + }); + }); + + $this->tenant2->execute(function (Tenant $tenant2) { + dispatch(function () use ($tenant2) { + $tenant = Tenant::current(); + + expect($tenant)->not->toBeNull() + ->and($tenant->name)->toBe($tenant2->name); + }); + }); + + $this->artisan('queue:work --once'); +}); From 0af13ed9a374c59964851b1be81172c0640cc070 Mon Sep 17 00:00:00 2001 From: masterix21 Date: Mon, 25 Sep 2023 15:24:22 +0000 Subject: [PATCH 02/35] Fix styling --- tests/Feature/TenantAwareJobs/QueuedClosuresTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php index c7f082f..027523b 100644 --- a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php +++ b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php @@ -1,11 +1,9 @@ Date: Mon, 25 Sep 2023 17:26:55 +0200 Subject: [PATCH 03/35] Update base-installation.md --- docs/installation/base-installation.md | 28 ++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/docs/installation/base-installation.md b/docs/installation/base-installation.md index 58308d2..7547f58 100644 --- a/docs/installation/base-installation.md +++ b/docs/installation/base-installation.md @@ -26,6 +26,7 @@ use Illuminate\Broadcasting\BroadcastEvent; use Illuminate\Events\CallQueuedListener; use Illuminate\Mail\SendQueuedMailable; use Illuminate\Notifications\SendQueuedNotifications; +use Illuminate\Queue\CallQueuedClosure; use Spatie\Multitenancy\Actions\ForgetCurrentTenantAction; use Spatie\Multitenancy\Actions\MakeQueueTenantAwareAction; use Spatie\Multitenancy\Actions\MakeTenantCurrentAction; @@ -55,7 +56,9 @@ return [ * A valid task is any class that implements Spatie\Multitenancy\Tasks\SwitchTenantTask */ 'switch_tenant_tasks' => [ - // add tasks here + // \Spatie\Multitenancy\Tasks\PrefixCacheTask::class, + // \Spatie\Multitenancy\Tasks\SwitchTenantDatabaseTask::class, + // \Spatie\Multitenancy\Tasks\SwitchRouteCacheTask::class, ], /* @@ -89,8 +92,14 @@ return [ */ 'current_tenant_container_key' => 'currentTenant', + /** + * Set it to `true` if you like to cache the tenant(s) routes + * in a shared file using the `SwitchRouteCacheTask`. + */ + 'shared_routes_cache' => false, + /* - * You can customize some of the behavior of this package by using our own custom action. + * You can customize some of the behavior of this package by using your own custom action. * Your custom action should always extend the default one. */ 'actions' => [ @@ -109,9 +118,24 @@ return [ 'queueable_to_job' => [ SendQueuedMailable::class => 'mailable', SendQueuedNotifications::class => 'notification', + CallQueuedClosure::class => 'closure', CallQueuedListener::class => 'class', BroadcastEvent::class => 'event', ], + + /* + * Jobs tenant aware even if these don't implement the TenantAware interface. + */ + 'tenant_aware_jobs' => [ + // ... + ], + + /* + * Jobs not tenant aware even if these don't implement the NotTenantAware interface. + */ + 'not_tenant_aware_jobs' => [ + // ... + ], ]; ``` From a792241f94a66c380d08e5d6b27a6dba35f8d199 Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Mon, 25 Sep 2023 18:35:19 +0200 Subject: [PATCH 04/35] wip --- .../Commands/TenantAwareCommandTest.php | 5 ----- .../Commands/TenantsArtisanCommandTest.php | 18 ++++++------------ 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/tests/Feature/Commands/TenantAwareCommandTest.php b/tests/Feature/Commands/TenantAwareCommandTest.php index 50e0a3b..7e09d04 100644 --- a/tests/Feature/Commands/TenantAwareCommandTest.php +++ b/tests/Feature/Commands/TenantAwareCommandTest.php @@ -4,16 +4,11 @@ use Spatie\Multitenancy\Tasks\SwitchTenantDatabaseTask; beforeEach(function () { - config(['database.default' => 'tenant']); config()->set('multitenancy.switch_tenant_tasks', [SwitchTenantDatabaseTask::class]); $this->tenant = Tenant::factory()->create(['database' => 'laravel_mt_tenant_1']); - $this->tenant->makeCurrent(); $this->anotherTenant = Tenant::factory()->create(['database' => 'laravel_mt_tenant_2']); - $this->anotherTenant->makeCurrent(); - - Tenant::forgetCurrent(); }); it('fails with a non-existing tenant') diff --git a/tests/Feature/Commands/TenantsArtisanCommandTest.php b/tests/Feature/Commands/TenantsArtisanCommandTest.php index 10b34c1..0f6fe93 100644 --- a/tests/Feature/Commands/TenantsArtisanCommandTest.php +++ b/tests/Feature/Commands/TenantsArtisanCommandTest.php @@ -5,24 +5,18 @@ use Spatie\Multitenancy\Tasks\SwitchTenantDatabaseTask; beforeEach(function () { - config(['database.default' => 'tenant']); - config()->set('multitenancy.switch_tenant_tasks', [SwitchTenantDatabaseTask::class]); $this->tenant = Tenant::factory()->create(['database' => 'laravel_mt_tenant_1']); - $this->tenant->makeCurrent(); - Schema::connection('tenant')->dropIfExists('migrations'); + $this->tenant->execute(fn () => Schema::connection('tenant')->dropIfExists('migrations')); $this->anotherTenant = Tenant::factory()->create(['database' => 'laravel_mt_tenant_2']); - $this->anotherTenant->makeCurrent(); - Schema::connection('tenant')->dropIfExists('migrations'); - - Tenant::forgetCurrent(); + $this->anotherTenant->execute(fn () => Schema::connection('tenant')->dropIfExists('migrations')); }); it('can migrate all tenant databases', function () { $this - ->artisan('tenants:artisan migrate') + ->artisan('tenants:artisan "migrate --database=tenant"') ->assertExitCode(0); assertTenantDatabaseHasTable($this->tenant, 'migrations'); @@ -30,7 +24,7 @@ }); it('can migrate a specific tenant', function () { - $this->artisan('tenants:artisan migrate --tenant="' . $this->anotherTenant->id . '"')->assertExitCode(0); + $this->artisan('tenants:artisan "migrate --database=tenant" --tenant="' . $this->anotherTenant->id . '"')->assertExitCode(0); assertTenantDatabaseDoesNotHaveTable($this->tenant, 'migrations'); assertTenantDatabaseHasTable($this->anotherTenant, 'migrations'); @@ -40,7 +34,7 @@ config(['multitenancy.tenant_artisan_search_fields' => 'domain']); $this->artisan('tenants:artisan', [ - 'artisanCommand' => 'migrate', + 'artisanCommand' => 'migrate --database=tenant', '--tenant' => $this->anotherTenant->id, ]) ->expectsOutput("No tenant(s) found.") @@ -51,7 +45,7 @@ config(['multitenancy.tenant_artisan_search_fields' => 'domain']); $this->artisan('tenants:artisan', [ - 'artisanCommand' => 'migrate', + 'artisanCommand' => 'migrate --database=tenant', '--tenant' => $this->anotherTenant->domain, ])->assertExitCode(0); From a3a69c75958b6797c3dfbeb7ccba3f0b2ddbde26 Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Mon, 25 Sep 2023 18:49:25 +0200 Subject: [PATCH 05/35] Update QueuedClosuresTest.php --- .../TenantAwareJobs/QueuedClosuresTest.php | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php index 027523b..96c43b0 100644 --- a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php +++ b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php @@ -8,33 +8,37 @@ beforeEach(function () { Event::fake(JobFailed::class); - config()->set('multitenancy.queues_are_tenant_aware_by_default', true); - config()->set('queue.default', 'database'); config()->set('multitenancy.tenant_aware_jobs', [TestJob::class]); - $this->tenant1 = Tenant::factory()->create(); - $this->tenant2 = Tenant::factory()->create(); + $this->tenant = Tenant::factory()->create(); Event::assertNotDispatched(JobFailed::class); }); -it('succeeds with closure jobs', function () { - $this->tenant1->execute(function (Tenant $tenant1) { - dispatch(function () use ($tenant1) { +it('succeeds with closure jobs when queues are tenant aware by default', function () { + config()->set('multitenancy.queues_are_tenant_aware_by_default', true); + + $this->tenant->execute(function (Tenant $currentTenant) { + dispatch(function () use ($currentTenant) { $tenant = Tenant::current(); expect($tenant)->not->toBeNull() - ->and($tenant->name)->toBe($tenant1->name); + ->and($tenant?->name)->toBe($currentTenant->name); }); }); - $this->tenant2->execute(function (Tenant $tenant2) { - dispatch(function () use ($tenant2) { + $this->artisan('queue:work --once'); +}); + +it('fails with closure jobs when queues are not tenant aware by default', function () { + config()->set('multitenancy.queues_are_tenant_aware_by_default', false); + + $this->tenant->execute(function (Tenant $currentTenant) { + dispatch(function () { $tenant = Tenant::current(); - expect($tenant)->not->toBeNull() - ->and($tenant->name)->toBe($tenant2->name); + expect($tenant)->toBeNull(); }); }); From fa736ae9198419e89f5744f0ccd3edada202f71b Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Tue, 26 Sep 2023 10:28:48 +0200 Subject: [PATCH 06/35] wip --- .../basic-usage/making-queues-tenant-aware.md | 13 ++++ .../TenantAwareJobs/QueuedClosuresTest.php | 64 ++++++++++++++----- 2 files changed, 62 insertions(+), 15 deletions(-) diff --git a/docs/basic-usage/making-queues-tenant-aware.md b/docs/basic-usage/making-queues-tenant-aware.md index dca271c..84a80db 100644 --- a/docs/basic-usage/making-queues-tenant-aware.md +++ b/docs/basic-usage/making-queues-tenant-aware.md @@ -55,6 +55,19 @@ or, using the config `multitenancy.php`: ], ``` +## Queueing Closures + +Dispatch a closure is slightly different from a job class because here, you can't implement `TenantAware` or `NotTenantAware` interfaces. The package can handle the queue closures by enabling the `queues_are_tenant_aware_by_default`, but if you enjoy keeping to `false` parameter, you can dispatch a tenant-aware job closure like so: + +```php +$tenant = Tenant::current(); + +dispatch(function () use ($tenant) { + $tenant->execute(function () { + // Your job + }); +}); +``` ## When the tenant cannot be retrieved diff --git a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php index 96c43b0..b74661a 100644 --- a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php +++ b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php @@ -1,46 +1,80 @@ set('queue.default', 'database'); - config()->set('multitenancy.tenant_aware_jobs', [TestJob::class]); $this->tenant = Tenant::factory()->create(); - - Event::assertNotDispatched(JobFailed::class); }); it('succeeds with closure jobs when queues are tenant aware by default', function () { + $valuestore = Valuestore::make(tempFile('tenantAware.json'))->flush(); + config()->set('multitenancy.queues_are_tenant_aware_by_default', true); - $this->tenant->execute(function (Tenant $currentTenant) { - dispatch(function () use ($currentTenant) { + $this->tenant->execute(function () use ($valuestore) { + dispatch(function () use ($valuestore) { $tenant = Tenant::current(); - expect($tenant)->not->toBeNull() - ->and($tenant?->name)->toBe($currentTenant->name); + $valuestore->put('tenantId', $tenant?->getKey()); + $valuestore->put('tenantName', $tenant?->name); }); }); + expect($valuestore->get('tenantId'))->toBeNull() + ->and($valuestore->get('tenantName'))->toBeNull(); + $this->artisan('queue:work --once'); + + expect($valuestore->get('tenantId'))->toBe($this->tenant->getKey()) + ->and($valuestore->get('tenantName'))->toBe($this->tenant->name); }); it('fails with closure jobs when queues are not tenant aware by default', function () { + $valuestore = Valuestore::make(tempFile('tenantAware.json'))->flush(); + + config()->set('multitenancy.queues_are_tenant_aware_by_default', false); + + $this->tenant->execute(function () use ($valuestore) { + dispatch(function () use ($valuestore) { + $tenant = Tenant::current(); + + $valuestore->put('tenantId', $tenant?->getKey()); + $valuestore->put('tenantName', $tenant?->name); + }); + }); + + $this->artisan('queue:work --once'); + + expect($valuestore->get('tenantId'))->toBeNull() + ->and($valuestore->get('tenantName'))->toBeNull(); +}); + +it('succeeds with closure jobs when a tenant is specified', function () { + $valuestore = Valuestore::make(tempFile('tenantAware.json'))->flush(); + config()->set('multitenancy.queues_are_tenant_aware_by_default', false); - $this->tenant->execute(function (Tenant $currentTenant) { - dispatch(function () { + $this->tenant->execute(function (Tenant $currentTenant) use ($valuestore) { + dispatch(function () use ($valuestore, $currentTenant) { + $currentTenant->makeCurrent(); + $tenant = Tenant::current(); - expect($tenant)->toBeNull(); + $valuestore->put('tenantId', $tenant?->getKey()); + $valuestore->put('tenantName', $tenant?->name); + + $currentTenant->forget(); }); }); + expect($valuestore->get('tenantId'))->toBeNull() + ->and($valuestore->get('tenantName'))->toBeNull(); + $this->artisan('queue:work --once'); + + expect($valuestore->get('tenantId'))->toBe($this->tenant->getKey()) + ->and($valuestore->get('tenantName'))->toBe($this->tenant->name); }); From b5daa77d3ad6c5f0745d574edf078a6878613391 Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Tue, 26 Sep 2023 11:09:38 +0200 Subject: [PATCH 07/35] Update QueuedClosuresTest.php --- .../TenantAwareJobs/QueuedClosuresTest.php | 51 ++++++++++--------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php index b74661a..df0202d 100644 --- a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php +++ b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php @@ -7,15 +7,16 @@ config()->set('queue.default', 'database'); $this->tenant = Tenant::factory()->create(); + $this->valuestore = Valuestore::make(tempFile('tenantAware.json'))->flush(); }); -it('succeeds with closure jobs when queues are tenant aware by default', function () { - $valuestore = Valuestore::make(tempFile('tenantAware.json'))->flush(); - +it('succeeds with closure job when queues are tenant aware by default', function () { config()->set('multitenancy.queues_are_tenant_aware_by_default', true); - $this->tenant->execute(function () use ($valuestore) { - dispatch(function () use ($valuestore) { + $this->tenant->execute(function () { + dispatch(function () { + $valuestore = Valuestore::make(tempFile('tenantAware.json')); + $tenant = Tenant::current(); $valuestore->put('tenantId', $tenant?->getKey()); @@ -23,22 +24,22 @@ }); }); - expect($valuestore->get('tenantId'))->toBeNull() - ->and($valuestore->get('tenantName'))->toBeNull(); + expect($this->valuestore->get('tenantId'))->toBeNull() + ->and($this->valuestore->get('tenantName'))->toBeNull(); $this->artisan('queue:work --once'); - expect($valuestore->get('tenantId'))->toBe($this->tenant->getKey()) - ->and($valuestore->get('tenantName'))->toBe($this->tenant->name); + expect($this->valuestore->get('tenantId'))->toBe($this->tenant->getKey()) + ->and($this->valuestore->get('tenantName'))->toBe($this->tenant->name); }); -it('fails with closure jobs when queues are not tenant aware by default', function () { - $valuestore = Valuestore::make(tempFile('tenantAware.json'))->flush(); - +it('fails with closure job when queues are not tenant aware by default', function () { config()->set('multitenancy.queues_are_tenant_aware_by_default', false); - $this->tenant->execute(function () use ($valuestore) { - dispatch(function () use ($valuestore) { + $this->tenant->execute(function () { + dispatch(function () { + $valuestore = Valuestore::make(tempFile('tenantAware.json')); + $tenant = Tenant::current(); $valuestore->put('tenantId', $tenant?->getKey()); @@ -48,17 +49,17 @@ $this->artisan('queue:work --once'); - expect($valuestore->get('tenantId'))->toBeNull() - ->and($valuestore->get('tenantName'))->toBeNull(); + expect($this->valuestore->get('tenantId'))->toBeNull() + ->and($this->valuestore->get('tenantName'))->toBeNull(); }); -it('succeeds with closure jobs when a tenant is specified', function () { - $valuestore = Valuestore::make(tempFile('tenantAware.json'))->flush(); - +it('succeeds with closure job when a tenant is specified', function () { config()->set('multitenancy.queues_are_tenant_aware_by_default', false); - $this->tenant->execute(function (Tenant $currentTenant) use ($valuestore) { - dispatch(function () use ($valuestore, $currentTenant) { + $this->tenant->execute(function (Tenant $currentTenant) { + dispatch(function () use ($currentTenant) { + $valuestore = Valuestore::make(tempFile('tenantAware.json')); + $currentTenant->makeCurrent(); $tenant = Tenant::current(); @@ -70,11 +71,11 @@ }); }); - expect($valuestore->get('tenantId'))->toBeNull() - ->and($valuestore->get('tenantName'))->toBeNull(); + expect($this->valuestore->get('tenantId'))->toBeNull() + ->and($this->valuestore->get('tenantName'))->toBeNull(); $this->artisan('queue:work --once'); - expect($valuestore->get('tenantId'))->toBe($this->tenant->getKey()) - ->and($valuestore->get('tenantName'))->toBe($this->tenant->name); + expect($this->valuestore->get('tenantId'))->toBe($this->tenant->getKey()) + ->and($this->valuestore->get('tenantName'))->toBe($this->tenant->name); }); From e49a09cf081df258772ee31d8bcd7925e535c1ab Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Tue, 26 Sep 2023 12:18:03 +0200 Subject: [PATCH 08/35] Update QueuedClosuresTest.php --- .../TenantAwareJobs/QueuedClosuresTest.php | 70 +++++++++---------- 1 file changed, 34 insertions(+), 36 deletions(-) diff --git a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php index df0202d..26e9a72 100644 --- a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php +++ b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php @@ -5,77 +5,75 @@ beforeEach(function () { config()->set('queue.default', 'database'); + config()->set('multitenancy.queues_are_tenant_aware_by_default', false); $this->tenant = Tenant::factory()->create(); - $this->valuestore = Valuestore::make(tempFile('tenantAware.json'))->flush(); }); it('succeeds with closure job when queues are tenant aware by default', function () { + $valuestore = Valuestore::make(tempFile('tenantAware.json'))->flush(); + config()->set('multitenancy.queues_are_tenant_aware_by_default', true); - $this->tenant->execute(function () { - dispatch(function () { - $valuestore = Valuestore::make(tempFile('tenantAware.json')); + $this->tenant->makeCurrent(); - $tenant = Tenant::current(); + dispatch(function () use(&$valuestore) { + $tenant = Tenant::current(); - $valuestore->put('tenantId', $tenant?->getKey()); - $valuestore->put('tenantName', $tenant?->name); - }); + $valuestore->put('tenantId', $tenant?->getKey()); + $valuestore->put('tenantName', $tenant?->name); }); - expect($this->valuestore->get('tenantId'))->toBeNull() - ->and($this->valuestore->get('tenantName'))->toBeNull(); + expect($valuestore->get('tenantId'))->toBeNull() + ->and($valuestore->get('tenantName'))->toBeNull(); $this->artisan('queue:work --once'); - expect($this->valuestore->get('tenantId'))->toBe($this->tenant->getKey()) - ->and($this->valuestore->get('tenantName'))->toBe($this->tenant->name); + expect($valuestore->get('tenantId'))->toBe($this->tenant->getKey()) + ->and($valuestore->get('tenantName'))->toBe($this->tenant->name); }); it('fails with closure job when queues are not tenant aware by default', function () { - config()->set('multitenancy.queues_are_tenant_aware_by_default', false); + $valuestore = Valuestore::make(tempFile('tenantAware.json'))->flush(); - $this->tenant->execute(function () { - dispatch(function () { - $valuestore = Valuestore::make(tempFile('tenantAware.json')); + $this->tenant->makeCurrent(); - $tenant = Tenant::current(); + dispatch(function () use (&$valuestore) { + $tenant = Tenant::current(); - $valuestore->put('tenantId', $tenant?->getKey()); - $valuestore->put('tenantName', $tenant?->name); - }); + $valuestore->put('tenantId', $tenant?->getKey()); + $valuestore->put('tenantName', $tenant?->name); }); $this->artisan('queue:work --once'); - expect($this->valuestore->get('tenantId'))->toBeNull() - ->and($this->valuestore->get('tenantName'))->toBeNull(); + expect($valuestore->get('tenantId'))->toBeNull() + ->and($valuestore->get('tenantName'))->toBeNull(); }); it('succeeds with closure job when a tenant is specified', function () { - config()->set('multitenancy.queues_are_tenant_aware_by_default', false); + $valuestore = Valuestore::make(tempFile('tenantAware.json'))->flush(); + + $currentTenant = $this->tenant; - $this->tenant->execute(function (Tenant $currentTenant) { - dispatch(function () use ($currentTenant) { - $valuestore = Valuestore::make(tempFile('tenantAware.json')); + dispatch(function () use (&$valuestore, $currentTenant) { + $valuestore = Valuestore::make(tempFile('tenantAware.json')); - $currentTenant->makeCurrent(); + $currentTenant->makeCurrent(); - $tenant = Tenant::current(); + $tenant = Tenant::current(); - $valuestore->put('tenantId', $tenant?->getKey()); - $valuestore->put('tenantName', $tenant?->name); + $valuestore->put('tenantId', $tenant?->getKey()); + $valuestore->put('tenantName', $tenant?->name); - $currentTenant->forget(); - }); + $currentTenant->forget(); }); - expect($this->valuestore->get('tenantId'))->toBeNull() - ->and($this->valuestore->get('tenantName'))->toBeNull(); + expect($valuestore->get('tenantId'))->toBeNull() + ->and($valuestore->get('tenantName'))->toBeNull(); $this->artisan('queue:work --once'); - expect($this->valuestore->get('tenantId'))->toBe($this->tenant->getKey()) - ->and($this->valuestore->get('tenantName'))->toBe($this->tenant->name); + expect($valuestore->get('tenantId'))->toBe($this->tenant->getKey()) + ->and($valuestore->get('tenantName'))->toBe($this->tenant->name); }); From 8579fedbe8bebb6d2798738d93a590c3f429c943 Mon Sep 17 00:00:00 2001 From: masterix21 Date: Tue, 26 Sep 2023 10:18:24 +0000 Subject: [PATCH 09/35] Fix styling --- tests/Feature/TenantAwareJobs/QueuedClosuresTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php index 26e9a72..c74e607 100644 --- a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php +++ b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php @@ -17,7 +17,7 @@ $this->tenant->makeCurrent(); - dispatch(function () use(&$valuestore) { + dispatch(function () use (&$valuestore) { $tenant = Tenant::current(); $valuestore->put('tenantId', $tenant?->getKey()); From 1e461af70565c6afb43953e54dfd989d46a4441c Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Tue, 26 Sep 2023 12:23:38 +0200 Subject: [PATCH 10/35] Update QueuedClosuresTest.php --- .../TenantAwareJobs/QueuedClosuresTest.php | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php index 26e9a72..cb91770 100644 --- a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php +++ b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php @@ -17,20 +17,21 @@ $this->tenant->makeCurrent(); - dispatch(function () use(&$valuestore) { + dispatch(function () use($valuestore) { $tenant = Tenant::current(); - $valuestore->put('tenantId', $tenant?->getKey()); - $valuestore->put('tenantName', $tenant?->name); + // $valuestore->put('tenantId', $tenant?->getKey()); + // $valuestore->put('tenantName', $tenant?->name); + $valuestore->put('tenantName', 'test of mine'); }); - expect($valuestore->get('tenantId'))->toBeNull() - ->and($valuestore->get('tenantName'))->toBeNull(); - $this->artisan('queue:work --once'); + /* expect($valuestore->get('tenantId'))->toBe($this->tenant->getKey()) ->and($valuestore->get('tenantName'))->toBe($this->tenant->name); + */ + expect($valuestore->get('tenantName'))->toBe('test of mine'); }); it('fails with closure job when queues are not tenant aware by default', function () { @@ -38,7 +39,7 @@ $this->tenant->makeCurrent(); - dispatch(function () use (&$valuestore) { + dispatch(function () use ($valuestore) { $tenant = Tenant::current(); $valuestore->put('tenantId', $tenant?->getKey()); @@ -56,7 +57,7 @@ $currentTenant = $this->tenant; - dispatch(function () use (&$valuestore, $currentTenant) { + dispatch(function () use ($valuestore, $currentTenant) { $valuestore = Valuestore::make(tempFile('tenantAware.json')); $currentTenant->makeCurrent(); @@ -69,9 +70,6 @@ $currentTenant->forget(); }); - expect($valuestore->get('tenantId'))->toBeNull() - ->and($valuestore->get('tenantName'))->toBeNull(); - $this->artisan('queue:work --once'); expect($valuestore->get('tenantId'))->toBe($this->tenant->getKey()) From f7a1e7c0be95ba9d04e225cb6655a131ed36d776 Mon Sep 17 00:00:00 2001 From: masterix21 Date: Tue, 26 Sep 2023 10:24:28 +0000 Subject: [PATCH 11/35] Fix styling --- tests/Feature/TenantAwareJobs/QueuedClosuresTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php index cb91770..d196c5c 100644 --- a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php +++ b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php @@ -17,7 +17,7 @@ $this->tenant->makeCurrent(); - dispatch(function () use($valuestore) { + dispatch(function () use ($valuestore) { $tenant = Tenant::current(); // $valuestore->put('tenantId', $tenant?->getKey()); From a00d27021599c6dd4e663722bfe6d503c283e325 Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Tue, 26 Sep 2023 12:26:53 +0200 Subject: [PATCH 12/35] Update QueuedClosuresTest.php --- tests/Feature/TenantAwareJobs/QueuedClosuresTest.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php index cb91770..37186bb 100644 --- a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php +++ b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php @@ -1,11 +1,15 @@ set('queue.default', 'database'); config()->set('multitenancy.queues_are_tenant_aware_by_default', false); + config()->set('multitenancy.queueable_to_job', [ + CallQueuedClosure::class => 'closure', + ]); $this->tenant = Tenant::factory()->create(); }); @@ -20,18 +24,14 @@ dispatch(function () use($valuestore) { $tenant = Tenant::current(); - // $valuestore->put('tenantId', $tenant?->getKey()); - // $valuestore->put('tenantName', $tenant?->name); - $valuestore->put('tenantName', 'test of mine'); + $valuestore->put('tenantId', $tenant?->getKey()); + $valuestore->put('tenantName', $tenant?->name); }); $this->artisan('queue:work --once'); - /* expect($valuestore->get('tenantId'))->toBe($this->tenant->getKey()) ->and($valuestore->get('tenantName'))->toBe($this->tenant->name); - */ - expect($valuestore->get('tenantName'))->toBe('test of mine'); }); it('fails with closure job when queues are not tenant aware by default', function () { From 656e23c4ecca4559b5701cc6874e92c3b94e20d1 Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Tue, 26 Sep 2023 12:46:33 +0200 Subject: [PATCH 13/35] Update QueuedClosuresTest.php --- .../TenantAwareJobs/QueuedClosuresTest.php | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php index c1976db..fd7f17a 100644 --- a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php +++ b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php @@ -1,15 +1,11 @@ set('queue.default', 'database'); config()->set('multitenancy.queues_are_tenant_aware_by_default', false); - config()->set('multitenancy.queueable_to_job', [ - CallQueuedClosure::class => 'closure', - ]); $this->tenant = Tenant::factory()->create(); }); @@ -21,14 +17,15 @@ $this->tenant->makeCurrent(); - dispatch(function () use ($valuestore) { + app(Dispatcher::class)->dispatch(function () use ($valuestore) { + ray('func'); $tenant = Tenant::current(); $valuestore->put('tenantId', $tenant?->getKey()); $valuestore->put('tenantName', $tenant?->name); }); - $this->artisan('queue:work --once'); + $this->artisan('queue:work --once')->assertOk(); expect($valuestore->get('tenantId'))->toBe($this->tenant->getKey()) ->and($valuestore->get('tenantName'))->toBe($this->tenant->name); @@ -39,14 +36,14 @@ $this->tenant->makeCurrent(); - dispatch(function () use ($valuestore) { + app(Dispatcher::class)->dispatch(function () use ($valuestore) { $tenant = Tenant::current(); $valuestore->put('tenantId', $tenant?->getKey()); $valuestore->put('tenantName', $tenant?->name); }); - $this->artisan('queue:work --once'); + $this->artisan('queue:work --once')->assertOk(); expect($valuestore->get('tenantId'))->toBeNull() ->and($valuestore->get('tenantName'))->toBeNull(); @@ -57,7 +54,7 @@ $currentTenant = $this->tenant; - dispatch(function () use ($valuestore, $currentTenant) { + app(Dispatcher::class)->dispatch(function () use ($valuestore, $currentTenant) { $valuestore = Valuestore::make(tempFile('tenantAware.json')); $currentTenant->makeCurrent(); @@ -70,7 +67,7 @@ $currentTenant->forget(); }); - $this->artisan('queue:work --once'); + $this->artisan('queue:work --once')->assertOk(); expect($valuestore->get('tenantId'))->toBe($this->tenant->getKey()) ->and($valuestore->get('tenantName'))->toBe($this->tenant->name); From 960134aa37e538c55fd34e8b026523b6f75d219a Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Tue, 26 Sep 2023 12:46:57 +0200 Subject: [PATCH 14/35] Update QueuedClosuresTest.php --- tests/Feature/TenantAwareJobs/QueuedClosuresTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php index fd7f17a..f2bcfb4 100644 --- a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php +++ b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php @@ -18,7 +18,6 @@ $this->tenant->makeCurrent(); app(Dispatcher::class)->dispatch(function () use ($valuestore) { - ray('func'); $tenant = Tenant::current(); $valuestore->put('tenantId', $tenant?->getKey()); From 2e1e46b6f5c869856affc252257c3d677683ec92 Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Tue, 26 Sep 2023 12:54:55 +0200 Subject: [PATCH 15/35] Update QueuedClosuresTest.php --- tests/Feature/TenantAwareJobs/QueuedClosuresTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php index f2bcfb4..e760e08 100644 --- a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php +++ b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php @@ -17,7 +17,7 @@ $this->tenant->makeCurrent(); - app(Dispatcher::class)->dispatch(function () use ($valuestore) { + dispatch(function () use ($valuestore) { $tenant = Tenant::current(); $valuestore->put('tenantId', $tenant?->getKey()); @@ -35,7 +35,7 @@ $this->tenant->makeCurrent(); - app(Dispatcher::class)->dispatch(function () use ($valuestore) { + dispatch(function () use ($valuestore) { $tenant = Tenant::current(); $valuestore->put('tenantId', $tenant?->getKey()); @@ -53,7 +53,7 @@ $currentTenant = $this->tenant; - app(Dispatcher::class)->dispatch(function () use ($valuestore, $currentTenant) { + dispatch(function () use ($valuestore, $currentTenant) { $valuestore = Valuestore::make(tempFile('tenantAware.json')); $currentTenant->makeCurrent(); From 4ba47e70bdf3104c3f44798b879460b2f1c3d87f Mon Sep 17 00:00:00 2001 From: masterix21 Date: Tue, 26 Sep 2023 10:55:15 +0000 Subject: [PATCH 16/35] Fix styling --- tests/Feature/TenantAwareJobs/QueuedClosuresTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php index e760e08..599ae2b 100644 --- a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php +++ b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php @@ -1,6 +1,5 @@ Date: Tue, 26 Sep 2023 12:56:29 +0200 Subject: [PATCH 17/35] Update QueuedClosuresTest.php --- tests/Feature/TenantAwareJobs/QueuedClosuresTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php index e760e08..5ef4e06 100644 --- a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php +++ b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php @@ -24,7 +24,7 @@ $valuestore->put('tenantName', $tenant?->name); }); - $this->artisan('queue:work --once')->assertOk(); + $this->artisan('queue:work --once')->assertExitCode(0); expect($valuestore->get('tenantId'))->toBe($this->tenant->getKey()) ->and($valuestore->get('tenantName'))->toBe($this->tenant->name); @@ -42,7 +42,7 @@ $valuestore->put('tenantName', $tenant?->name); }); - $this->artisan('queue:work --once')->assertOk(); + $this->artisan('queue:work --once')->assertExitCode(0); expect($valuestore->get('tenantId'))->toBeNull() ->and($valuestore->get('tenantName'))->toBeNull(); @@ -66,7 +66,7 @@ $currentTenant->forget(); }); - $this->artisan('queue:work --once')->assertOk(); + $this->artisan('queue:work --once')->assertExitCode(0); expect($valuestore->get('tenantId'))->toBe($this->tenant->getKey()) ->and($valuestore->get('tenantName'))->toBe($this->tenant->name); From 1399b29a16d3e3485a19bcb986367fead4b318fd Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Tue, 26 Sep 2023 13:00:51 +0200 Subject: [PATCH 18/35] Update QueuedClosuresTest.php --- tests/Feature/TenantAwareJobs/QueuedClosuresTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php index 182f494..21663b8 100644 --- a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php +++ b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php @@ -48,12 +48,10 @@ }); it('succeeds with closure job when a tenant is specified', function () { - $valuestore = Valuestore::make(tempFile('tenantAware.json'))->flush(); - $currentTenant = $this->tenant; - dispatch(function () use ($valuestore, $currentTenant) { - $valuestore = Valuestore::make(tempFile('tenantAware.json')); + dispatch(function () use ($currentTenant) { + $valuestore = Valuestore::make(tempFile('tenantAware.json'))->flush(); $currentTenant->makeCurrent(); @@ -67,6 +65,8 @@ $this->artisan('queue:work --once')->assertExitCode(0); + $valuestore = Valuestore::make(tempFile('tenantAware.json')); + expect($valuestore->get('tenantId'))->toBe($this->tenant->getKey()) ->and($valuestore->get('tenantName'))->toBe($this->tenant->name); }); From caa4a15c5bfe7490dc1522b65ff84b9f5f8f19ac Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Tue, 26 Sep 2023 15:53:31 +0200 Subject: [PATCH 19/35] Update QueuedClosuresTest.php --- tests/Feature/TenantAwareJobs/QueuedClosuresTest.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php index 21663b8..c027912 100644 --- a/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php +++ b/tests/Feature/TenantAwareJobs/QueuedClosuresTest.php @@ -48,11 +48,11 @@ }); it('succeeds with closure job when a tenant is specified', function () { - $currentTenant = $this->tenant; + $valuestore = Valuestore::make(tempFile('tenantAware.json'))->flush(); - dispatch(function () use ($currentTenant) { - $valuestore = Valuestore::make(tempFile('tenantAware.json'))->flush(); + $currentTenant = $this->tenant; + dispatch(function () use ($valuestore, $currentTenant) { $currentTenant->makeCurrent(); $tenant = Tenant::current(); @@ -65,8 +65,6 @@ $this->artisan('queue:work --once')->assertExitCode(0); - $valuestore = Valuestore::make(tempFile('tenantAware.json')); - expect($valuestore->get('tenantId'))->toBe($this->tenant->getKey()) ->and($valuestore->get('tenantName'))->toBe($this->tenant->name); }); From 489fb6dbeedc4aba778cb6885dfafe0e2d25aec4 Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Tue, 26 Sep 2023 17:40:10 +0200 Subject: [PATCH 20/35] Update composer.json --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 8b9f9f5..da1221e 100644 --- a/composer.json +++ b/composer.json @@ -17,14 +17,14 @@ ], "require": { "php": "^8.0", - "illuminate/support": "^8.0|^9.0|^10.0", + "illuminate/support": "^8.1|^9.1|^10.0", "spatie/laravel-package-tools": "^1.9" }, "require-dev": { "laravel/legacy-factories": "^1.0.4", "laravel/octane": "^1.0", "mockery/mockery": "^1.4", - "orchestra/testbench": "^6.23|^7.0|^8.0", + "orchestra/testbench": "^6.23|^7.1|^8.0", "pestphp/pest": "^1.22", "phpunit/phpunit": "^9.4", "spatie/valuestore": "^1.2" From b6cb5e55799db133839c19d0360192fb23a255ae Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Tue, 26 Sep 2023 17:47:10 +0200 Subject: [PATCH 21/35] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index da1221e..e19f490 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": "^8.0", - "illuminate/support": "^8.1|^9.1|^10.0", + "illuminate/support": "^8.68|^9.0|^10.0", "spatie/laravel-package-tools": "^1.9" }, "require-dev": { From bc6b2ac9dd38c0ccf97a8eb79e5ce4528388a55d Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Tue, 26 Sep 2023 17:48:36 +0200 Subject: [PATCH 22/35] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e19f490..3d07678 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": "^8.0", - "illuminate/support": "^8.68|^9.0|^10.0", + "illuminate/support": "^8.69|^9.0|^10.0", "spatie/laravel-package-tools": "^1.9" }, "require-dev": { From 75d8125ad0016285725f86ccc2cae711b96fe12d Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Tue, 26 Sep 2023 17:51:09 +0200 Subject: [PATCH 23/35] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 3d07678..ef6fc81 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": "^8.0", - "illuminate/support": "^8.69|^9.0|^10.0", + "illuminate/support": "^8.80|^9.0|^10.0", "spatie/laravel-package-tools": "^1.9" }, "require-dev": { From 5686ec4a7ad2359e4f583750a620fa57530df602 Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Tue, 26 Sep 2023 17:52:43 +0200 Subject: [PATCH 24/35] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ef6fc81..4540483 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": "^8.0", - "illuminate/support": "^8.80|^9.0|^10.0", + "illuminate/support": "^8.82|^9.0|^10.0", "spatie/laravel-package-tools": "^1.9" }, "require-dev": { From bac9128fde64b25f770c8762fe70c2d71ab06a73 Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Tue, 26 Sep 2023 17:54:36 +0200 Subject: [PATCH 25/35] Update run-tests.yml --- .github/workflows/run-tests.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index e316a47..1976678 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -9,8 +9,10 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest] - php: [8.2, 8.1, 8.0] - laravel: [10.*, 9.*, 8.*] + # php: [8.2, 8.1, 8.0] + php: [8.2] + #laravel: [10.*, 9.*, 8.*] + laravel: [8.*] dependency-version: [prefer-lowest, prefer-stable] include: - laravel: 10.* From 75c8512a693cd9ea6fdf54ed31570c66327746c7 Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Tue, 26 Sep 2023 17:55:11 +0200 Subject: [PATCH 26/35] Update run-tests.yml --- .github/workflows/run-tests.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 1976678..88a4daa 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -9,9 +9,7 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest] - # php: [8.2, 8.1, 8.0] php: [8.2] - #laravel: [10.*, 9.*, 8.*] laravel: [8.*] dependency-version: [prefer-lowest, prefer-stable] include: From 27cedd5f2f58dc69daf1e1b294d7cb331d88cc8d Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Tue, 26 Sep 2023 17:58:32 +0200 Subject: [PATCH 27/35] Update run-tests.yml --- .github/workflows/run-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 88a4daa..e316a47 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -9,8 +9,8 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest] - php: [8.2] - laravel: [8.*] + php: [8.2, 8.1, 8.0] + laravel: [10.*, 9.*, 8.*] dependency-version: [prefer-lowest, prefer-stable] include: - laravel: 10.* From ab191ad381392a657bdd021e4fcbaf10c50c9ede Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Tue, 26 Sep 2023 18:01:55 +0200 Subject: [PATCH 28/35] wip --- .github/workflows/run-tests.yml | 2 +- composer.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index e316a47..4e9fdf3 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -18,7 +18,7 @@ jobs: - laravel: 9.* testbench: 7.* - laravel: 8.* - testbench: ^6.23 + testbench: ^6.30 exclude: - laravel: 10.* php: 8.0 diff --git a/composer.json b/composer.json index 4540483..de12b5d 100644 --- a/composer.json +++ b/composer.json @@ -17,14 +17,14 @@ ], "require": { "php": "^8.0", - "illuminate/support": "^8.82|^9.0|^10.0", + "illuminate/support": "^8.0|^9.0|^10.0", "spatie/laravel-package-tools": "^1.9" }, "require-dev": { "laravel/legacy-factories": "^1.0.4", "laravel/octane": "^1.0", "mockery/mockery": "^1.4", - "orchestra/testbench": "^6.23|^7.1|^8.0", + "orchestra/testbench": "^6.30|^7.1|^8.0", "pestphp/pest": "^1.22", "phpunit/phpunit": "^9.4", "spatie/valuestore": "^1.2" From a85eecc48412562769193658f5fa823156c46e4b Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Tue, 26 Sep 2023 18:05:10 +0200 Subject: [PATCH 29/35] wip --- .github/workflows/run-tests.yml | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 4e9fdf3..dcd6b6d 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -18,7 +18,7 @@ jobs: - laravel: 9.* testbench: 7.* - laravel: 8.* - testbench: ^6.30 + testbench: ^6.35 exclude: - laravel: 10.* php: 8.0 diff --git a/composer.json b/composer.json index de12b5d..c0c5565 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "laravel/legacy-factories": "^1.0.4", "laravel/octane": "^1.0", "mockery/mockery": "^1.4", - "orchestra/testbench": "^6.30|^7.1|^8.0", + "orchestra/testbench": "^6.35|^7.0|^8.0", "pestphp/pest": "^1.22", "phpunit/phpunit": "^9.4", "spatie/valuestore": "^1.2" From 8b9955c19e472c65ec398808f8de215a263a6ad0 Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Tue, 26 Sep 2023 18:12:32 +0200 Subject: [PATCH 30/35] wip --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index c0c5565..bf8e864 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "mockery/mockery": "^1.4", "orchestra/testbench": "^6.35|^7.0|^8.0", "pestphp/pest": "^1.22", - "phpunit/phpunit": "^9.4", + "phpunit/phpunit": "^9.6", "spatie/valuestore": "^1.2" }, "autoload": { From 991ed47c23e1a5c9ee634e00084a211ec6091d59 Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Tue, 26 Sep 2023 18:16:48 +0200 Subject: [PATCH 31/35] wip --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index bf8e864..befa93e 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "mockery/mockery": "^1.4", "orchestra/testbench": "^6.35|^7.0|^8.0", "pestphp/pest": "^1.22", - "phpunit/phpunit": "^9.6", + "phpunit/phpunit": "^9.6.13", "spatie/valuestore": "^1.2" }, "autoload": { From ce6dc0febb3d521006937759663d761aa00fdb95 Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Tue, 26 Sep 2023 18:18:57 +0200 Subject: [PATCH 32/35] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index befa93e..1caf131 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "laravel/octane": "^1.0", "mockery/mockery": "^1.4", "orchestra/testbench": "^6.35|^7.0|^8.0", - "pestphp/pest": "^1.22", + "pestphp/pest": "^1.23", "phpunit/phpunit": "^9.6.13", "spatie/valuestore": "^1.2" }, From 19ed10ba0fad849d0215bf3d88d1b364328a8d7d Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Tue, 26 Sep 2023 18:21:20 +0200 Subject: [PATCH 33/35] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 1caf131..b778209 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "require-dev": { "laravel/legacy-factories": "^1.0.4", "laravel/octane": "^1.0", - "mockery/mockery": "^1.4", + "mockery/mockery": "^1.6", "orchestra/testbench": "^6.35|^7.0|^8.0", "pestphp/pest": "^1.23", "phpunit/phpunit": "^9.6.13", From 4a5c220a3ea2f40f05102149857fcebbb3dedb51 Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Tue, 26 Sep 2023 18:36:33 +0200 Subject: [PATCH 34/35] Update composer.json --- composer.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index b778209..c003570 100644 --- a/composer.json +++ b/composer.json @@ -18,14 +18,17 @@ "require": { "php": "^8.0", "illuminate/support": "^8.0|^9.0|^10.0", + "laravel/framework": "8.*", + "nesbot/carbon": "^2.63", + "orchestra/testbench": "^6.23", "spatie/laravel-package-tools": "^1.9" }, "require-dev": { "laravel/legacy-factories": "^1.0.4", "laravel/octane": "^1.0", - "mockery/mockery": "^1.6", - "orchestra/testbench": "^6.35|^7.0|^8.0", - "pestphp/pest": "^1.23", + "laravel/serializable-closure": "^1.31.1", + "mockery/mockery": "^1.6.6", + "pestphp/pest": "^1.23.1", "phpunit/phpunit": "^9.6.13", "spatie/valuestore": "^1.2" }, From 3f68dee4454bf2452f46a725e10c2897cdeaa0a2 Mon Sep 17 00:00:00 2001 From: Luca Longo Date: Tue, 26 Sep 2023 18:39:39 +0200 Subject: [PATCH 35/35] wip --- composer.json | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index c003570..c5ec96e 100644 --- a/composer.json +++ b/composer.json @@ -18,18 +18,16 @@ "require": { "php": "^8.0", "illuminate/support": "^8.0|^9.0|^10.0", - "laravel/framework": "8.*", - "nesbot/carbon": "^2.63", - "orchestra/testbench": "^6.23", "spatie/laravel-package-tools": "^1.9" }, "require-dev": { "laravel/legacy-factories": "^1.0.4", "laravel/octane": "^1.0", - "laravel/serializable-closure": "^1.31.1", - "mockery/mockery": "^1.6.6", - "pestphp/pest": "^1.23.1", - "phpunit/phpunit": "^9.6.13", + "laravel/serializable-closure": "^1.1", + "mockery/mockery": "^1.4", + "orchestra/testbench": "^6.23|^7.0|^8.0", + "pestphp/pest": "^1.22", + "phpunit/phpunit": "^9.4", "spatie/valuestore": "^1.2" }, "autoload": {