mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 07:04:03 +00:00
Write more tests, fix filesystem support for s3
This commit is contained in:
parent
dc21bfa37a
commit
2c69c37032
6 changed files with 30 additions and 3 deletions
|
|
@ -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": {
|
||||
|
|
|
|||
|
|
@ -29,5 +29,6 @@
|
|||
<env name="QUEUE_CONNECTION" value="sync"/>
|
||||
<env name="SESSION_DRIVER" value="array"/>
|
||||
<env name="DB_CONNECTION" value="sqlite"/>
|
||||
<env name="AWS_DEFAULT_REGION" value="us-west-2"/>
|
||||
</php>
|
||||
</phpunit>
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -67,6 +67,11 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
|
|||
'suffix' => '.sqlite',
|
||||
],
|
||||
'database.connections.sqlite.database' => ':memory:',
|
||||
'tenancy.filesystem.disks' => [
|
||||
'local',
|
||||
'public',
|
||||
's3',
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue