mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 17:44:04 +00:00
Add regression test for #271
This commit is contained in:
parent
6ad1a6639f
commit
bb46767257
1 changed files with 14 additions and 0 deletions
|
|
@ -121,4 +121,18 @@ class TenantManagerEventsTest extends TestCase
|
||||||
tenancy()->init('abc.localhost');
|
tenancy()->init('abc.localhost');
|
||||||
$this->assertSame('tenant', \DB::connection()->getConfig()['name']);
|
$this->assertSame('tenant', \DB::connection()->getConfig()['name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @test */
|
||||||
|
public function tenant_is_persisted_before_the_created_hook_is_called()
|
||||||
|
{
|
||||||
|
$was_persisted = false;
|
||||||
|
|
||||||
|
Tenancy::eventListener('tenant.created', function ($tenancy, $tenant) use (&$was_persisted) {
|
||||||
|
$was_persisted = $tenant->persisted;
|
||||||
|
});
|
||||||
|
|
||||||
|
Tenant::new()->save();
|
||||||
|
|
||||||
|
$this->assertTrue($was_persisted);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue