public function testGetActionPathWhenAreaFrontNameIsEmpty() { $helperMock = $this->getMock('Mage_Backend_Helper_Data', array(), array(), '', false); $helperMock->expects($this->once())->method('getAreaFrontName')->will($this->returnValue('')); $urlModel = new Mage_Backend_Model_Url($helperMock, $this->_coreHelperMock, $this->_coreSessionMock, $this->_storeConfigMock, $this->_menuConfigMock); $moduleFrontName = 'moduleFrontName'; $controllerName = 'controllerName'; $actionName = 'actionName'; $urlModel->setRouteName($moduleFrontName); $urlModel->setRouteFrontName($moduleFrontName); $urlModel->setControllerName($controllerName); $urlModel->setActionName($actionName); $actionPath = $urlModel->getActionPath(); $this->assertNotEmpty($actionPath); $this->assertStringStartsWith($moduleFrontName . '/', $actionPath); $this->assertStringMatchesFormat($moduleFrontName . '/%s/%s', $actionPath); }
public function testGetActionPathWhenAreaFrontNameIsEmpty() { $helperMock = $this->getMock('Mage_Backend_Helper_Data', array(), array(), '', false); $helperMock->expects($this->once())->method('getAreaFrontName')->will($this->returnValue('')); $urlModel = new Mage_Backend_Model_Url(array('startupMenuItemId' => 'Mage_Adminhtml::system_acl_roles', 'menu' => $this->_menuMock, 'backendHelper' => $helperMock, 'coreSession' => $this->_coreSessionMock, 'coreHelper' => $this->_coreHelperMock)); $moduleFrontName = 'moduleFrontName'; $controllerName = 'controllerName'; $actionName = 'actionName'; $urlModel->setRouteName($moduleFrontName); $urlModel->setRouteFrontName($moduleFrontName); $urlModel->setControllerName($controllerName); $urlModel->setActionName($actionName); $actionPath = $urlModel->getActionPath(); $this->assertNotEmpty($actionPath); $this->assertStringStartsWith($moduleFrontName . '/', $actionPath); $this->assertStringMatchesFormat($moduleFrontName . '/%s/%s', $actionPath); }