/** * Retrieve route URL * * @param string $routePath * @param array $routeParams * @return string */ public function getRouteUrl($routePath = null, $routeParams = null) { $url = parent::getRouteUrl($routePath, $routeParams); $baseUrl = trim($this->getBaseUrl(), '/'); $vdeBaseUrl = $baseUrl . '/' . $this->_helper->getFrontName(); if (strpos($url, $baseUrl) === 0 && strpos($url, $vdeBaseUrl) === false) { $url = str_replace($baseUrl, $vdeBaseUrl, $url); } return $url; }
public function testGetRouteUrl() { $this->_helper->expects($this->any())->method('getFrontName')->will($this->returnValue(self::FRONT_NAME)); $store = $this->getMock('Mage_Core_Model_Store', array('getBaseUrl'), array(), '', false); $store->expects($this->any())->method('getBaseUrl')->will($this->returnValue(self::BASE_URL)); $this->_model->setData('store', $store); $this->_model->setData('type', null); $sourceUrl = self::BASE_URL . '/' . self::ROUTE_PATH; $expectedUrl = self::BASE_URL . '/' . self::FRONT_NAME . '/' . self::ROUTE_PATH; $this->assertEquals($expectedUrl, $this->_model->getRouteUrl($sourceUrl)); $this->assertEquals($expectedUrl, $this->_model->getRouteUrl($expectedUrl)); }
/** * Modify request path to imitate basic request * * @param Mage_Core_Controller_Request_Http $request * @return Mage_DesignEditor_Controller_Varien_Router_Standard */ protected function _prepareVdeRequest(Mage_Core_Controller_Request_Http $request) { $vdeFrontName = $this->_helper->getFrontName(); $noVdePath = substr($request->getPathInfo(), strlen($vdeFrontName) + 1) ?: '/'; $request->setPathInfo($noVdePath); return $this; }
/** * Get list of not allowed blocks * * @return array */ protected function _getBlockBlackList() { if ($this->_blockBlackList === null) { $this->_blockBlackList = $this->_helper->getBlockBlackList(); } return $this->_blockBlackList; }
/** * Disable some cache types in VDE mode */ protected function _disableCache() { foreach ($this->_dataHelper->getDisabledCacheTypes() as $cacheCode) { if ($this->_cacheManager->canUse($cacheCode)) { $this->_cacheManager->banUse($cacheCode); } } }
public function testGetDateToExpire() { $frontNameNode = new Mage_Core_Model_Config_Element('<test>' . self::TEST_DATE_TO_EXPIRE . '</test>'); $configurationMock = $this->getMock('Mage_Core_Model_Config', array('getNode'), array(), '', false); $configurationMock->expects($this->once())->method('getNode')->with(Mage_DesignEditor_Helper_Data::XML_PATH_DAYS_TO_EXPIRE)->will($this->returnValue($frontNameNode)); $this->_model = new Mage_DesignEditor_Helper_Data($configurationMock); $this->assertEquals(self::TEST_DATE_TO_EXPIRE, $this->_model->getDaysToExpire()); }
/** * Clear temporary layout updates and layout links */ public function clearLayoutUpdates() { $daysToExpire = $this->_helper->getDaysToExpire(); // remove expired links /** @var $linkCollection Mage_Core_Model_Resource_Layout_Link_Collection */ $linkCollection = $this->_objectManager->create('Mage_Core_Model_Resource_Layout_Link_Collection'); $linkCollection->addTemporaryFilter(true)->addUpdatedDaysBeforeFilter($daysToExpire); /** @var $layoutLink Mage_Core_Model_Layout_Link */ foreach ($linkCollection as $layoutLink) { $layoutLink->delete(); } // remove expired updates without links /** @var $layoutCollection Mage_Core_Model_Resource_Layout_Update_Collection */ $layoutCollection = $this->_objectManager->create('Mage_Core_Model_Resource_Layout_Update_Collection'); $layoutCollection->addNoLinksFilter()->addUpdatedDaysBeforeFilter($daysToExpire); /** @var $layoutUpdate Mage_Core_Model_Layout_Update */ foreach ($layoutCollection as $layoutUpdate) { $layoutUpdate->delete(); } }
public function testGetRoutePath() { $this->_helper->expects($this->once())->method('getFrontName')->will($this->returnValue(self::FRONT_NAME)); $this->_model->setData('route_path', self::ROUTE_PATH); $this->assertEquals(self::FRONT_NAME . '/' . self::ROUTE_PATH, $this->_model->getRoutePath()); }
/** * Retrieve route path * * @param array $routeParams * @return string */ public function getRoutePath($routeParams = array()) { return $this->_helper->getFrontName() . '/' . parent::getRoutePath($routeParams); }
protected function _setAdditionalExpectations() { $this->_dataHelper->expects($this->once())->method('getDisabledCacheTypes')->will($this->returnValue($this->_cacheTypes)); $this->_cacheManager->expects($this->at(0))->method('canUse')->with('type1')->will($this->returnValue(true)); $this->_cacheManager->expects($this->at(1))->method('banUse')->with('type1')->will($this->returnSelf()); $this->_cacheManager->expects($this->at(2))->method('canUse')->with('type2')->will($this->returnValue(true)); $this->_cacheManager->expects($this->at(3))->method('banUse')->with('type2')->will($this->returnSelf()); }