Esempio n. 1
0
 /**
  * @covers \Magento\Cms\Model\Template\Filter::mediaDirective
  */
 public function testMediaDirective()
 {
     $baseMediaDir = 'pub/media';
     $construction = ['{{media url="wysiwyg/image.jpg"}}', 'media', ' url="wysiwyg/image.jpg"'];
     $expectedResult = 'pub/media/wysiwyg/image.jpg';
     $this->storeMock->expects($this->once())->method('getBaseMediaDir')->willReturn($baseMediaDir);
     $this->assertEquals($expectedResult, $this->filter->mediaDirective($construction));
 }
Esempio n. 2
0
 protected function prepareExecuteTest()
 {
     $directiveParam = 'e3ttZWRpYSB1cmw9Ind5c2l3eWcvYnVubnkuanBnIn19';
     $directive = '{{media url="wysiwyg/image.jpg"}}';
     $this->requestMock->expects($this->once())->method('getParam')->with('___directive')->willReturn($directiveParam);
     $this->urlDecoderMock->expects($this->once())->method('decode')->with($directiveParam)->willReturn($directive);
     $this->objectManagerMock->expects($this->once())->method('create')->with('Magento\\Cms\\Model\\Template\\Filter')->willReturn($this->templateFilterMock);
     $this->templateFilterMock->expects($this->once())->method('filter')->with($directive)->willReturn(self::IMAGE_PATH);
     $this->objectManagerMock->expects($this->any())->method('get')->willReturnMap([['Magento\\Framework\\Image\\AdapterFactory', $this->imageAdapterFactoryMock], ['Magento\\Cms\\Model\\Wysiwyg\\Config', $this->wysiwygConfigMock], ['Psr\\Log\\LoggerInterface', $this->loggerMock]]);
     $this->imageAdapterFactoryMock->expects($this->once())->method('create')->willReturn($this->imageAdapterMock);
 }
Esempio n. 3
0
 /**
  * @param \Magento\Framework\Stdlib\String $string
  * @param \Psr\Log\LoggerInterface $logger
  * @param \Magento\Framework\Escaper $escaper
  * @param \Magento\Framework\View\Asset\Repository $assetRepo
  * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
  * @param \Magento\Variable\Model\VariableFactory $coreVariableFactory
  * @param \Magento\Store\Model\StoreManagerInterface $storeManager
  * @param \Magento\Framework\View\LayoutInterface $layout
  * @param \Magento\Framework\View\LayoutFactory $layoutFactory
  * @param \Magento\Framework\App\State $appState
  * @param \Magento\Backend\Model\UrlInterface $backendUrlBuilder
  * @param \Magento\Widget\Model\Resource\Widget $widgetResource
  * @param \Magento\Widget\Model\Widget $widget
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(\Magento\Framework\Stdlib\String $string, \Psr\Log\LoggerInterface $logger, \Magento\Framework\Escaper $escaper, \Magento\Framework\View\Asset\Repository $assetRepo, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Variable\Model\VariableFactory $coreVariableFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\View\LayoutInterface $layout, \Magento\Framework\View\LayoutFactory $layoutFactory, \Magento\Framework\App\State $appState, \Magento\Backend\Model\UrlInterface $backendUrlBuilder, \Magento\Widget\Model\Resource\Widget $widgetResource, \Magento\Widget\Model\Widget $widget)
 {
     $this->_widgetResource = $widgetResource;
     $this->_widget = $widget;
     parent::__construct($string, $logger, $escaper, $assetRepo, $scopeConfig, $coreVariableFactory, $storeManager, $layout, $layoutFactory, $appState, $backendUrlBuilder);
 }
Esempio n. 4
0
 /**
  * @param \Magento\Framework\Stdlib\StringUtils $string
  * @param \Psr\Log\LoggerInterface $logger
  * @param \Magento\Framework\Escaper $escaper
  * @param \Magento\Framework\View\Asset\Repository $assetRepo
  * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
  * @param \Magento\Variable\Model\VariableFactory $coreVariableFactory
  * @param \Magento\Store\Model\StoreManagerInterface $storeManager
  * @param \Magento\Framework\View\LayoutInterface $layout
  * @param \Magento\Framework\View\LayoutFactory $layoutFactory
  * @param \Magento\Framework\App\State $appState
  * @param \Magento\Framework\UrlInterface $urlModel
  * @param \Pelago\Emogrifier $emogrifier
  * @param \Magento\Email\Model\Source\Variables $configVariables
  * @param \Magento\Widget\Model\ResourceModel\Widget $widgetResource
  * @param \Magento\Widget\Model\Widget $widget
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(\Magento\Framework\Stdlib\StringUtils $string, \Psr\Log\LoggerInterface $logger, \Magento\Framework\Escaper $escaper, \Magento\Framework\View\Asset\Repository $assetRepo, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Variable\Model\VariableFactory $coreVariableFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\View\LayoutInterface $layout, \Magento\Framework\View\LayoutFactory $layoutFactory, \Magento\Framework\App\State $appState, \Magento\Framework\UrlInterface $urlModel, \Pelago\Emogrifier $emogrifier, \Magento\Email\Model\Source\Variables $configVariables, \Magento\Widget\Model\ResourceModel\Widget $widgetResource, \Magento\Widget\Model\Widget $widget)
 {
     $this->_widgetResource = $widgetResource;
     $this->_widget = $widget;
     parent::__construct($string, $logger, $escaper, $assetRepo, $scopeConfig, $coreVariableFactory, $storeManager, $layout, $layoutFactory, $appState, $urlModel, $emogrifier, $configVariables);
 }