Skip to content

Commit 2946e29

Browse files
author
kevin
committed
Add missing parameter
The file array was missing
1 parent 6e69f44 commit 2946e29

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed
Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
1-
.. index::
2-
single: Tests; HTTP authentication
3-
4-
How to simulate HTTP Authentication in a Functional Test
5-
========================================================
6-
7-
If your application needs HTTP authentication, pass the username and password
8-
as server variables to ``createClient()``::
9-
10-
$client = static::createClient(array(), array(
11-
'PHP_AUTH_USER' => 'username',
12-
'PHP_AUTH_PW' => 'pa$$word',
13-
));
14-
15-
You can also override it on a per request basis::
16-
17-
$client->request('DELETE', '/post/12', array(), array(
18-
'PHP_AUTH_USER' => 'username',
19-
'PHP_AUTH_PW' => 'pa$$word',
20-
));
21-
22-
When your application is using a ``form_login``, you can simplify your tests
23-
by allowing your test configuration to make use of HTTP authentication. This
24-
way you can use the above to authenticate in tests, but still have your users
25-
login via the normal ``form_login``. The trick is to include the ``http_basic``
26-
key in your firewall, along with the ``form_login`` key:
27-
28-
.. configuration-block::
29-
30-
.. code-block:: yaml
31-
32-
# app/config/config_test.yml
33-
security:
34-
firewalls:
35-
your_firewall_name:
36-
http_basic:
1+
.. index::
2+
single: Tests; HTTP authentication
3+
4+
How to simulate HTTP Authentication in a Functional Test
5+
========================================================
6+
7+
If your application needs HTTP authentication, pass the username and password
8+
as server variables to ``createClient()``::
9+
10+
$client = static::createClient(array(), array(
11+
'PHP_AUTH_USER' => 'username',
12+
'PHP_AUTH_PW' => 'pa$$word',
13+
));
14+
15+
You can also override it on a per request basis::
16+
17+
$client->request('DELETE', '/post/12', array(), array(), array(
18+
'PHP_AUTH_USER' => 'username',
19+
'PHP_AUTH_PW' => 'pa$$word',
20+
));
21+
22+
When your application is using a ``form_login``, you can simplify your tests
23+
by allowing your test configuration to make use of HTTP authentication. This
24+
way you can use the above to authenticate in tests, but still have your users
25+
login via the normal ``form_login``. The trick is to include the ``http_basic``
26+
key in your firewall, along with the ``form_login`` key:
27+
28+
.. configuration-block::
29+
30+
.. code-block:: yaml
31+
32+
# app/config/config_test.yml
33+
security:
34+
firewalls:
35+
your_firewall_name:
36+
http_basic:

0 commit comments

Comments
 (0)