2008年11月25日星期二

[fw-mvc] Zend_Test_PHPUnit - assertRedirectTo failing

I am using Zend_Test_PHPUnit and it is great for testing MVC, but I have come
across a problem with assertRedirectTo failing for no known reason.
assertRedirect works, but as soon as I check that it is redirecting to the
proper place with assertRedirectTo, my unit test is failing.


Here is my controller code:

class AuthController extends Zend_Controller_Action
{
public function indexAction()
{
$this->_redirect('/auth/login');
}

public function loginAction()
{
... some code here...
}
}


And here is my unit test:

public function testCallWithoutActionShouldForwardToLoginAction()
{
$this->dispatch('/auth');
//$this->assertRedirect(); // this test passes
$this->assertRedirectTo('/auth/login'); // this test fails
}


Note that if I use $this->assertRedirect(), the unit test passes. It is
only when I use assertRedirectTo() that it fails. Any ideas? I've been
racking my brain on this for hours... Thx in advance. :)
--
View this message in context: http://www.nabble.com/Zend_Test_PHPUnit---assertRedirectTo-failing-tp20693494p20693494.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: