public function testLogoutAndRegistry() { $factory = new Factory(); $repository = $this->getRepositoryMock(); $transport = $this->getTransportStub(); $transport->expects($this->once())->method('logout'); $session = new Session($factory, $repository, 'x', new SimpleCredentials('foo', 'bar'), $transport); $this->assertTrue($session->isLive()); $key = $session->getRegistryKey(); $this->assertSame($session, Session::getSessionFromRegistry($key)); $session->logout(); $this->assertFalse($session->isLive()); $this->assertNull(Session::getSessionFromRegistry($key)); }
/** * Implementation specific: unregister session in session registry on * logout. * * @param Session $session the session to unregister * * @private */ protected static function unregisterSession(Session $session) { $key = $session->getRegistryKey(); unset(self::$sessionRegistry[$key]); }