mirror of
https://github.com/archtechx/tenancy.git
synced 2026-05-06 16:24:03 +00:00
Add regression test for withoutPending
At the moment, `Tenant::withoutPending()->where('id', 'nonexistent-id')->first()` incorrectly returns the first non-pending tenant
This commit is contained in:
parent
c32f52ce7c
commit
f881203af8
1 changed files with 9 additions and 0 deletions
|
|
@ -111,6 +111,15 @@ test('a new tenant gets created while pulling a pending tenant if the pending po
|
||||||
expect(Tenant::withPending()->get()->count())->toBe(1); // All tenants
|
expect(Tenant::withPending()->get()->count())->toBe(1); // All tenants
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('withoutPending chained with where clauses returns correct results', function() {
|
||||||
|
$tenant = Tenant::create();
|
||||||
|
$pendingTenant = Tenant::createPending();
|
||||||
|
|
||||||
|
expect(Tenant::withoutPending()->where('id', $tenant->id)->first()->id)->toBe($tenant->id);
|
||||||
|
expect(Tenant::withoutPending()->where('id', 'nonexistent-id')->first())->toBeNull();
|
||||||
|
expect(Tenant::withoutPending()->where('id', $pendingTenant->id)->first())->toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
test('pending tenants are included in all queries based on the include_in_queries config', function () {
|
test('pending tenants are included in all queries based on the include_in_queries config', function () {
|
||||||
Tenant::createPending();
|
Tenant::createPending();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue