/** * Create url model instance that will be used instead of \Magento\Framework\UrlInterface in navigation mode * * @param string $mode * @return void */ protected function _injectUrlModel($mode) { switch ($mode) { case self::MODE_NAVIGATION: default: $this->_urlModelFactory->replaceClassName(self::URL_MODEL_NAVIGATION_MODE_CLASS_NAME); break; } }
public function testUpdateNavigationMode() { $this->_setAdditionalExpectations(); $request = $this->getMock('Magento\\Framework\\App\\Request\\Http', [], [], '', false); $request->expects($this->once())->method('getPathInfo')->will($this->returnValue('/')); $this->_backendSession->expects($this->at(0))->method('setData')->with('vde_current_url', '/'); $this->_backendSession->expects($this->at(1))->method('setData')->with('vde_current_mode', \Magento\DesignEditor\Model\State::MODE_NAVIGATION); $this->_urlModelFactory->expects($this->once())->method('replaceClassName')->with(self::URL_MODEL_NAVIGATION_MODE_CLASS_NAME); $this->_areaEmulator->expects($this->once())->method('emulateLayoutArea')->with(self::AREA_CODE); $controller = $this->getMock('Magento\\Backend\\App\\Action', [], [], '', false); $this->_model->update(self::AREA_CODE, $request, $controller); }
public function testCreate() { $this->_objectManager->expects($this->once())->method('create')->with('Magento\\Framework\\UrlInterface', array())->will($this->returnValue('ModelInstance')); $this->assertEquals('ModelInstance', $this->_model->create()); }