Hello, 
From my experience with Zend_Test, this is the default behavior. Because the 
Redirector helper uses by default an exit command, that will block the rest of 
the tests to run.
More details here http://framework.zend.com/manual/en/zend.test.phpunit.html, 
the section Controller Tests and the Redirector Action Helper

Gabriel

-----Original Message-----
From: "Fernando Marcelo" <[email protected]>
Sent: Saturday, February 26, 2011 11:01am
To: "Zend Framework" <[email protected]>
Subject: [fw-general] Zend Test failing on AssertRedirectTo

Hi,

I'm having a problem with a simple test on Zend Test. My issue is specifically 
with this test which keeps failing:

        public function testAclForGuests()
        {
                $this->dispatch('/websites');
                $this->assertRedirectTo('/login', 
var_dump($this->response->getHeaders()));
        }

When i run, i get the following var_dump:

array(1) {
  [1]=>
  array(3) {
    ["name"]=>
    string(8) "Location"
    ["value"]=>
    string(6) "/login"
    ["replace"]=>
    bool(true)
  }
}

As you can see, the redirect is happening to /login. After digging into 
Zend_Test_PHPUnit_Constraint_Redirect i found that the problem is on line 212:

        if (!$response->isRedirect()) {
            return false;
        }

Why would isRedirect() return false if, based on headers, it's clearly a 
redirect?

Regards,

Fernando Morgenstern
[email protected]






Reply via email to