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

Add compatability for commands in Laravel 7

This commit is contained in:
Devon Mather 2020-03-20 19:47:56 +01:00
parent 30bab68b6a
commit d2df9a9866
3 changed files with 68 additions and 0 deletions

View file

@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Tests\Traits;
use Stancl\Tenancy\Tenant;
use Stancl\Tenancy\Tests\TestCase;
class TenantAwareCommandTest extends TestCase
{
public $autoCreateTenant = false;
public $autoInitTenancy = false;
/** @test */
public function commands_run_globally_are_tenant_aware()
{
$tenant1 = Tenant::new()->save();
$tenant2 = Tenant::new()->save();
$this->artisan('user:add')->assertExitCode(1);
tenancy()->initializeTenancy($tenant1);
$this->assertNotEmpty(User::all());
tenancy()->endTenancy()
tenancy()->initializeTenancy($tenant2);
$this->assertNotEmpty(User::all());
tenancy()->endTenancy()
}
}