예제 #1
0
 public function testGetViewFile()
 {
     $params = array('area' => 'some_area', 'package' => 'some_package', 'theme' => 'some_theme', 'locale' => 'some_locale');
     $file = 'Some_Module::some_file.ext';
     $expectedParams = $params + array('module' => 'Some_Module');
     $expected = 'path/to/some_file.ext';
     $this->_model->expects($this->once())->method('_getFallback')->with($expectedParams)->will($this->returnValue($this->_fallback));
     $this->_fallback->expects($this->once())->method('getViewFile')->with('some_file.ext', 'Some_Module')->will($this->returnValue($expected));
     $actual = $this->_model->getViewFile($file, $params);
     $this->assertEquals($expected, $actual);
 }
예제 #2
0
 /**
  * Test to get valid html code for 'image' with placeholder
  */
 public function testImagePlaceholder()
 {
     $urlPath = 'http://example.com/pub/images/image-placeholder.png';
     $this->_model->setValue(null);
     $this->_design->expects($this->once())->method('getViewFileUrl')->will($this->returnValue($urlPath));
     $this->_helperData->expects($this->any())->method('escapeHtml')->will($this->returnArgument(0));
     $html = $this->_createHtmlCode('', $urlPath);
     $this->assertXmlStringEqualsXmlString("<test>{$html}</test>", "<test>{$this->_model->getElementHtml()}</test>", 'Another BaseImage html code is expected');
 }
예제 #3
0
 public function testUpdateDesignMode()
 {
     $this->_setAdditionalExpectations();
     $request = $this->getMock('Mage_Core_Controller_Request_Http', array('getParam'), array(), '', false);
     $controller = $this->getMock('Mage_Adminhtml_Controller_Action', array('getFullActionName'), array(), '', false);
     $request->expects($this->once())->method('getParam')->with('handle', '')->will($this->returnValue('default'));
     $this->_backendSession->expects($this->once())->method('setData')->with('vde_current_mode', Mage_DesignEditor_Model_State::MODE_DESIGN);
     $this->_backendSession->expects($this->once())->method('getData')->with('theme_id')->will($this->returnValue(self::THEME_ID));
     $this->_urlModelFactory->expects($this->once())->method('replaceClassName')->with(self::URL_MODEL_DESIGN_MODE_CLASS_NAME);
     $this->_layoutFactory->expects($this->once())->method('createLayout')->with(array('area' => self::AREA_CODE), self::LAYOUT_DESIGN_CLASS_NAME);
     $this->_objectManager->expects($this->once())->method('addAlias')->with(self::LAYOUT_UPDATE_RESOURCE_MODEL_CORE_CLASS_NAME, self::LAYOUT_UPDATE_RESOURCE_MODEL_VDE_CLASS_NAME);
     $this->_designPackage->expects($this->once())->method('getConfigPathByArea')->with(Mage_Core_Model_App_Area::AREA_FRONTEND)->will($this->returnValue(self::THEME_CONFIGURATION));
     $store = $this->getMock('Mage_Core_Model_Store', array('setConfig'), array(), '', false);
     $store->expects($this->once())->method('setConfig')->with(self::THEME_CONFIGURATION, self::THEME_ID);
     $this->_application->expects($this->once())->method('getStore')->will($this->returnValue($store));
     $this->_model->update(self::AREA_CODE, $request, $controller);
 }