diff --git a/composer.json b/composer.json index 13e4989c..1c7a1f1e 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,8 @@ "orchestra/testbench": "~3.0", "laravel/framework": "5.7.*", "vlucas/phpdotenv": "^2.2", - "psy/psysh": "@stable" + "psy/psysh": "@stable", + "league/flysystem-aws-s3-v3": "~1.0" }, "autoload": { "psr-4": { diff --git a/phpunit.xml b/phpunit.xml index 75cb7545..28aa16ad 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -29,5 +29,6 @@ + \ No newline at end of file diff --git a/tests/BootstrapsTenancyTest.php b/tests/BootstrapsTenancyTest.php index 902ca712..2d9722dd 100644 --- a/tests/BootstrapsTenancyTest.php +++ b/tests/BootstrapsTenancyTest.php @@ -51,7 +51,11 @@ class BootstrapsTenancyTest extends TestCase if ($override = config("tenancy.filesystem.root_override.{$disk}")) { $correct_path_prefix = str_replace("%storage_path%", storage_path(), $override); } else { - $correct_path_prefix = $old_storage_facade_roots[$disk] . "/$suffix/"; + if ($base = $old_storage_facade_roots[$disk]) { + $correct_path_prefix = $base . "/$suffix/"; + } else { + $correct_path_prefix = "$suffix/"; + } } $this->assertSame($correct_path_prefix, $current_path_prefix); diff --git a/tests/ReidentificationTest.php b/tests/ReidentificationTest.php index 83df49ae..eeba2e52 100644 --- a/tests/ReidentificationTest.php +++ b/tests/ReidentificationTest.php @@ -29,7 +29,11 @@ class ReidentificationTest extends TestCase if ($override = config("tenancy.filesystem.root_override.{$disk}")) { $correct_path_prefix = str_replace("%storage_path%", storage_path(), $override); } else { - $correct_path_prefix = $originals[$disk] . "/$suffix/"; + if ($base = $originals[$disk]) { + $correct_path_prefix = $base . "/$suffix/"; + } else { + $correct_path_prefix = "$suffix/"; + } } $this->assertSame($correct_path_prefix, $current_path_prefix); diff --git a/tests/TenantStorageTest.php b/tests/TenantStorageTest.php index 65c1aee4..8962f96e 100644 --- a/tests/TenantStorageTest.php +++ b/tests/TenantStorageTest.php @@ -15,6 +15,18 @@ class TenantStorageTest extends TestCase $this->storage = app(StorageDriver::class); } + /** @test */ + public function deleting_a_tenant_works() + { + $abc = tenant()->create('abc.localhost'); + + $this->assertTrue(tenant()->all()->contains($abc)); + + tenant()->delete($abc['uuid']); + + $this->assertFalse(tenant()->all()->contains($abc)); + } + /** @test */ public function put_works_with_key_and_value_as_separate_args() { diff --git a/tests/TestCase.php b/tests/TestCase.php index 1e214f14..ebc102fd 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -67,6 +67,11 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase 'suffix' => '.sqlite', ], 'database.connections.sqlite.database' => ':memory:', + 'tenancy.filesystem.disks' => [ + 'local', + 'public', + 's3', + ], ]); }