quantum-php / quantum-php/framework

Add routing tests for nested module-relative middleware resolution

Open Beginner friendly
#547 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

routing testing
Dominant language
PHP
Stars
36
Forks
22
PR merge metrics
No merged PRs in 30d

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:

  • Auth
  • V1\Auth
  • Admin\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.php
  • src/Router/Route.php
  • src/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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

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.

Assessment

Tech stack
php
Domain
backend, testing
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.