示例#1
0
 /**
  * Test to get valid html code for 'image' attribute
  *
  * @param mixed $imageValue
  * @param string $methodName
  * @param string $urlPath
  * @dataProvider validateImageUrlDataProvider
  */
 public function testGetElementHtml($imageValue, $methodName, $urlPath)
 {
     $this->_model->setValue($imageValue);
     $this->_helperData->expects($this->any())->method('escapeHtml')->will($this->returnArgument(0));
     $this->_mediaConfig->expects($this->once())->method($methodName)->will($this->returnValue($urlPath));
     $html = $this->_createHtmlCode($imageValue, $urlPath);
     $this->assertXmlStringEqualsXmlString("<test>{$html}</test>", "<test>{$this->_model->getElementHtml()}</test>", 'Another BaseImage html code is expected');
 }
示例#2
0
 public function getTmpMediaUrl($file)
 {
     if ($this->_imageShouldComeFromCloudinary($file)) {
         return $this->_getUrlForImage($file);
     }
     return parent::getTmpMediaUrl($file);
 }
示例#3
0
 /**
  * Get full url for image
  *
  * @param string $imagePath
  *
  * @return string
  */
 protected function _getImageUrl($imagePath)
 {
     if (!in_array($imagePath, array(null, 'no_selection', '/'))) {
         if (pathinfo($imagePath, PATHINFO_EXTENSION) == 'tmp') {
             $imageUrl = $this->_mediaConfig->getTmpMediaUrl(substr($imagePath, 0, -4));
         } else {
             $imageUrl = $this->_mediaConfig->getMediaUrl($imagePath);
         }
     } else {
         $imageUrl = $this->_design->getViewFileUrl('Mage_Adminhtml::images/image-placeholder.png');
     }
     return $imageUrl;
 }