mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-04 21:14:02 +00:00
Add basic model discovery test
This commit is contained in:
parent
5cb3b5f4c1
commit
1ce18d2759
1 changed files with 12 additions and 0 deletions
|
|
@ -229,6 +229,18 @@ test('users created by CreatePostgresUserForTenant are only granted the permissi
|
||||||
->not()->toContain('DELETE');
|
->not()->toContain('DELETE');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('model discovery gets the models correctly', function() {
|
||||||
|
// 'tenancy.rls.model_directories' is set to [__DIR__ . '/Etc'] in beforeEach
|
||||||
|
// Check that the Post and ScopedComment models are found in the directory
|
||||||
|
$expectedModels = [Post::class, ScopedComment::class];
|
||||||
|
|
||||||
|
$foundModels = tenancy()->getModels()->where(function (Model $model) use ($expectedModels) {
|
||||||
|
return in_array($model::class, $expectedModels);
|
||||||
|
});
|
||||||
|
|
||||||
|
expect($foundModels)->toHaveCount(count($expectedModels));
|
||||||
|
});
|
||||||
|
|
||||||
trait UsesUuidAsPrimaryKey
|
trait UsesUuidAsPrimaryKey
|
||||||
{
|
{
|
||||||
use HasUuids;
|
use HasUuids;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue