From f5c54e26dd281a20578c341b07fd7954b74bc685 Mon Sep 17 00:00:00 2001 From: ADmad Date: Tue, 5 Nov 2024 17:56:49 +0530 Subject: [PATCH 1/3] Update references to defunct classes --- en/development/testing.rst | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/en/development/testing.rst b/en/development/testing.rst index 59d85cd3f7..eda7d27765 100644 --- a/en/development/testing.rst +++ b/en/development/testing.rst @@ -987,8 +987,6 @@ controller code looks like:: class ArticlesController extends AppController { - public $helpers = ['Form', 'Html']; - public function index($short = null) { if ($this->request->is('post')) { @@ -1114,10 +1112,10 @@ The state set by these helper methods is reset in the ``tearDown()`` method. .. versionadded:: 5.1.0 ``replaceRequest()`` was added. -Testing Actions Protected by CsrfComponent or SecurityComponent +Testing Actions Protected by CsrfMiddleware or FormProtectionComponent --------------------------------------------------------------- -When testing actions protected by either SecurityComponent or CsrfComponent you +When testing actions protected by either ``CsrfProtectionMiddleware`` or ``FormProtectionComponent`` you can enable automatic token generation to ensure your tests won't fail due to token mismatches:: @@ -1129,7 +1127,7 @@ token mismatches:: } It is also important to enable debug in tests that use tokens to prevent the -SecurityComponent from thinking the debug token is being used in a non-debug +``FormProtectionComponent`` from thinking the debug token is being used in a non-debug environment. When testing with other methods like ``requireSecure()`` you can use ``configRequest()`` to set the correct environment variables:: From 183e67df6958814d0ce0bdd7ed5d06500c03fb22 Mon Sep 17 00:00:00 2001 From: ADmad Date: Tue, 5 Nov 2024 18:03:25 +0530 Subject: [PATCH 2/3] Fix formatting --- en/development/testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/development/testing.rst b/en/development/testing.rst index eda7d27765..3f64acc774 100644 --- a/en/development/testing.rst +++ b/en/development/testing.rst @@ -1113,7 +1113,7 @@ The state set by these helper methods is reset in the ``tearDown()`` method. ``replaceRequest()`` was added. Testing Actions Protected by CsrfMiddleware or FormProtectionComponent ---------------------------------------------------------------- +---------------------------------------------------------------------- When testing actions protected by either ``CsrfProtectionMiddleware`` or ``FormProtectionComponent`` you can enable automatic token generation to ensure your tests won't fail due to From 8a0c0d90bc4b82948c3981f905e6e7b1267a64d5 Mon Sep 17 00:00:00 2001 From: ADmad Date: Tue, 5 Nov 2024 18:05:05 +0530 Subject: [PATCH 3/3] Fix class name --- en/development/testing.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/en/development/testing.rst b/en/development/testing.rst index 3f64acc774..b5037b611e 100644 --- a/en/development/testing.rst +++ b/en/development/testing.rst @@ -1112,8 +1112,8 @@ The state set by these helper methods is reset in the ``tearDown()`` method. .. versionadded:: 5.1.0 ``replaceRequest()`` was added. -Testing Actions Protected by CsrfMiddleware or FormProtectionComponent ----------------------------------------------------------------------- +Testing Actions Protected by CsrfProtectionMiddleware or FormProtectionComponent +-------------------------------------------------------------------------------- When testing actions protected by either ``CsrfProtectionMiddleware`` or ``FormProtectionComponent`` you can enable automatic token generation to ensure your tests won't fail due to