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

Issue Type: Bug Created: 2009-05-31T10:10:41.000+0000 Last Updated: 2010-03-23T11:26:28.000+0000 Status: Resolved Fix version(s): - 1.10.0 (27/Jan/10)

Reporter: Mark (lightflowmark) Assignee: Benjamin Eberlei (beberlei) Tags: - Zend_Controller

  • Zend_Test_PHPUnit

Related issues: Attachments:


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.


Posted by Benjamin Eberlei (beberlei) on 2009-09-18T01:04:20.000+0000

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

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

Posted by Benjamin Eberlei (beberlei) on 2009-09-18T01:09:32.000+0000

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

Posted by Thomas Bachmann (thobach) on 2010-03-23T11:26:27.000+0000

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;

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.