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

Make the symlink assertions more explicit

This commit is contained in:
lukinovec 2025-02-26 17:22:42 +01:00
parent a56c162752
commit 5f10c05f15

View file

@ -36,11 +36,15 @@ test('create storage symlinks action works', function() {
tenancy()->initialize($tenant); tenancy()->initialize($tenant);
$this->assertDirectoryDoesNotExist($publicPath = public_path("public-$tenantKey")); // The symlink doesn't exist
expect(is_link($publicPath = public_path("public-$tenantKey")))->toBeFalse();
expect(file_exists($publicPath))->toBeFalse();
(new CreateStorageSymlinksAction)($tenant); (new CreateStorageSymlinksAction)($tenant);
$this->assertDirectoryExists($publicPath); // The symlink exists and is valid
expect(is_link($publicPath = public_path("public-$tenantKey")))->toBeTrue();
expect(file_exists($publicPath))->toBeTrue();
$this->assertEquals(storage_path("app/public/"), readlink($publicPath)); $this->assertEquals(storage_path("app/public/"), readlink($publicPath));
}); });
@ -62,11 +66,15 @@ test('remove storage symlinks action works', function() {
(new CreateStorageSymlinksAction)($tenant); (new CreateStorageSymlinksAction)($tenant);
$this->assertDirectoryExists($publicPath = public_path("public-$tenantKey")); // The symlink exists and is valid
expect(is_link($publicPath = public_path("public-$tenantKey")))->toBeTrue();
expect(file_exists($publicPath))->toBeTrue();
(new RemoveStorageSymlinksAction)($tenant); (new RemoveStorageSymlinksAction)($tenant);
$this->assertDirectoryDoesNotExist($publicPath); // The symlink doesn't exist
expect(is_link($publicPath))->toBeFalse();
expect(file_exists($publicPath))->toBeFalse();
}); });
test('removing the tenant symlinks works even if the symlinks are invalid', function() { test('removing the tenant symlinks works even if the symlinks are invalid', function() {