From 701519c637b113406db1fde2f4ab2047c8104ee4 Mon Sep 17 00:00:00 2001 From: Koji Tanaka Date: Tue, 16 Jan 2018 00:43:16 +0900 Subject: [PATCH] Execute CakeSession::destroy() on a tearDown with implicit use session test --- lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php | 1 + .../Test/Case/Controller/Component/SecurityComponentTest.php | 1 + lib/Cake/Test/Case/Controller/ScaffoldTest.php | 2 ++ lib/Cake/Test/Case/I18n/I18nTest.php | 1 + lib/Cake/Test/Case/View/Helper/SessionHelperTest.php | 1 + 5 files changed, 6 insertions(+) diff --git a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php index 09e99c92e..2b25e5827 100644 --- a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php @@ -415,6 +415,7 @@ class AuthComponentTest extends CakeTestCase { TestAuthComponent::clearUser(); $this->Auth->Session->delete('Auth'); $this->Auth->Session->delete('Message.auth'); + $this->Auth->Session->destroy(); unset($this->Controller, $this->Auth); } diff --git a/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php b/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php index 16951425f..4edaf935a 100644 --- a/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php @@ -186,6 +186,7 @@ class SecurityComponentTest extends CakeTestCase { public function tearDown() { parent::tearDown(); $this->Controller->Session->delete('_Token'); + $this->Controller->Session->destroy(); unset($this->Controller->Security); unset($this->Controller->Component); unset($this->Controller); diff --git a/lib/Cake/Test/Case/Controller/ScaffoldTest.php b/lib/Cake/Test/Case/Controller/ScaffoldTest.php index 14fa64b15..ec6b4eb46 100644 --- a/lib/Cake/Test/Case/Controller/ScaffoldTest.php +++ b/lib/Cake/Test/Case/Controller/ScaffoldTest.php @@ -17,6 +17,7 @@ */ App::uses('Router', 'Routing'); +App::uses('CakeSession', 'Model/Datasource'); App::uses('Controller', 'Controller'); App::uses('Scaffold', 'Controller'); App::uses('ScaffoldView', 'View'); @@ -175,6 +176,7 @@ class ScaffoldTest extends CakeTestCase { */ public function tearDown() { parent::tearDown(); + CakeSession::destroy(); unset($this->Controller); } diff --git a/lib/Cake/Test/Case/I18n/I18nTest.php b/lib/Cake/Test/Case/I18n/I18nTest.php index fd8cc36d2..3c3df309d 100644 --- a/lib/Cake/Test/Case/I18n/I18nTest.php +++ b/lib/Cake/Test/Case/I18n/I18nTest.php @@ -51,6 +51,7 @@ class I18nTest extends CakeTestCase { parent::tearDown(); Cache::delete('object_map', '_cake_core_'); + CakeSession::destroy(); App::build(); CakePlugin::unload(); } diff --git a/lib/Cake/Test/Case/View/Helper/SessionHelperTest.php b/lib/Cake/Test/Case/View/Helper/SessionHelperTest.php index f373218a7..5ff9737c6 100644 --- a/lib/Cake/Test/Case/View/Helper/SessionHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/SessionHelperTest.php @@ -87,6 +87,7 @@ class SessionHelperTest extends CakeTestCase { public function tearDown() { $_SESSION = array(); unset($this->View, $this->Session); + CakeSession::destroy(); CakePlugin::unload(); parent::tearDown(); }