mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 18:54:03 +00:00
throw correct exception when $originalOnFail() is null
This commit is contained in:
parent
8fb3eb0abd
commit
17fecf29a1
2 changed files with 17 additions and 1 deletions
|
|
@ -30,7 +30,11 @@ class UniversalRoutes implements Feature
|
|||
return $next($request);
|
||||
}
|
||||
|
||||
return $originalOnFail($exception, $request, $next);
|
||||
if ($originalOnFail) {
|
||||
return $originalOnFail($exception, $request, $next);
|
||||
}
|
||||
|
||||
throw $exception;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,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;
|
||||
|
||||
|
|
@ -105,6 +106,17 @@ class DomainTest extends TestCase
|
|||
->assertSee('foo');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function not_defining_onfail_customized_logic_throw_correct_exception_when_universal_route_feature_enabled()
|
||||
{
|
||||
// Enable UniversalRoute feature
|
||||
Route::middlewareGroup('universal', []);
|
||||
config(['tenancy.features' => [UniversalRoutes::class]]);
|
||||
|
||||
$this->expectException(TenantCouldNotBeIdentifiedOnDomainException::class);
|
||||
$this->withoutExceptionHandling()->get('http://foo.localhost/foo/abc/xyz');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function domains_are_always_lowercase()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue