1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-13 07:54:03 +00:00

Clean up global state (static properties) in before/afterEach

This commit is contained in:
lukinovec 2023-04-19 13:37:06 +02:00
parent 52d10d36f9
commit 53b2181779
5 changed files with 30 additions and 5 deletions

View file

@ -12,6 +12,8 @@ use Stancl\Tenancy\Middleware\InitializeTenancyByDomain;
use Stancl\Tenancy\Resolvers\DomainTenantResolver;
beforeEach(function () {
InitializeTenancyByDomain::$onFail = null;
Route::group([
'middleware' => InitializeTenancyByDomain::class,
], function () {
@ -23,6 +25,10 @@ beforeEach(function () {
config(['tenancy.models.tenant' => DomainTenant::class]);
});
afterEach(function () {
InitializeTenancyByDomain::$onFail = null;
});
test('tenant can be identified using hostname', function () {
$tenant = DomainTenant::create();
@ -89,9 +95,6 @@ test('onfail logic can be customized', function () {
});
test('throw correct exception when onFail is null and universal routes are enabled', function () {
// un-define onFail logic
InitializeTenancyByDomain::$onFail = null;
// Enable UniversalRoute feature
Route::middlewareGroup('universal', []);