简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM