From 2946e29b719ca189e89a8cabccb3b7da7e862624 Mon Sep 17 00:00:00 2001 From: kevin Date: Sun, 14 Oct 2012 20:03:44 +0200 Subject: [PATCH 1/2] Add missing parameter The file array was missing --- cookbook/testing/http_authentication.rst | 72 ++++++++++++------------ 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/cookbook/testing/http_authentication.rst b/cookbook/testing/http_authentication.rst index b1d10caadd0..53a61faf118 100644 --- a/cookbook/testing/http_authentication.rst +++ b/cookbook/testing/http_authentication.rst @@ -1,36 +1,36 @@ -.. index:: - single: Tests; HTTP authentication - -How to simulate HTTP Authentication in a Functional Test -======================================================== - -If your application needs HTTP authentication, pass the username and password -as server variables to ``createClient()``:: - - $client = static::createClient(array(), array( - 'PHP_AUTH_USER' => 'username', - 'PHP_AUTH_PW' => 'pa$$word', - )); - -You can also override it on a per request basis:: - - $client->request('DELETE', '/post/12', array(), array( - 'PHP_AUTH_USER' => 'username', - 'PHP_AUTH_PW' => 'pa$$word', - )); - -When your application is using a ``form_login``, you can simplify your tests -by allowing your test configuration to make use of HTTP authentication. This -way you can use the above to authenticate in tests, but still have your users -login via the normal ``form_login``. The trick is to include the ``http_basic`` -key in your firewall, along with the ``form_login`` key: - -.. configuration-block:: - - .. code-block:: yaml - - # app/config/config_test.yml - security: - firewalls: - your_firewall_name: - http_basic: +.. index:: + single: Tests; HTTP authentication + +How to simulate HTTP Authentication in a Functional Test +======================================================== + +If your application needs HTTP authentication, pass the username and password +as server variables to ``createClient()``:: + + $client = static::createClient(array(), array( + 'PHP_AUTH_USER' => 'username', + 'PHP_AUTH_PW' => 'pa$$word', + )); + +You can also override it on a per request basis:: + + $client->request('DELETE', '/post/12', array(), array(), array( + 'PHP_AUTH_USER' => 'username', + 'PHP_AUTH_PW' => 'pa$$word', + )); + +When your application is using a ``form_login``, you can simplify your tests +by allowing your test configuration to make use of HTTP authentication. This +way you can use the above to authenticate in tests, but still have your users +login via the normal ``form_login``. The trick is to include the ``http_basic`` +key in your firewall, along with the ``form_login`` key: + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/config_test.yml + security: + firewalls: + your_firewall_name: + http_basic: From fee09dd788194026d5d8ece41250b49540d0a871 Mon Sep 17 00:00:00 2001 From: martinqt Date: Thu, 18 Oct 2012 20:40:58 +0200 Subject: [PATCH 2/2] Convert eol to LF Thanks to stof --- cookbook/testing/http_authentication.rst | 72 ++++++++++++------------ 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/cookbook/testing/http_authentication.rst b/cookbook/testing/http_authentication.rst index 53a61faf118..84249fdf458 100644 --- a/cookbook/testing/http_authentication.rst +++ b/cookbook/testing/http_authentication.rst @@ -1,36 +1,36 @@ -.. index:: - single: Tests; HTTP authentication - -How to simulate HTTP Authentication in a Functional Test -======================================================== - -If your application needs HTTP authentication, pass the username and password -as server variables to ``createClient()``:: - - $client = static::createClient(array(), array( - 'PHP_AUTH_USER' => 'username', - 'PHP_AUTH_PW' => 'pa$$word', - )); - -You can also override it on a per request basis:: - - $client->request('DELETE', '/post/12', array(), array(), array( - 'PHP_AUTH_USER' => 'username', - 'PHP_AUTH_PW' => 'pa$$word', - )); - -When your application is using a ``form_login``, you can simplify your tests -by allowing your test configuration to make use of HTTP authentication. This -way you can use the above to authenticate in tests, but still have your users -login via the normal ``form_login``. The trick is to include the ``http_basic`` -key in your firewall, along with the ``form_login`` key: - -.. configuration-block:: - - .. code-block:: yaml - - # app/config/config_test.yml - security: - firewalls: - your_firewall_name: - http_basic: +.. index:: + single: Tests; HTTP authentication + +How to simulate HTTP Authentication in a Functional Test +======================================================== + +If your application needs HTTP authentication, pass the username and password +as server variables to ``createClient()``:: + + $client = static::createClient(array(), array( + 'PHP_AUTH_USER' => 'username', + 'PHP_AUTH_PW' => 'pa$$word', + )); + +You can also override it on a per request basis:: + + $client->request('DELETE', '/post/12', array(), array(), array( + 'PHP_AUTH_USER' => 'username', + 'PHP_AUTH_PW' => 'pa$$word', + )); + +When your application is using a ``form_login``, you can simplify your tests +by allowing your test configuration to make use of HTTP authentication. This +way you can use the above to authenticate in tests, but still have your users +login via the normal ``form_login``. The trick is to include the ``http_basic`` +key in your firewall, along with the ``form_login`` key: + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/config_test.yml + security: + firewalls: + your_firewall_name: + http_basic: