public function testIsValidForHost() { $_SERVER['HTTP_HOST'] = 'localhost'; $this->_model->start(); $reflection = new \ReflectionMethod($this->_model, '_addHost'); $reflection->setAccessible(true); $reflection->invoke($this->_model); $this->assertFalse($this->_model->isValidForHost('test.com')); $this->assertTrue($this->_model->isValidForHost('localhost')); $this->_model->destroy(); }
/** * Validate session * * @param SessionManagerInterface $session * @return void * @throws SessionException */ public function validate(SessionManagerInterface $session) { if (!isset($_SESSION[self::VALIDATOR_KEY])) { $_SESSION[self::VALIDATOR_KEY] = $this->_getSessionEnvironment(); } else { try { $this->_validate(); } catch (SessionException $e) { $session->destroy(['clear_storage' => false]); // throw core session exception throw $e; } } }