mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 22:04:04 +00:00
Add and test Tenant::current()
This commit is contained in:
parent
76a3e269c8
commit
0198a30413
2 changed files with 17 additions and 0 deletions
|
|
@ -141,6 +141,18 @@ test('a command can be run on a collection of tenants', function () {
|
|||
expect(Tenant::find('t2')->foo)->toBe('xyz');
|
||||
});
|
||||
|
||||
test('the current method returns the currently initialized tenant', function() {
|
||||
tenancy()->initialize($tenant = Tenant::create());
|
||||
|
||||
expect(Tenant::current())->toBe($tenant);
|
||||
});
|
||||
|
||||
test('the current method returns null if there is no currently initialized tenant', function() {
|
||||
tenancy()->end();
|
||||
|
||||
expect(Tenant::current())->toBeNull();
|
||||
});
|
||||
|
||||
class MyTenant extends Tenant
|
||||
{
|
||||
protected $table = 'tenants';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue