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

Change tenant storage listeners into jobs

Also move the commented jobs to the JobPipelines and update FilesystemTenancyBootstrapperTest accordingly.
This commit is contained in:
lukinovec 2026-03-26 15:34:04 +01:00
parent c4960b76cb
commit bf42a12894
5 changed files with 55 additions and 31 deletions

View file

@ -13,7 +13,7 @@ use Stancl\Tenancy\Events\TenancyInitialized;
use Stancl\Tenancy\Jobs\CreateStorageSymlinks;
use Stancl\Tenancy\Jobs\RemoveStorageSymlinks;
use Stancl\Tenancy\Listeners\BootstrapTenancy;
use Stancl\Tenancy\Listeners\DeleteTenantStorage;
use Stancl\Tenancy\Jobs\DeleteTenantStorage;
use Stancl\Tenancy\Listeners\RevertToCentralContext;
use Stancl\Tenancy\Bootstrappers\FilesystemTenancyBootstrapper;
use function Stancl\Tenancy\Tests\pest;
@ -185,7 +185,11 @@ test('create and delete storage symlinks jobs work', function() {
});
test('tenant storage can get deleted after the tenant when DeletingTenant listens to DeleteTenantStorage', function() {
Event::listen(DeletingTenant::class, DeleteTenantStorage::class);
Event::listen(DeletingTenant::class,
JobPipeline::make([DeleteTenantStorage::class])->send(function (DeletingTenant $event) {
return $event->tenant;
})->shouldBeQueued(false)->toListener()
);
tenancy()->initialize(Tenant::create());
$tenantStoragePath = storage_path();