Add routing tests for nested module-relative middleware resolution
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Start by reading src/Middleware/MiddlewareManager.php, src/Router/Route.php, and src/Router/RouteBuilder.php to trace module-relative middleware resolution. Inspect the module template middleware paths under src/Module/Templates/*/src/Middlewares, then add routing tests for Auth, V1\Auth, and Admin\Audit. Done means the tests confirm flat, nested, and deeper nested middleware names resolve within the current module.
Written by the indexing model from the issue text.
Description
Summary
Add test coverage to confirm that middleware route strings are resolved relative to the current module’s Middlewares namespace, including nested middleware paths.
This is a verification ticket to lock in current middleware resolution behavior.
Why
Middleware resolution in Quantum already appears to support nested module-relative middleware paths.
Current middleware resolution constructs middleware classes as:
{ModuleBaseNamespace}\{CurrentModule}\Middlewares\{MiddlewareName}
That means route middleware strings such as:
AuthV1\AuthAdmin\Audit
should already resolve correctly within the current module.
Since this behavior is important for future routing organization and may become especially relevant alongside controller namespace improvements and API versioning work, it should be covered by explicit tests.
Goal
Add tests that verify middleware resolution for both flat and nested module-relative middleware paths.
Proposed Direction
Test middleware route definitions such as:
->middlewares(['Auth'])->middlewares(['V1\Auth'])->middlewares(['Admin\Audit'])
and verify that Quantum resolves them to the expected middleware classes inside the current module.
Acceptance Criteria
- tests verify flat middleware resolution inside the current module
- tests verify nested middleware resolution such as
V1\Auth - tests verify deeper nested middleware resolution such as
Admin\Audit - tests confirm middleware resolution remains module-relative
- tests help protect current behavior while controller resolution and API versioning work evolve
Notes
Relevant code:
src/Middleware/MiddlewareManager.phpsrc/Router/Route.phpsrc/Router/RouteBuilder.php- module template middlewares under
src/Module/Templates/*/src/Middlewares
This ticket is intended as verification coverage, not as a middleware architecture change.
- Dominant language
- PHP
- Stars
- 36
- Forks
- 22
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from quantum-php/framework
-
view
Difficulty 1/5 Under an hour Newbie friendliness 75/100
quantum-php/framework#542 ·
-
enhancement http
Difficulty 5/5 Over a week Newbie friendliness 35/100
quantum-php/framework#565 · 1 comment ·
-
components view
Difficulty 5/5 Over a week Newbie friendliness 42/100
quantum-php/framework#551 ·
-
Add explicit @version special route token support for API major versioning within a single module Openrouting
Difficulty 5/5 Over a week Newbie friendliness 45/100
quantum-php/framework#550 ·
-
lang routing
Difficulty 5/5 Over a week Newbie friendliness 45/100
quantum-php/framework#549 ·
All issues in quantum-php/framework
Similar issues
-
priority: p3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
googleapis/librarian#7636 ·
-
0. Needs triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nextcloud/fulltextsearch#1011 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
phpstan/phpstan-doctrine#794 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Automattic/static-site-importer#1767 ·