mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 20:34:03 +00:00
tests for DeleteDomains job
This commit is contained in:
parent
f0c3943175
commit
b0eab6a781
1 changed files with 42 additions and 0 deletions
42
tests/DeleteDomainsJobTest.php
Normal file
42
tests/DeleteDomainsJobTest.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Stancl\Tenancy\Tests;
|
||||
|
||||
use Stancl\Tenancy\Database\Concerns\HasDomains;
|
||||
use Stancl\Tenancy\Jobs\DeleteDomains;
|
||||
|
||||
class DeleteDomainsJobTest extends TestCase
|
||||
{
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
config(['tenancy.tenant_model' => DatabaseAndDomainTenant::class]);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function job_delete_domains_successfully()
|
||||
{
|
||||
$tenant = DatabaseAndDomainTenant::create();
|
||||
|
||||
$tenant->domains()->create([
|
||||
'domain' => 'foo.localhost',
|
||||
]);
|
||||
$tenant->domains()->create([
|
||||
'domain' => 'bar.localhost',
|
||||
]);
|
||||
|
||||
$this->assertSame($tenant->domains()->count(), 2);
|
||||
|
||||
(new DeleteDomains($tenant))->handle();
|
||||
|
||||
$this->assertSame($tenant->refresh()->domains()->count(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
class DatabaseAndDomainTenant extends Etc\Tenant
|
||||
{
|
||||
use HasDomains;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue