1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 19:54:04 +00:00

Add maintenance mode events

This commit is contained in:
j.stein 2022-10-17 11:24:22 -04:00
parent 6ee93d0441
commit b855f257c4
5 changed files with 43 additions and 0 deletions

View file

@ -3,6 +3,7 @@
declare(strict_types=1);
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Event;
use Stancl\Tenancy\Database\Concerns\MaintenanceMode;
use Illuminate\Support\Facades\Route;
use Stancl\Tenancy\Middleware\CheckTenantForMaintenanceMode;
@ -32,6 +33,20 @@ test('tenants can be in maintenance mode', function () {
pest()->get('http://acme.localhost/foo')->assertStatus(200);
});
test('maintenance mode events are fired', function () {
$tenant = MaintenanceTenant::create();
Event::fake();
$tenant->putDownForMaintenance();
Event::assertDispatched(\Stancl\Tenancy\Events\TenantMaintenanceModeEnabled::class);
$tenant->bringUpFromMaintenance();
Event::assertDispatched(\Stancl\Tenancy\Events\TenantMaintenanceModeDisabled::class);
});
test('tenants can be put into maintenance mode using artisan commands', function() {
Route::get('/foo', function () {
return 'bar';