zendframework / zend-test

Test component from Zend Framework
BSD 3-Clause "New" or "Revised" License
18 stars 38 forks source link

New method: assertRedirectToRoute for more robust redirect checks in tests #68

Open koseduhemak opened 6 years ago

koseduhemak commented 6 years ago

Would it be nice to have a new assertRedirectToRoute method for easier checking of redirects? In opposite to assertRedirectTo, the new method would be more robust due to changes in the routes of the application to test.

F.e. if I change the URI in one of the routes (my-route) of my application from /foo/bar/baz to /foo-foo/bar-bar/baz-baz, I would have to modify my test case too:

...
$this->assertRedirectTo('/foo/bar/baz');
...

to

...
$this->assertRedirectTo('/foo-foo/bar-bar/baz-baz');
...

With the new method:

...
$this->assertRedirectToRoute('my-route');
...

What do you think? I could make a pull-request for that if you would accept my proposal.

weierophinney commented 4 years ago

This repository has been closed and moved to laminas/laminas-test; a new issue has been opened at https://github.com/laminas/laminas-test/issues/2.