【发布时间】:2013-12-29 17:25:40
【问题描述】:
我正在尝试在我的单元测试代码中测试重定向。控制器代码是:
public function redirection() {
$this->redirect(array('action' => 'index'));
return ;
}
测试代码是:
public function testRedirection() {
$return_var = $this->testAction('/users/redirection', array('return'=>'vars'));
$results = $this->headers['Location'];
var_dump( $this->headers['Location']);
}
和输出:
string(55) "http://localhost/var/www/html/cakephp/app/Console/users"
我的问题是如何摆脱整个字符串“var/www/html/cakephp/app/Console”,其次为什么它没有'index'?
【问题讨论】:
标签: php unit-testing cakephp phpunit