Skip to content

Commit 2a702c3

Browse files
committed
Improve comment
1 parent 2545203 commit 2a702c3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cookbook/testing/simulating_authentication.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ It could become an issue especially when ``form_login`` is used, since
99
it requires additional requests to fill in and submit the form.
1010

1111
One of the solutions is to configure your firewall to use ``http_basic`` in
12-
the test environment as explained in
13-
:doc:`/cookbook/testing/http_authentication`.
12+
the test environment as explained in :doc:`/cookbook/testing/http_authentication`.
1413
Another way would be to create a token yourself and store it in a session.
1514
While doing this, you have to make sure that an appropriate cookie is sent
1615
with a request. The following example demonstrates this technique::
@@ -45,7 +44,9 @@ with a request. The following example demonstrates this technique::
4544
{
4645
$session = $this->client->getContainer()->get('session');
4746

48-
$firewall = 'secured_area'; // put here firewalls context if defined
47+
// the firewall context (defaults to the firewall name)
48+
$firewall = 'secured_area';
49+
4950
$token = new UsernamePasswordToken('admin', null, $firewall, array('ROLE_ADMIN'));
5051
$session->set('_security_'.$firewall, serialize($token));
5152
$session->save();

0 commit comments

Comments
 (0)