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

Move tenant storage deletion to the DeletingTenant event

This commit is contained in:
lukinovec 2022-09-20 16:02:13 +02:00
parent 1b31bdb56b
commit 608c28cf33
3 changed files with 7 additions and 6 deletions

View file

@ -22,7 +22,7 @@ use Stancl\Tenancy\Bootstrappers\CacheTenancyBootstrapper;
use Stancl\Tenancy\Bootstrappers\RedisTenancyBootstrapper;
use Stancl\Tenancy\Bootstrappers\DatabaseTenancyBootstrapper;
use Stancl\Tenancy\Bootstrappers\FilesystemTenancyBootstrapper;
use Stancl\Tenancy\Events\TenantDeleted;
use Stancl\Tenancy\Events\DeletingTenant;
use Stancl\Tenancy\Listeners\DeleteTenantStorage;
beforeEach(function () {
@ -187,14 +187,14 @@ test('filesystem data is separated', function () {
expect($new_storage_path)->toEqual($expected_storage_path);
});
test('tenant storage can get deleted after the tenant when TenantDeleted listens to DeleteTenantStorage', function () {
test('tenant storage can get deleted after the tenant when DeletingTenant listens to DeleteTenantStorage', function () {
config([
'tenancy.bootstrappers' => [
FilesystemTenancyBootstrapper::class,
],
]);
Event::listen(TenantDeleted::class, DeleteTenantStorage::class);
Event::listen(DeletingTenant::class, DeleteTenantStorage::class);
tenancy()->initialize(Tenant::create());
$tenantStoragePath = storage_path();