ZF-6870: Zend_Test fails silently when using Zend_Controller_Action_Helper_Redirector::gotoRouteAndExit

Description

Trying to test a controller action which uses the gotoRouteAndExit function of the redirector helper results in the test exiting silently; you are therefore unable to run any assertions after dispatch.

Not sure if this is a bug at all, or if it is whether it's in PHPUnit or ZF.

Further, I'm not sure of the utility of gotoRouteAndExit over gotoRoute - I probably shouldn't have been using it at all, frankly! It would be nice to have this documented.

Comments

gotoRouteAndExit() does that what it states, it calls exit()!

You can't use that method if you want to test your code.

This is a documentation issue, i have added a highlighted paragraph into the Zend Test documentation on this issue.

The same problem occurs everywhere in Zend Framework when 'exit();' is called. There should also be notices in the documentation for that classes: $ grep -R "exit();" * Zend/Controller/Action/Helper/Redirector.php: exit(); Zend/OpenId.php: exit();

$ grep -R "exit;" * Zend/Controller/Action/Helper/AutoComplete/Abstract.php: exit; Zend/Controller/Action/Helper/Json.php: exit; ignore Zend/Controller/Action/Helper/Redirector.php: return $this->_exit; *ignore* Zend/Feed/Reader/Extension/Atom/Entry.php: //var_dump($content); exit; Zend/ProgressBar/Adapter/JsPull.php: exit; ZendX/Console/Process/Unix.php: exit;