mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 14:14:04 +00:00
Add TestCase@initTenancy
This commit is contained in:
parent
124e747aa0
commit
3857c4a27d
2 changed files with 9 additions and 4 deletions
|
|
@ -12,7 +12,7 @@ class BootstrapsTenancyTest extends TestCase
|
||||||
public function database_connection_is_switched()
|
public function database_connection_is_switched()
|
||||||
{
|
{
|
||||||
$old_connection_name = app(\Illuminate\Database\DatabaseManager::class)->connection()->getName();
|
$old_connection_name = app(\Illuminate\Database\DatabaseManager::class)->connection()->getName();
|
||||||
tenancy()->init('localhost');
|
$this->initTenancy();
|
||||||
$new_connection_name = app(\Illuminate\Database\DatabaseManager::class)->connection()->getName();
|
$new_connection_name = app(\Illuminate\Database\DatabaseManager::class)->connection()->getName();
|
||||||
|
|
||||||
$this->assertNotEquals($old_connection_name, $new_connection_name);
|
$this->assertNotEquals($old_connection_name, $new_connection_name);
|
||||||
|
|
@ -22,7 +22,7 @@ class BootstrapsTenancyTest extends TestCase
|
||||||
/** @test */
|
/** @test */
|
||||||
public function redis_is_prefixed()
|
public function redis_is_prefixed()
|
||||||
{
|
{
|
||||||
tenancy()->init('localhost');
|
$this->initTenancy();
|
||||||
foreach (config('tenancy.redis.prefixed_connections', ['default']) as $connection) {
|
foreach (config('tenancy.redis.prefixed_connections', ['default']) as $connection) {
|
||||||
$prefix = config('tenancy.redis.prefix_base') . tenant('uuid');
|
$prefix = config('tenancy.redis.prefix_base') . tenant('uuid');
|
||||||
$client = Redis::connection($connection)->client();
|
$client = Redis::connection($connection)->client();
|
||||||
|
|
@ -34,7 +34,7 @@ class BootstrapsTenancyTest extends TestCase
|
||||||
public function filesystem_is_suffixed()
|
public function filesystem_is_suffixed()
|
||||||
{
|
{
|
||||||
$old_storage_path = storage_path();
|
$old_storage_path = storage_path();
|
||||||
tenancy()->init();
|
$this->initTenancy();
|
||||||
$new_storage_path = storage_path();
|
$new_storage_path = storage_path();
|
||||||
|
|
||||||
$this->assertEquals($old_storage_path . "/" . config('tenancy.filesystem.suffix_base') . tenant('uuid'), $new_storage_path);
|
$this->assertEquals($old_storage_path . "/" . config('tenancy.filesystem.suffix_base') . tenant('uuid'), $new_storage_path);
|
||||||
|
|
|
||||||
|
|
@ -84,4 +84,9 @@ class TestCase extends \Orchestra\Testbench\TestCase
|
||||||
// set one of these environment vars on their computer.
|
// set one of these environment vars on their computer.
|
||||||
return env('CI') && env('TRAVIS') && env('CONTINUOUS_INTEGRATION');
|
return env('CI') && env('TRAVIS') && env('CONTINUOUS_INTEGRATION');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function initTenancy($domain = 'localhost')
|
||||||
|
{
|
||||||
|
tenancy()->init($domain);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue