From e7f44ea0032686db95401e5507f02e1eef617b67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Tue, 6 May 2014 16:30:11 +0200 Subject: [PATCH] document how to test actions --- components/routing/hostname_pattern.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/components/routing/hostname_pattern.rst b/components/routing/hostname_pattern.rst index 84be43861f8..5fa0a2621cd 100644 --- a/components/routing/hostname_pattern.rst +++ b/components/routing/hostname_pattern.rst @@ -282,3 +282,19 @@ You can also set the host option on imported routes: The host ``hello.example.com`` will be set on each route loaded from the new routing resource. + +Testing your Controllers +------------------------ + +You need to set the Host HTTP header on your request objects if you want to get +past url matching in your functional tests. + + .. code-block:: php + + $crawler = $client->request( + 'GET', + '/homepage', + array(), + array(), + array('HTTP_HOST' => 'm.' . $client->getContainer()->getParameter('domain')) + );