Example #1
0
 /**
  * Disabled form security in order to prevent exit from the app
  * @magentoConfigFixture current_store admin/security/session_lifetime 59
  */
 public function testIsLoggedInWithIgnoredLifetime()
 {
     $this->_auth->login(\Magento\TestFramework\Bootstrap::ADMIN_NAME, \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD);
     $this->assertTrue($this->_model->isLoggedIn());
     $this->_model->setUpdatedAt(time() - 101);
     $this->assertTrue($this->_model->isLoggedIn());
 }
Example #2
0
 public function testIsLoggedInPositive()
 {
     $lifetime = 900;
     $user = $this->getMock('Magento\\User\\Model\\User', ['getId', '__wakeup'], [], '', false);
     $user->expects($this->once())->method('getId')->will($this->returnValue(1));
     $this->session->setUpdatedAt(time() + $lifetime);
     // Emulate just updated session
     $this->storage->expects($this->any())->method('getUser')->will($this->returnValue($user));
     $this->config->expects($this->once())->method('getValue')->with(\Magento\Backend\Model\Auth\Session::XML_PATH_SESSION_LIFETIME)->will($this->returnValue($lifetime));
     $this->assertTrue($this->session->isLoggedIn());
 }