1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 09:54:05 +00:00

Fix typos, add tests

This commit is contained in:
Samuel Štancl 2019-08-14 16:54:49 +02:00
parent 82237bd7f3
commit 0111ed6f53
3 changed files with 36 additions and 5 deletions

View file

@ -2,6 +2,7 @@
namespace Stancl\Tenancy\Tests;
use Tenancy;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
use Stancl\Tenancy\Exceptions\CannotChangeUuidOrDomainException;
@ -241,4 +242,34 @@ class TenantManagerTest extends TestCase
$this->expectException(CannotChangeUuidOrDomainException::class);
tenant()->put(['uuid' => 'foo']);
}
/** @test */
public function bootstrapping_event_works()
{
$uuid = tenant()->create('foo.localhost')['uuid'];
Tenancy::bootstrapping(function ($tenantManager) use ($uuid) {
if ($tenantManager->tenant['uuid'] === $uuid) {
config(['tenancy.foo' => 'bar']);
}
});
tenancy()->init('foo.localhost');
$this->assertSame('bar', config('tenancy.foo'));
}
/** @test */
public function bootstrapped_event_works()
{
$uuid = tenant()->create('foo.localhost')['uuid'];
Tenancy::bootstrapped(function ($tenantManager) use ($uuid) {
if ($tenantManager->tenant['uuid'] === $uuid) {
config(['tenancy.foo' => 'bar']);
}
});
tenancy()->init('foo.localhost');
$this->assertSame('bar', config('tenancy.foo'));
}
}