mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 14:34:04 +00:00
* Add Laravel 12 support, drop Laravel 11 support * Fix RLS tree generation (specify schema name in generateTrees()) * ci fixes, use stable virtualcolumn version --------- Co-authored-by: lukinovec <lukinovec@gmail.com>
27 lines
740 B
PHP
27 lines
740 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Illuminate\Support\Facades\Artisan;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Stancl\Tenancy\Tests\Etc\Tenant;
|
|
use function Stancl\Tenancy\Tests\pest;
|
|
|
|
test('commands run globally are tenant aware and return valid exit code', function () {
|
|
$tenant1 = Tenant::create();
|
|
$tenant2 = Tenant::create();
|
|
Artisan::call('tenants:migrate', [
|
|
'--tenants' => [$tenant1['id'], $tenant2['id']],
|
|
]);
|
|
|
|
pest()->artisan('user:add')
|
|
->assertExitCode(0);
|
|
|
|
tenancy()->initialize($tenant1);
|
|
pest()->assertNotEmpty(DB::table('users')->get());
|
|
tenancy()->end();
|
|
|
|
tenancy()->initialize($tenant2);
|
|
pest()->assertNotEmpty(DB::table('users')->get());
|
|
tenancy()->end();
|
|
});
|