1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 11:14:04 +00:00

Refactor tests to use pest() helper

This commit is contained in:
Samuel Štancl 2022-07-23 01:16:50 +02:00
parent 05f2a828a1
commit f9c9d8615f
26 changed files with 128 additions and 127 deletions

View file

@ -32,7 +32,7 @@ test('the underlying resolver is not touched when using the cached resolver', fu
expect($tenant->is(app(DomainTenantResolver::class)->resolve('acme')))->toBeTrue();
DB::flushQueryLog();
expect($tenant->is(app(DomainTenantResolver::class)->resolve('acme')))->toBeTrue();
$this->assertNotEmpty(DB::getQueryLog()); // not empty
pest()->assertNotEmpty(DB::getQueryLog()); // not empty
DomainTenantResolver::$shouldCache = true;
@ -63,7 +63,7 @@ test('cache is invalidated when the tenant is updated', function () {
DB::flushQueryLog();
expect($tenant->is(app(DomainTenantResolver::class)->resolve('acme')))->toBeTrue();
$this->assertNotEmpty(DB::getQueryLog()); // not empty
pest()->assertNotEmpty(DB::getQueryLog()); // not empty
});
test('cache is invalidated when a tenants domain is changed', function () {
@ -87,9 +87,9 @@ test('cache is invalidated when a tenants domain is changed', function () {
DB::flushQueryLog();
expect($tenant->is(app(DomainTenantResolver::class)->resolve('acme')))->toBeTrue();
$this->assertNotEmpty(DB::getQueryLog()); // not empty
pest()->assertNotEmpty(DB::getQueryLog()); // not empty
DB::flushQueryLog();
expect($tenant->is(app(DomainTenantResolver::class)->resolve('bar')))->toBeTrue();
$this->assertNotEmpty(DB::getQueryLog()); // not empty
pest()->assertNotEmpty(DB::getQueryLog()); // not empty
});