1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 23:24:03 +00:00

Add readied events

This commit is contained in:
j.stein 2022-01-18 18:19:40 +01:00
parent f487f92f0d
commit 30f0a2b134
7 changed files with 80 additions and 1 deletions

View file

@ -5,8 +5,13 @@ declare(strict_types=1);
namespace Stancl\Tenancy\Tests;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Event;
use Stancl\Tenancy\Commands\ClearReadiedTenants;
use Stancl\Tenancy\Commands\CreateReadiedTenants;
use Stancl\Tenancy\Events\PullingReadiedTenant;
use Stancl\Tenancy\Events\ReadiedTenantPulled;
use Stancl\Tenancy\Events\ReadyingTenant;
use Stancl\Tenancy\Events\TenantReadied;
use Stancl\Tenancy\Tests\Etc\Tenant;
class ReadiedTenantsTest extends TestCase
@ -127,4 +132,25 @@ class ReadiedTenantsTest extends TestCase
$this->assertCount(1, Tenant::all());
Tenant::all();
}
/** @test */
public function readied_events_are_triggerred()
{
Event::fake([
ReadyingTenant::class,
TenantReadied::class,
PullingReadiedTenant::class,
ReadiedTenantPulled::class,
]);
Tenant::createReadied();
Event::assertDispatched(ReadyingTenant::class);
Event::assertDispatched(TenantReadied::class);
Tenant::pullReadiedTenant();
Event::assertDispatched(PullingReadiedTenant::class);
Event::assertDispatched(ReadiedTenantPulled::class);
}
}