1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-13 01:14:04 +00:00

Remove symlink-related jobs, instantiate and use actions

This commit is contained in:
lukinovec 2022-09-23 13:37:55 +02:00
parent 182d2495b7
commit 547440c887
9 changed files with 46 additions and 117 deletions

View file

@ -8,8 +8,8 @@ use Stancl\Tenancy\Database\Models\Tenant;
use Stancl\Tenancy\Events\TenancyInitialized;
use Stancl\Tenancy\Listeners\BootstrapTenancy;
use Stancl\Tenancy\Listeners\RevertToCentralContext;
use Stancl\Tenancy\Actions\CreateStorageSymlinksAction;
use Stancl\Tenancy\Actions\RemoveStorageSymlinksAction;
use Stancl\Tenancy\Actions\CreateStorageSymlinks;
use Stancl\Tenancy\Actions\RemoveStorageSymlinks;
use Stancl\Tenancy\Bootstrappers\FilesystemTenancyBootstrapper;
beforeEach(function () {
@ -35,7 +35,7 @@ test('create storage symlinks action works', function() {
$this->assertDirectoryDoesNotExist($publicPath = public_path("public-$tenantKey"));
CreateStorageSymlinksAction::handle($tenant);
(new CreateStorageSymlinks($tenant))->handle();
$this->assertDirectoryExists($publicPath);
$this->assertEquals(storage_path("app/public/"), readlink($publicPath));
@ -57,11 +57,11 @@ test('remove storage symlinks action works', function() {
tenancy()->initialize($tenant);
CreateStorageSymlinksAction::handle($tenant);
(new CreateStorageSymlinks($tenant))->handle();
$this->assertDirectoryExists($publicPath = public_path("public-$tenantKey"));
RemoveStorageSymlinksAction::handle($tenant);
(new RemoveStorageSymlinks($tenant))->handle();
$this->assertDirectoryDoesNotExist($publicPath);
});

View file

@ -18,8 +18,8 @@ use Stancl\Tenancy\Events\TenantDeleted;
use Stancl\Tenancy\Events\DeletingTenant;
use Illuminate\Filesystem\FilesystemAdapter;
use Stancl\Tenancy\Events\TenancyInitialized;
use Stancl\Tenancy\Jobs\CreateStorageSymlinks;
use Stancl\Tenancy\Jobs\RemoveStorageSymlinks;
use Stancl\Tenancy\Actions\CreateStorageSymlinks;
use Stancl\Tenancy\Actions\RemoveStorageSymlinks;
use Stancl\Tenancy\Listeners\BootstrapTenancy;
use Stancl\Tenancy\Listeners\DeleteTenantStorage;
use Stancl\Tenancy\Listeners\RevertToCentralContext;