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:
parent
30bab68b6a
commit
d2df9a9866
3 changed files with 68 additions and 0 deletions
31
tests/Traits/TenantAwareCommandTest.php
Normal file
31
tests/Traits/TenantAwareCommandTest.php
Normal 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()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue