/** * 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'))); }
/** * Test get step with empty request */ public function testGetStepByRequest() { $this->assertFalse($this->_model->getStepByRequest($this->_requestMock)); }
/** * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Install\Model\Wizard $wizard * @param array $data */ public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Install\Model\Wizard $wizard, array $data = array()) { parent::__construct($context, $data); $this->_isScopePrivate = true; $this->assign('steps', $wizard->getSteps()); }