mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 06:24:04 +00:00
Merge branch '1.0' into serialize-data
This commit is contained in:
commit
2ef6c8eec6
2 changed files with 29 additions and 4 deletions
|
|
@ -11,7 +11,7 @@ You won't have to change a thing in your application's code.\*
|
||||||
|
|
||||||
- :heavy_check_mark: No model traits to change database connection
|
- :heavy_check_mark: No model traits to change database connection
|
||||||
- :heavy_check_mark: No replacing of Laravel classes (`Cache`, `Storage`, ...) with tenancy-aware classes
|
- :heavy_check_mark: No replacing of Laravel classes (`Cache`, `Storage`, ...) with tenancy-aware classes
|
||||||
- :heavy_check_mark: Built-in tenant identification based on hostname
|
- :heavy_check_mark: Built-in tenant identification based on hostname (including second level domains)
|
||||||
|
|
||||||
\* depending on how you use the filesystem. Be sure to read [that section](#filesystemstorage). Everything else will work out of the box.
|
\* depending on how you use the filesystem. Be sure to read [that section](#filesystemstorage). Everything else will work out of the box.
|
||||||
|
|
||||||
|
|
@ -23,7 +23,7 @@ You won't have to change a thing in your application's code.\*
|
||||||
composer require stancl/tenancy
|
composer require stancl/tenancy
|
||||||
```
|
```
|
||||||
|
|
||||||
This package follows [symantic versioning 2.0.0](https://semver.org). Each major release will have its own branch, so that bug fixes can be provided for older versions as well.
|
This package follows [semantic versioning 2.0.0](https://semver.org). Each major release will have its own branch, so that bug fixes can be provided for older versions as well.
|
||||||
|
|
||||||
### Configuring the `InitializeTenancy` middleware
|
### Configuring the `InitializeTenancy` middleware
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ class TenantManagerTest extends TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @test */
|
/** @test */
|
||||||
public function findWorks()
|
public function find_works()
|
||||||
{
|
{
|
||||||
tenant()->create('dev.localhost');
|
tenant()->create('dev.localhost');
|
||||||
tenancy()->init('dev.localhost');
|
tenancy()->init('dev.localhost');
|
||||||
|
|
@ -60,10 +60,35 @@ class TenantManagerTest extends TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @test */
|
/** @test */
|
||||||
public function getTenantByIdWorks()
|
public function getTenantById_works()
|
||||||
{
|
{
|
||||||
$tenant = tenant()->create('foo.localhost');
|
$tenant = tenant()->create('foo.localhost');
|
||||||
|
|
||||||
$this->assertSame($tenant, tenancy()->getTenantById($tenant['uuid']));
|
$this->assertSame($tenant, tenancy()->getTenantById($tenant['uuid']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @test */
|
||||||
|
public function init_returns_the_tenant()
|
||||||
|
{
|
||||||
|
$tenant = tenant()->create('foo.localhost');
|
||||||
|
|
||||||
|
$this->assertSame($tenant, tenancy()->init('foo.localhost'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @test */
|
||||||
|
public function initById_returns_the_tenant()
|
||||||
|
{
|
||||||
|
$tenant = tenant()->create('foo.localhost');
|
||||||
|
$uuid = $tenant['uuid'];
|
||||||
|
|
||||||
|
$this->assertSame($tenant, tenancy()->initById($uuid));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @test */
|
||||||
|
public function create_returns_the_supplied_domain()
|
||||||
|
{
|
||||||
|
$domain = 'foo.localhost';
|
||||||
|
|
||||||
|
$this->assertSame($domain, tenant()->create($domain)['domain']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue