mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 12:54:05 +00:00
Improve early identification tests (#66)
* Separate route-level domain identification test from path/request to improve readability WIP * Get rid of confusing datasets in route-level identifcation tests * Clean up updated tests * Simplify early id tests * Reduce dataset duplication * Improve test readability, fix false positive, polish details * Separate early ID test from defaulting test (WIP) * Finish improving and correcting the early identification/default route mode tests * Make flag/default mode usage more clear by improving the docblock in DealsWithRouteContexts * Fix PHPUnit deprecation warnings * code review * code review --------- Co-authored-by: Samuel Štancl <samuel@archte.ch>
This commit is contained in:
parent
48b916e182
commit
cb0d7e2902
7 changed files with 248 additions and 147 deletions
|
|
@ -180,8 +180,8 @@ test('kernel PreventAccessFromUnwantedDomains does not get skipped when route le
|
|||
]);
|
||||
|
||||
test('placement of domain identification and access prevention middleware can get mixed', function (
|
||||
array $globalMiddleware,
|
||||
array $routeMiddleware,
|
||||
array $globalMiddleware,
|
||||
array $centralRouteMiddleware
|
||||
) {
|
||||
config([
|
||||
|
|
@ -214,16 +214,16 @@ test('placement of domain identification and access prevention middleware can ge
|
|||
expect(tenancy()->initialized)->toBeFalse();
|
||||
})->with([
|
||||
'route-level identification, kernel access prevention' => [
|
||||
'global_middleware' => [PreventAccessFromUnwantedDomains::class],
|
||||
'route_middleware' => [InitializeTenancyBySubdomain::class],
|
||||
[InitializeTenancyBySubdomain::class], // Route middleware
|
||||
[PreventAccessFromUnwantedDomains::class], // Global middleware
|
||||
],
|
||||
'kernel identification, kernel access prevention' => [
|
||||
'global_middleware' => [PreventAccessFromUnwantedDomains::class, InitializeTenancyBySubdomain::class],
|
||||
'route_middleware' => [],
|
||||
[], // Route middleware
|
||||
[PreventAccessFromUnwantedDomains::class, InitializeTenancyBySubdomain::class], // Global middleware
|
||||
],
|
||||
'route-level identification, route-level access prevention' => [
|
||||
'global_middleware' => [],
|
||||
'route_middleware' => [PreventAccessFromUnwantedDomains::class, InitializeTenancyBySubdomain::class],
|
||||
[PreventAccessFromUnwantedDomains::class, InitializeTenancyBySubdomain::class], // Route middleware
|
||||
[], // Global middleware
|
||||
],
|
||||
// Creates a matrix (multiple with())
|
||||
])->with([
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue