1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-05-06 17:04:04 +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:
lukinovec 2026-04-22 13:01:19 +02:00
parent c32f52ce7c
commit f881203af8

View file

@ -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
});
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 () {
Tenant::createPending();