phoenixframework / phoenix

Peace of mind from prototype to production
https://www.phoenixframework.org
MIT License
21.23k stars 2.86k forks source link

No way to override the default router for Unit Tests #5903

Open kevinkirkup opened 1 month ago

kevinkirkup commented 1 month ago

Environment

Actual behavior

When unit testing controllers that use match to redirect requests to a custom router, the unit tests still reference the main Application Router and return 404.

I've been able to override the default router behavior for Verified Routes using

  use Phoenix.VerifiedRoutes,
    router: AppWeb.Admin.Router,
    endpoint: AppWeb.Endpoint

Expected behavior

The Router should redirect requests to the correct Router, or be able to override the router in the CaseTemplate setup.

josevalim commented 1 month ago

Controllers do requests through the endpoint. The router does not matter. Or please provide more context on what you are trying to achieve, but none of those should be hardcoded.