Skip to content

Commit

Permalink
feature #3839 document how to test actions (greg0ire)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.3 branch.

Discussion
----------

document how to test actions

It is not so easy to find, and maybe there is a way to set this on a more global level, but this solution does the job.

Commits
-------

e7f44ea document how to test actions
  • Loading branch information
weaverryan committed May 12, 2014
2 parents d92c522 + e7f44ea commit 979533a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions components/routing/hostname_pattern.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
);

0 comments on commit 979533a

Please sign in to comment.