Alt-rock ninja
Alt-rock ninja

Reputation: 165

Testing the router for invalid routes

I want to test all twig files, and controllers--basically everything that uses the Router to test the helper functions for invalid route calls.

Things such as {{ path('fails_right_here') }} and $controller->generateUrl('nope_again');

You could say that this belongs to the functional tests, which i got--but.. it doesnt make sense to write scenarios for every single link thats out there. It makes more sense to write one scenario that leads to editing a article for example, and all the other 10+ routes that lead to this same scenario to be automatically validated. Or else i need to write 100's of tests for something silly :)

Any way to do this currently?

Upvotes: 0

Views: 91

Answers (1)

Alessandro Lai
Alessandro Lai

Reputation: 2274

You don't need to test all the paths like that. Simply trying to render a link to a broken path in Twig will trigger an error, so you're already testing in just crawling any page that does that.

Upvotes: 1

Related Questions