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:
parent
52d10d36f9
commit
53b2181779
5 changed files with 30 additions and 5 deletions
|
|
@ -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', []);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue