Exemple #1
0
 /**
  * Set up before test
  *
  * @return void
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 protected function setUp()
 {
     $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
     $this->_installerMock = $this->getMock('\\Magento\\Install\\Model\\Installer', array('isApplicationInstalled'), array(), '', false);
     $this->_installerMock->expects($this->any())->method('isApplicationInstalled')->will($this->returnValue(true));
     $this->_blockMock = $this->getMock('\\Magento\\Install\\Block\\Locale', array(), array(), '', false);
     $this->_layoutMock = $this->getMock('\\Magento\\Framework\\View\\Layout', array('getBlock', 'initMessages', 'addBlock'), array(), '', false);
     $this->_layoutMock->expects($this->any())->method('initMessages')->withAnyParameters()->will($this->returnValue(true));
     $this->_layoutMock->expects($this->any())->method('addBlock')->withAnyParameters()->will($this->returnValue(true));
     $this->_viewMock = $this->getMockForAbstractClass('\\Magento\\Framework\\App\\ViewInterface', array(), '', false, false, true, array('getLayout'));
     $this->_viewMock->expects($this->any())->method('getLayout')->withAnyParameters()->will($this->returnValue($this->_layoutMock));
     $this->_requestMock = $this->_getClearMock('\\Magento\\Framework\\App\\RequestInterface');
     $this->_responseMock = $this->_getClearMock('\\Magento\\Framework\\App\\ResponseInterface');
     $this->_actionFlagMock = $this->_getClearMock('\\Magento\\Framework\\App\\ActionFlag');
     $this->_contextMock = $this->getMock('\\Magento\\Framework\\App\\Action\\Context', array('getView', 'getRequest', 'getResponse', 'getActionFlag'), array(), '', false);
     $this->_contextMock->expects($this->any())->method('getView')->will($this->returnValue($this->_viewMock));
     $this->_contextMock->expects($this->any())->method('getRequest')->will($this->returnValue($this->_requestMock));
     $this->_contextMock->expects($this->any())->method('getResponse')->will($this->returnValue($this->_responseMock));
     $this->_contextMock->expects($this->any())->method('getActionFlag')->will($this->returnValue($this->_actionFlagMock));
     $this->_blockContextMock = $this->getMock('\\Magento\\Framework\\View\\Element\\Template\\Context', array(), array(), '', false);
     $this->_wizardMock = $this->getMock('\\Magento\\Install\\Model\\Wizard', array('getStepByRequest'), array(), '', false);
     $this->_wizardMock->expects($this->any())->method('getStepByRequest')->withAnyParameters()->will($this->returnValue(false));
     $this->_sessionMock = $this->getMock('\\Magento\\Framework\\Session\\Generic', array('getLocale'), array(), '', false);
     $this->_sessionMock->expects($this->any())->method('getLocale')->will($this->returnValue(self::LOCALE));
     $this->_block = $this->_objectManager->getObject('Magento\\Install\\Block\\Locale', array('context' => $this->_blockContextMock, 'installer' => $this->_installerMock, 'installWizard' => $this->_wizardMock, 'session' => $this->_sessionMock, 'data' => array()));
     $this->_layoutMock->expects($this->any())->method('getBlock')->with('install.locale')->will($this->returnValue($this->_block));
     $this->_controller = $this->_objectManager->getObject('Magento\\Install\\Controller\\Wizard\\Locale', array('context' => $this->_contextMock, 'configScope' => $this->_getClearMock('Magento\\Framework\\Config\\Scope'), 'installer' => $this->_getClearMock('Magento\\Install\\Model\\Installer'), 'wizard' => $this->_wizardMock, 'session' => $this->_sessionMock, 'dbUpdater' => $this->_getClearMock('Magento\\Framework\\Module\\UpdaterInterface'), 'storeManager' => $this->_getClearMock('Magento\\Store\\Model\\StoreManagerInterface'), 'appState' => $this->_getClearMock('Magento\\Framework\\App\\State')));
 }
Exemple #2
0
 /**
  * Check if server is applicable for Magento
  * @return $this
  */
 public function checkServer()
 {
     $result = $this->installer->checkServer();
     if (!$result) {
         foreach ($this->messageManager->getMessages()->getItems() as $message) {
             $this->addError($message->toString());
         }
     }
     return $this;
 }
Exemple #3
0
 public function testFinish()
 {
     $cacheTypeListArray = array('one', 'two');
     $this->_cache->expects($this->once())->method('clean');
     $this->_config->expects($this->once())->method('reinit');
     $this->_cacheState->expects($this->once())->method('persist');
     $this->_cacheState->expects($this->exactly(count($cacheTypeListArray)))->method('setEnabled');
     $this->_cacheTypeList->expects($this->once())->method('getTypes')->will($this->returnValue($cacheTypeListArray));
     $this->_appState->expects($this->once())->method('setInstallDate')->with($this->greaterThanOrEqual(date('r')));
     $this->_installerConfig->expects($this->once())->method('replaceTmpInstallDate')->with($this->greaterThanOrEqual(date('r')));
     $this->assertSame($this->_model, $this->_model->finish());
 }