From 5f10c05f154021bba76a67d3bf73ebd25a75bd0c Mon Sep 17 00:00:00 2001 From: lukinovec Date: Wed, 26 Feb 2025 17:22:42 +0100 Subject: [PATCH] Make the symlink assertions more explicit --- tests/ActionTest.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/ActionTest.php b/tests/ActionTest.php index 40275b60..e2c0ab99 100644 --- a/tests/ActionTest.php +++ b/tests/ActionTest.php @@ -36,11 +36,15 @@ test('create storage symlinks action works', function() { 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); - $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)); }); @@ -62,11 +66,15 @@ test('remove storage symlinks action works', function() { (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); - $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() {