mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 20:14:04 +00:00
Fixing test WIP
This commit is contained in:
parent
fd254e6a45
commit
add92b99cc
1 changed files with 8 additions and 1 deletions
|
|
@ -8,7 +8,6 @@ use Stancl\Tenancy\Jobs\DeleteTenantsPostgresUser;
|
|||
use Stancl\Tenancy\Jobs\CreatePostgresUserForTenant;
|
||||
|
||||
beforeEach(function () {
|
||||
$this->mockConsoleOutput = false;
|
||||
DB::setDefaultConnection('pgsql');
|
||||
|
||||
config(['tenancy.models.tenant' => Tenant::class]);
|
||||
|
|
@ -53,6 +52,14 @@ test('correct rls policies get created using the command', function() {
|
|||
],
|
||||
]);
|
||||
|
||||
$tableExists = DB::selectOne('SELECT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_tables
|
||||
WHERE schemaname = ? AND tablename = ?
|
||||
) AS table_exists;', ['pg_catalog', 'pg_policies'])->table_exists;
|
||||
|
||||
dd($tableExists);
|
||||
|
||||
$getRlsPolicies = fn () => DB::select('select * from pg_policies');
|
||||
$getModelTables = fn () => collect(config('tenancy.models.rls'))->map(fn (string $model) => (new $model)->getTable());
|
||||
$getRlsTables = fn() => $getModelTables()->map(fn ($table) => DB::select('select relname, relrowsecurity, relforcerowsecurity from pg_class WHERE oid = ' . "'$table'::regclass"))->collapse();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue