From 0f7ab8a3680dd06e7566dffde69264d3e364026c Mon Sep 17 00:00:00 2001 From: Abrar Ahmad Date: Mon, 25 Jul 2022 10:44:59 +0500 Subject: [PATCH] convert test to pest and renamed --- tests/DomainTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/DomainTest.php b/tests/DomainTest.php index 006faef9..f1473949 100644 --- a/tests/DomainTest.php +++ b/tests/DomainTest.php @@ -8,6 +8,7 @@ use Stancl\Tenancy\Database\Models; use Stancl\Tenancy\Database\Models\Domain; use Stancl\Tenancy\Exceptions\DomainOccupiedByOtherTenantException; use Stancl\Tenancy\Exceptions\TenantCouldNotBeIdentifiedOnDomainException; +use Stancl\Tenancy\Features\UniversalRoutes; use Stancl\Tenancy\Middleware\InitializeTenancyByDomain; use Stancl\Tenancy\Resolvers\DomainTenantResolver; @@ -88,6 +89,17 @@ test('onfail logic can be customized', function () { ->assertSee('foo'); }); +test('throw correct exception when onFail is null and universal route is enabled', function () { + // un-define onFail logic + InitializeTenancyByDomain::$onFail = null; + + // Enable UniversalRoute feature + Route::middlewareGroup('universal', []); + config(['tenancy.features' => [UniversalRoutes::class]]); + + $this->withoutExceptionHandling()->get('http://foo.localhost/foo/abc/xyz'); +})->throws(TenantCouldNotBeIdentifiedOnDomainException::class);; + test('domains are always lowercase', function () { $tenant = DomainTenant::create();