mirror of
https://github.com/archtechx/tenancy.git
synced 2026-05-06 16:24:03 +00:00
make test more clear
This commit is contained in:
parent
5bb76e1421
commit
3f9f7cda0b
1 changed files with 10 additions and 6 deletions
|
|
@ -184,7 +184,7 @@ test('create and delete storage symlinks jobs work', function() {
|
||||||
$this->assertDirectoryDoesNotExist(public_path("public-$tenantKey"));
|
$this->assertDirectoryDoesNotExist(public_path("public-$tenantKey"));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('tenant storage can get deleted after the tenant when DeletingTenant listens to DeleteTenantStorage', function() {
|
test('tenant storage gets deleted during tenant deletion when the DeletingTenant pipeline contains DeleteTenantStorage', function() {
|
||||||
Event::listen(DeletingTenant::class,
|
Event::listen(DeletingTenant::class,
|
||||||
JobPipeline::make([DeleteTenantStorage::class])->send(function (DeletingTenant $event) {
|
JobPipeline::make([DeleteTenantStorage::class])->send(function (DeletingTenant $event) {
|
||||||
return $event->tenant;
|
return $event->tenant;
|
||||||
|
|
@ -199,10 +199,10 @@ test('tenant storage can get deleted after the tenant when DeletingTenant listen
|
||||||
// the storage deletion will be skipped.
|
// the storage deletion will be skipped.
|
||||||
$tenantStoragePath = storage_path();
|
$tenantStoragePath = storage_path();
|
||||||
expect($tenantStoragePath)->toBe($centralStoragePath);
|
expect($tenantStoragePath)->toBe($centralStoragePath);
|
||||||
expect(File::isDirectory($tenantStoragePath))->toBeTrue();
|
expect(File::isDirectory($centralStoragePath))->toBeTrue();
|
||||||
tenant()->delete();
|
tenant()->delete();
|
||||||
|
|
||||||
expect(File::isDirectory($tenantStoragePath))->toBeTrue();
|
expect(File::isDirectory($centralStoragePath))->toBeTrue();
|
||||||
|
|
||||||
config([
|
config([
|
||||||
'tenancy.bootstrappers' => [FilesystemTenancyBootstrapper::class],
|
'tenancy.bootstrappers' => [FilesystemTenancyBootstrapper::class],
|
||||||
|
|
@ -218,10 +218,10 @@ test('tenant storage can get deleted after the tenant when DeletingTenant listen
|
||||||
// because suffix_storage_path is false.
|
// because suffix_storage_path is false.
|
||||||
// The storage deletion will be skipped.
|
// The storage deletion will be skipped.
|
||||||
expect($tenantStoragePath)->toBe($centralStoragePath);
|
expect($tenantStoragePath)->toBe($centralStoragePath);
|
||||||
expect(File::isDirectory($tenantStoragePath))->toBeTrue();
|
expect(File::isDirectory($centralStoragePath))->toBeTrue();
|
||||||
tenant()->delete();
|
tenant()->delete();
|
||||||
|
|
||||||
expect(File::isDirectory($tenantStoragePath))->toBeTrue();
|
expect(File::isDirectory($centralStoragePath))->toBeTrue();
|
||||||
|
|
||||||
config([
|
config([
|
||||||
'tenancy.bootstrappers' => [FilesystemTenancyBootstrapper::class],
|
'tenancy.bootstrappers' => [FilesystemTenancyBootstrapper::class],
|
||||||
|
|
@ -231,12 +231,16 @@ test('tenant storage can get deleted after the tenant when DeletingTenant listen
|
||||||
tenancy()->initialize(Tenant::create());
|
tenancy()->initialize(Tenant::create());
|
||||||
$tenantStoragePath = storage_path();
|
$tenantStoragePath = storage_path();
|
||||||
|
|
||||||
expect($centralStoragePath)->not()->toBe($tenantStoragePath);
|
// FilesystemTenancyBootstrapper enabled,
|
||||||
|
// suffix_storage_path enabled, so the two paths are distinct.
|
||||||
|
// Tenant storage will be deleted.
|
||||||
|
expect($tenantStoragePath)->not()->toBe($centralStoragePath);
|
||||||
expect(File::isDirectory($tenantStoragePath))->toBeTrue();
|
expect(File::isDirectory($tenantStoragePath))->toBeTrue();
|
||||||
|
|
||||||
tenant()->delete();
|
tenant()->delete();
|
||||||
|
|
||||||
expect(File::isDirectory($tenantStoragePath))->toBeFalse();
|
expect(File::isDirectory($tenantStoragePath))->toBeFalse();
|
||||||
|
expect(File::isDirectory($centralStoragePath))->toBeTrue();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('the framework/cache directory is created when storage_path is scoped', function (bool $suffixStoragePath) {
|
test('the framework/cache directory is created when storage_path is scoped', function (bool $suffixStoragePath) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue