1

如何在 symfony 2 上运行没有虚拟主机的控制器测试?我的项目在网络根目录“http://localhost/Symfony/web/”下

public function testIndex() {
    $client = static::createClient();
    $crawler = $client->request('GET', '/home');
    $this->assertTrue($client->getResponse()->getStatusCode() == '200');
    $this->assertTrue($crawler->filter('title:contains("MyTitle")')->count() > 0);
}

上面的测试尝试请求“http://localhost/home”,我尝试将请求更改为完整的 url,但它还不起作用

有谁知道我该如何解决?

4

0 回答 0