mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 19:14:04 +00:00
Add tests, fix bugs
This commit is contained in:
parent
3857c4a27d
commit
f05a4bca41
6 changed files with 122 additions and 16 deletions
|
|
@ -6,7 +6,8 @@ use Illuminate\Support\Facades\Redis;
|
|||
|
||||
class TestCase extends \Orchestra\Testbench\TestCase
|
||||
{
|
||||
public $initTenancy = true;
|
||||
public $autoCreateTenant = true;
|
||||
public $autoInitTenancy = true;
|
||||
|
||||
/**
|
||||
* Setup the test environment
|
||||
|
|
@ -19,11 +20,23 @@ class TestCase extends \Orchestra\Testbench\TestCase
|
|||
|
||||
Redis::connection('tenancy')->flushdb();
|
||||
|
||||
tenant()->create('localhost');
|
||||
|
||||
if ($this->initTenancy) {
|
||||
tenancy()->init('localhost');
|
||||
if ($this->autoCreateTenant) {
|
||||
$this->createTenant();
|
||||
}
|
||||
|
||||
if ($this->autoInitTenancy) {
|
||||
$this->initTenancy();
|
||||
}
|
||||
}
|
||||
|
||||
public function createTenant($domain = 'localhost')
|
||||
{
|
||||
tenant()->create($domain);
|
||||
}
|
||||
|
||||
public function initTenancy($domain = 'localhost')
|
||||
{
|
||||
tenancy()->init($domain);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -84,9 +97,4 @@ class TestCase extends \Orchestra\Testbench\TestCase
|
|||
// set one of these environment vars on their computer.
|
||||
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