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

convert test to pest and renamed

This commit is contained in:
Abrar Ahmad 2022-07-25 10:44:59 +05:00
parent 4714143dde
commit 0f7ab8a368

View file

@ -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();