Skip to content

Add routing tests for nested module-relative middleware resolution #547

Description

@armanist

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    routingRouting and route resolutiontesting

    Type

    No fields configured for Task.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions