Browse Source

Fix record removal from session storage

ADmad 10 years ago
parent
commit
fa2be1e46c

+ 1 - 1
src/Auth/Storage/SessionStorage.php

@@ -100,7 +100,7 @@ class SessionStorage implements StorageInterface
      */
     public function remove()
     {
-        unset($this->_user);
+        $this->_user = null;
 
         $this->_session->delete($this->_config['key']);
         $this->_session->renew();

+ 2 - 2
tests/TestCase/Controller/Component/AuthComponentTest.php

@@ -199,14 +199,14 @@ class AuthComponentTest extends TestCase
         $event = new Event('Controller.startup', $this->Controller);
         $Users = TableRegistry::get('Users');
         $user = $Users->find('all')->hydrate(false)->first();
-        $this->Auth->session->write('Auth.User', $user);
+        $this->Controller->Auth->storage()->set($user);
         $this->Controller->Auth->config('userModel', 'Users');
         $this->Controller->Auth->config('authorize', false);
         $this->Controller->request->addParams(Router::parse('auth_test/add'));
         $result = $this->Controller->Auth->startup($event);
         $this->assertNull($result);
 
-        $this->Auth->session->delete('Auth');
+        $this->Controller->Auth->storage()->remove();
         $result = $this->Controller->Auth->startup($event);
         $this->assertTrue($event->isStopped());
         $this->assertInstanceOf('Cake\Network\Response', $result);