问题
Whatever I do, I always get a
Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for [...]"
in $crawler->text()
, when I try to request an external URL with $crawler = $client->request('GET', 'http://anotherdomain.com');
.
I want to do that because I'm using another virtualHost to render some pages with Symfony 1.2 and some others with Symfony 2.3.
I also tried to
$client = static::createClient(array(), array('HTTP_HOST' => 'anotherdomain.com'));
$client->followRedirects(true);
But it's always trying to render it whithin Symfony 2.
回答1:
It's not possible, because $client
actually doesn't send any http request (you may notice that when you try run your "functional" test with www server disabled - they still should work). Instead of that it simulates http request and run normal Symfony's dispatching.
来源:https://stackoverflow.com/questions/17657544/symfony-2-functional-testing-external-url