1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-05-07 04:54:03 +00:00
1. Remove the CreateTenantStorage job altogether since as the docblock
   says the class should be redundant now that
   FilesystemTenancyBootstrapper creates this path automatically when
   storage_path suffixing is enabled
2. Remove docblock on the DeleteTenantStorage job - a class's docblock
   should describe what it does, not how it handles edge cases. Here
   the former isn't even necessary and the latter is well explained by
   comments in the implementation.
3. Remove the CreateTenantStorage test following the class's removal,
   the test would pass on its own even without the job with just
   tenancy initialization as mentioned above.
4. Slightly improve the structure of the DeleteTenantStorage job and
   deprecated listener
5. Improve deprecation notices so they include full steps for upgrading
   to the new approach.
This commit is contained in:
Samuel Stancl 2026-04-20 18:22:04 +02:00
parent 97e856616c
commit 5bb76e1421
No known key found for this signature in database
GPG key ID: BA146259A1E16C57
6 changed files with 22 additions and 85 deletions

View file

@ -13,7 +13,6 @@ use Stancl\Tenancy\Events\TenancyInitialized;
use Stancl\Tenancy\Jobs\CreateStorageSymlinks;
use Stancl\Tenancy\Jobs\RemoveStorageSymlinks;
use Stancl\Tenancy\Listeners\BootstrapTenancy;
use Stancl\Tenancy\Jobs\CreateTenantStorage;
use Stancl\Tenancy\Jobs\DeleteTenantStorage;
use Stancl\Tenancy\Listeners\RevertToCentralContext;
use Stancl\Tenancy\Bootstrappers\FilesystemTenancyBootstrapper;
@ -185,27 +184,6 @@ test('create and delete storage symlinks jobs work', function() {
$this->assertDirectoryDoesNotExist(public_path("public-$tenantKey"));
});
test('tenant storage gets created when TenantCreated listens to CreateTenantStorage', function() {
config([
'tenancy.bootstrappers' => [
FilesystemTenancyBootstrapper::class,
],
]);
Event::listen(TenantCreated::class,
JobPipeline::make([CreateTenantStorage::class])->send(function (TenantCreated $event) {
return $event->tenant;
})->shouldBeQueued(false)->toListener()
);
$centralStoragePath = storage_path();
$tenant = Tenant::create();
$suffixBase = config('tenancy.filesystem.suffix_base', 'tenant');
$tenantStoragePath = $centralStoragePath . '/' . $suffixBase . $tenant->getTenantKey();
$this->assertDirectoryExists($tenantStoragePath . '/framework/cache');
});
test('tenant storage can get deleted after the tenant when DeletingTenant listens to DeleteTenantStorage', function() {
Event::listen(DeletingTenant::class,
JobPipeline::make([DeleteTenantStorage::class])->send(function (DeletingTenant $event) {