Пример #1
0
 protected function setUp()
 {
     parent::setUp();
     \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\Config\\ScopeInterface')->setCurrentScope(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE);
     $this->_auth = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Backend\\Model\\Auth');
     $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Backend\\Model\\Auth\\Session');
     $this->_auth->setAuthStorage($this->_model);
 }
Пример #2
0
 protected function setUp()
 {
     parent::setUp();
     $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
     $this->objectManager->get(\Magento\Framework\Config\ScopeInterface::class)->setCurrentScope(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE);
     $this->auth = $this->objectManager->create(\Magento\Backend\Model\Auth::class);
     $this->authSession = $this->objectManager->create(\Magento\Backend\Model\Auth\Session::class);
     $this->auth->setAuthStorage($this->authSession);
 }
 /**
  * Set up
  */
 protected function setUp()
 {
     parent::setUp();
     $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
     $this->objectManager->get('Magento\\Framework\\Config\\ScopeInterface')->setCurrentScope(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE);
     $this->auth = $this->objectManager->create('Magento\\Backend\\Model\\Auth');
     $this->authSession = $this->objectManager->create('Magento\\Backend\\Model\\Auth\\Session');
     $this->adminSessionInfo = $this->objectManager->create('Magento\\Security\\Model\\AdminSessionInfo');
     $this->auth->setAuthStorage($this->authSession);
     $this->messageManager = $this->objectManager->get('Magento\\Framework\\Message\\ManagerInterface');
     $this->adminSessionsManager = $this->objectManager->create('Magento\\Security\\Model\\AdminSessionsManager');
 }
Пример #4
0
 public function testSetGetAuthStorage()
 {
     // by default \Magento\Backend\Model\Auth\Session class will instantiate as a Authentication Storage
     $this->assertInstanceOf('Magento\\Backend\\Model\\Auth\\Session', $this->_model->getAuthStorage());
     $mockStorage = $this->getMock('Magento\\Backend\\Model\\Auth\\StorageInterface');
     $this->_model->setAuthStorage($mockStorage);
     $this->assertInstanceOf('Magento\\Backend\\Model\\Auth\\StorageInterface', $this->_model->getAuthStorage());
     $incorrectStorage = new \StdClass();
     try {
         $this->_model->setAuthStorage($incorrectStorage);
         $this->fail('Incorrect authentication storage setted.');
     } catch (\Magento\Backend\Model\Auth\Exception $e) {
         // in case of exception - Auth works correct
         $this->assertNotEmpty($e->getMessage());
     }
 }
Пример #5
0
 /**
  * {@inheritdoc}
  */
 public function setAuthStorage($storage)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'setAuthStorage');
     if (!$pluginInfo) {
         return parent::setAuthStorage($storage);
     } else {
         return $this->___callPlugins('setAuthStorage', func_get_args(), $pluginInfo);
     }
 }