I am suspecting that there's a problem with Controller Plugins redirecting when used in Zend Test?
I have a controller plugin like http://pastie.org/1422639 I have put echo statements for debugging. I have code for redirecting to login if user is not logged in
if (!$auth->hasIdentity()) {
echo 'no id, ';
// redirect to login page
$req->setDispatched(true);
$redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');echo 'got redir, ';
$redirector->gotoUrl('/auth/login?returnUrl=' . urlencode($req->getRequestUri()));echo 'redirecting, ';
} ...
I find that when unit tesing, eg
$this->dispatch('/projects');
The output I got was
projects (ok I requested the projects page/controller), no id (ok, I am not logged in), got redir (I got the redirector ok), redirecting (it seem to be redirecting ok ...), error (but I got to the error controller) no resource,
the reason why I got to the error controller it seems is I still got to the projects/index page. in the index action, I assumed that the user is logged in. But when it tries to get the logged in user
$user = \Zend_Auth::getInstance()->getIdentity();
It fails ...
How can I have redirectors working in Zend Test? Or maybe its not a problem with redirectors?