mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 12:54:05 +00:00
Add maintenance mode events (#979)
This commit is contained in:
parent
080b271bb3
commit
3f60c4a652
5 changed files with 43 additions and 0 deletions
|
|
@ -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';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue