";什么都不牵强”;在本地主机上运行PHP SimpleTest时返回


"Nothing fetched" returned when running PHP SimpleTest on my localhost

我正试图使用SimpleTest在项目上运行一组测试,当在本地主机上运行测试时,我总是得到"Nothing fetched",但当在远程服务器上运行这些测试时,它完全可以工作。

我在我的机器和服务器Fedora 16和Nginx上都使用,我使用命令行报告程序来运行这些测试。

已修复!我所要做的就是在simpletest/user_agent.php中增加DEFAULT_CONNECTION_TIMEOUT,因为某种原因,我的本地主机比远程服务器慢。

使用WebTestCase类的方法setConnectionTimeout()。它旨在用于这些目的。您可以在get()方法之前调用它来设置套接字超时。

例如:

class ContinuousTestCase extends WebTestCase {
    function testSuccess() {
        $this->setConnectionTimeout(300);  // takes about 5 minutes
        $this->assertTrue($this->get('http://localhost/continuous.php'));
    }
}