Skip to content
This repository has been archived by the owner on May 5, 2021. It is now read-only.

Commit

Permalink
Test allTenants before create model
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomazer authored Oct 8, 2019
1 parent 6d00e00 commit b2854ea
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/LandlordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@

class LandlordTest extends TestCase
{
public function testApplyScopesQueryAllTenants()
{
app()->bind(TenantManager::class, function() {
$manager = \Mockery::mock(TenantManager::class);
$manager->shouldReceive('newQueryWithoutTenants')->andReturn([]);
$manager->shouldReceive('applyTenantScopes');
return $manager;
});
$landlord = new TenantManager();
$landlord->addTenant('tenant_a_id', 1);
$landlord->addTenant('tenant_b_id', 2);
$this->assertEquals([], ModelStub::allTenants());
}

public function testTenantsWithStrings()
{
$landlord = new TenantManager();
Expand Down

0 comments on commit b2854ea

Please sign in to comment.