mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 12:44:02 +00:00
tests added
This commit is contained in:
parent
14fe3c71c1
commit
276d44ac04
1 changed files with 11 additions and 0 deletions
|
|
@ -4,6 +4,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace Stancl\Tenancy\Tests;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Stancl\Tenancy\Events\TenantGoingInMaintenanceMode;
|
||||
use Stancl\Tenancy\Events\TenantWentInMaintenanceMode;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Illuminate\Foundation\Http\Exceptions\MaintenanceModeException;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
|
@ -18,6 +21,8 @@ class MaintenanceModeTest extends TestCase
|
|||
/** @test */
|
||||
public function tenant_can_be_in_maintenance_mode()
|
||||
{
|
||||
Event::fake([TenantGoingInMaintenanceMode::class, TenantWentInMaintenanceMode::class]);
|
||||
|
||||
Route::get('/foo', function () {
|
||||
return 'bar';
|
||||
})->middleware([InitializeTenancyByDomain::class, CheckTenantForMaintenanceMode::class]);
|
||||
|
|
@ -32,8 +37,14 @@ class MaintenanceModeTest extends TestCase
|
|||
|
||||
tenancy()->end(); // flush stored tenant instance
|
||||
|
||||
Event::assertNotDispatched(TenantGoingInMaintenanceMode::class);
|
||||
Event::assertNotDispatched(TenantWentInMaintenanceMode::class);
|
||||
|
||||
$tenant->putDownForMaintenance();
|
||||
|
||||
Event::assertDispatched(TenantGoingInMaintenanceMode::class);
|
||||
Event::assertDispatched(TenantWentInMaintenanceMode::class);
|
||||
|
||||
$this->expectException(HttpException::class);
|
||||
$this->withoutExceptionHandling()
|
||||
->get('http://acme.localhost/foo');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue