>
> Use this as the assertion -- it'll give you more information:
>
> $this->assertRedirectTo('/auth/login',
> var_export($this->response->getHeaders()));
>
> That should show you what headers were actually set in the response
> object, and may give more insight into why the test is failing.
>
Thanks, this was definitely helpful, and here is what it is giving me:
array (
0 =>
array (
'name' => 'Location',
'value' => 'http://www.domain.com/auth/login',
'replace' => true,
),
)
If I switch my assertRedirectTo to this, it passes:
$this->assertRedirectTo('http://www.domain.com/auth/login');
I believe the domain is getting prepended to the redirect Location value
because I am setting baseUrl in a view helper:
$frontController->setBaseUrl($config->baseUrl);
If I set $config->baseUrl to empty, then assertRedirectTo('/auth/login')
passes as expected.
Just wanted to set the record straight in case someone else comes across
this issue. Thx for your help. :)
--
View this message in context: http://www.nabble.com/Zend_Test_PHPUnit---assertRedirectTo-failing-tp20693494p20712104.html
Sent from the Zend MVC mailing list archive at Nabble.com.
没有评论:
发表评论