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

Resolve test to-dos (#45)

* Only retrieve domains if the relationship and the domains table exist (DomianTenantResolver)

* Resolve todo, add other todos

* Use constructor promotion in DeleteDomains

* Fix imports + domain deletion test

* Confirm that turning on resolver caching doesn't break the tests

* Fix Tenant model imports

* Fix code style (php-cs-fixer)

* remove runtime schema check

* temp: enable resolver cache

* make 'autoincrement ids are supported' pass

* disable resolver cache

---------

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
Co-authored-by: Samuel Štancl <samuel@archte.ch>
This commit is contained in:
lukinovec 2024-04-18 00:22:03 +02:00 committed by GitHub
parent 3e441e075f
commit 6e67ddf7a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 85 additions and 80 deletions

View file

@ -2,15 +2,15 @@
declare(strict_types=1);
use Stancl\Tenancy\Database\Concerns\HasDomains;
use Stancl\Tenancy\Tests\Etc\Tenant;
use Stancl\Tenancy\Jobs\DeleteDomains;
beforeEach(function () {
config(['tenancy.models.tenant' => DatabaseAndDomainTenant::class]);
config(['tenancy.models.tenant' => Tenant::class]);
});
test('job deletes domains successfully', function () {
$tenant = DatabaseAndDomainTenant::create();
$tenant = Tenant::create();
$tenant->domains()->create([
'domain' => 'foo.localhost',
@ -21,12 +21,7 @@ test('job deletes domains successfully', function () {
expect($tenant->domains()->count())->toBe(2);
(new DeleteDomains($tenant))->handle();
(new DeleteDomains($tenant->refresh()))->handle();
expect($tenant->refresh()->domains()->count())->toBe(0);
});
class DatabaseAndDomainTenant extends \Stancl\Tenancy\Tests\Etc\Tenant
{
use HasDomains;
}