mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 22:44:05 +00:00
Convert newly added tests to Pest
This commit is contained in:
parent
ea0b44522d
commit
9faa217281
2 changed files with 18 additions and 29 deletions
|
|
@ -16,8 +16,7 @@ test('tenants can be resolved using the cached resolver', function () {
|
||||||
'domain' => 'acme',
|
'domain' => 'acme',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
expect($tenant->is(app(DomainTenantResolver::class)->resolve('acme')))->toBeTrue();
|
expect($tenant->is(app(DomainTenantResolver::class)->resolve('acme')))->toBeTrue()->toBeTrue();
|
||||||
expect($tenant->is(app(DomainTenantResolver::class)->resolve('acme')))->toBeTrue();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('the underlying resolver is not touched when using the cached resolver', function () {
|
test('the underlying resolver is not touched when using the cached resolver', function () {
|
||||||
|
|
|
||||||
|
|
@ -2,41 +2,31 @@
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Stancl\Tenancy\Tests;
|
|
||||||
|
|
||||||
use Stancl\Tenancy\Database\Concerns\HasDomains;
|
use Stancl\Tenancy\Database\Concerns\HasDomains;
|
||||||
use Stancl\Tenancy\Jobs\DeleteDomains;
|
use Stancl\Tenancy\Jobs\DeleteDomains;
|
||||||
|
|
||||||
class DeleteDomainsJobTest extends TestCase
|
beforeEach(function () {
|
||||||
{
|
config(['tenancy.tenant_model' => DatabaseAndDomainTenant::class]);
|
||||||
public function setUp(): void
|
});
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
config(['tenancy.tenant_model' => DatabaseAndDomainTenant::class]);
|
test('job delete domains successfully', function (){
|
||||||
}
|
$tenant = DatabaseAndDomainTenant::create();
|
||||||
|
|
||||||
/** @test */
|
$tenant->domains()->create([
|
||||||
public function job_delete_domains_successfully()
|
'domain' => 'foo.localhost',
|
||||||
{
|
]);
|
||||||
$tenant = DatabaseAndDomainTenant::create();
|
$tenant->domains()->create([
|
||||||
|
'domain' => 'bar.localhost',
|
||||||
|
]);
|
||||||
|
|
||||||
$tenant->domains()->create([
|
expect($tenant->domains()->count())->toBe(2);
|
||||||
'domain' => 'foo.localhost',
|
|
||||||
]);
|
|
||||||
$tenant->domains()->create([
|
|
||||||
'domain' => 'bar.localhost',
|
|
||||||
]);
|
|
||||||
|
|
||||||
$this->assertSame($tenant->domains()->count(), 2);
|
(new DeleteDomains($tenant))->handle();
|
||||||
|
|
||||||
(new DeleteDomains($tenant))->handle();
|
expect($tenant->refresh()->domains()->count())->toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
$this->assertSame($tenant->refresh()->domains()->count(), 0);
|
class DatabaseAndDomainTenant extends \Stancl\Tenancy\Tests\Etc\Tenant
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class DatabaseAndDomainTenant extends Etc\Tenant
|
|
||||||
{
|
{
|
||||||
use HasDomains;
|
use HasDomains;
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue