3

I have a lot of $this->redirect() in my controllers, issuing a Zend_Flashmessage and then redirecting. Due to the fact, that Zend_Test is disabling responses on redirect, I can't see an opportunity to verify my flash messages.

Is there a way to call the render() function in my unittest to verify the output?

Havelock
  • 6,913
  • 4
  • 34
  • 42
  • Try these liks. http://framework.zend.com/issues/browse/ZF-7455 and http://framework.zend.com/issues/browse/ZF-5619 – Jirilmon Jan 14 '13 at 10:49

1 Answers1

1

Do you really need to test that Zend Framework controller is working like it should? Or could you make your test case more specific by verifying that ->redirect() is called once, and that your flash message has been set (next paragraph). That way, you're trusting that Zend Controller will show the flash message, because that functionality is already tested by Zend.

I would recommend simply writing and calling a ->redirectWithMessage() method, that you can easily mock and verify. Leaving Zend functionality out of the test.