我们在 CakePHP 2.6.x 应用程序中设置了 PHPUnit 测试设置,但每次运行示例测试时 testAction 都会抛出此错误:
UsersControllerTest::testLogin
Undefined index: SERVER_PORT
对于这个单元测试:
public function testLogin()
{
$result = $this->testAction( '/users/login' );
...
debug( $result );
}
有谁知道错过了什么?正在测试的文档中没有提到 SERVER_PORT。