Skip to content

Commit

Permalink
Execute CakeSession::destroy() on a tearDown with implicit use sessio…
Browse files Browse the repository at this point in the history
…n test
  • Loading branch information
tenkoma committed Jan 15, 2018
1 parent f07d193 commit 701519c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 0 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ public function tearDown() {
TestAuthComponent::clearUser(); TestAuthComponent::clearUser();
$this->Auth->Session->delete('Auth'); $this->Auth->Session->delete('Auth');
$this->Auth->Session->delete('Message.auth'); $this->Auth->Session->delete('Message.auth');
$this->Auth->Session->destroy();
unset($this->Controller, $this->Auth); unset($this->Controller, $this->Auth);
} }


Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ public function setUp() {
public function tearDown() { public function tearDown() {
parent::tearDown(); parent::tearDown();
$this->Controller->Session->delete('_Token'); $this->Controller->Session->delete('_Token');
$this->Controller->Session->destroy();
unset($this->Controller->Security); unset($this->Controller->Security);
unset($this->Controller->Component); unset($this->Controller->Component);
unset($this->Controller); unset($this->Controller);
Expand Down
2 changes: 2 additions & 0 deletions lib/Cake/Test/Case/Controller/ScaffoldTest.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/ */


App::uses('Router', 'Routing'); App::uses('Router', 'Routing');
App::uses('CakeSession', 'Model/Datasource');
App::uses('Controller', 'Controller'); App::uses('Controller', 'Controller');
App::uses('Scaffold', 'Controller'); App::uses('Scaffold', 'Controller');
App::uses('ScaffoldView', 'View'); App::uses('ScaffoldView', 'View');
Expand Down Expand Up @@ -175,6 +176,7 @@ public function setUp() {
*/ */
public function tearDown() { public function tearDown() {
parent::tearDown(); parent::tearDown();
CakeSession::destroy();
unset($this->Controller); unset($this->Controller);
} }


Expand Down
1 change: 1 addition & 0 deletions lib/Cake/Test/Case/I18n/I18nTest.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public function tearDown() {
parent::tearDown(); parent::tearDown();


Cache::delete('object_map', '_cake_core_'); Cache::delete('object_map', '_cake_core_');
CakeSession::destroy();
App::build(); App::build();
CakePlugin::unload(); CakePlugin::unload();
} }
Expand Down
1 change: 1 addition & 0 deletions lib/Cake/Test/Case/View/Helper/SessionHelperTest.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public function setUp() {
public function tearDown() { public function tearDown() {
$_SESSION = array(); $_SESSION = array();
unset($this->View, $this->Session); unset($this->View, $this->Session);
CakeSession::destroy();
CakePlugin::unload(); CakePlugin::unload();
parent::tearDown(); parent::tearDown();
} }
Expand Down

0 comments on commit 701519c

Please sign in to comment.