コード例 #1
0
 public function testFetchView()
 {
     $this->expectOutputString('');
     $template = 'themedir/template.phtml';
     $this->validator->expects($this->once())->method('isValid')->with($template)->willReturn(true);
     $output = '<h1>Template Contents</h1>';
     $vars = ['var1' => 'value1', 'var2' => 'value2'];
     $this->templateEngine->expects($this->once())->method('render')->willReturn($output);
     $this->block->assign($vars);
     $this->assertEquals($output, $this->block->fetchView($template));
 }
コード例 #2
0
 public function testFetchView()
 {
     $this->expectOutputString('');
     $directoryMock = $this->getMock('\\Magento\\Framework\\Filesystem\\Directory\\Read', array(), array(), '', false);
     $directoryMock->expects($this->any())->method('getRelativePath')->will($this->returnArgument(0));
     $this->_filesystem->expects($this->once())->method('getDirectoryRead')->will($this->returnValue($directoryMock));
     $this->_filesystem->expects($this->any())->method('getPath')->will($this->returnValue('themedir'));
     $directoryMock->expects($this->once())->method('isFile')->with('themedir/template.phtml')->will($this->returnValue(true));
     $output = '<h1>Template Contents</h1>';
     $vars = array('var1' => 'value1', 'var2' => 'value2');
     $this->_templateEngine->expects($this->once())->method('render')->will($this->returnValue($output));
     $this->_block->assign($vars);
     $this->assertEquals($output, $this->_block->fetchView('themedir/template.phtml'));
 }
コード例 #3
0
 /**
  * @param OriginalBloc $baseImage
  * @param Template $block
  * @return Template
  *
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function afterAssignBlockVariables(OriginalBloc $baseImage, Template $block)
 {
     $block->assign(['videoPlaceholderText' => __('Click here to add videos.'), 'addVideoTitle' => __('New Video')]);
     return $block;
 }
コード例 #4
0
 /**
  * @param \Magento\Framework\View\Element\Template $block
  * @return \Magento\Framework\View\Element\Template
  */
 public function assignBlockVariables(\Magento\Framework\View\Element\Template $block)
 {
     $block->assign(['htmlId' => $this->_escaper->escapeHtml($this->getHtmlId()), 'fileMaxSize' => $this->maxFileSize, 'uploadUrl' => $this->_escaper->escapeHtml($this->_getUploadUrl()), 'spacerImage' => $this->assetRepo->getUrl('images/spacer.gif'), 'imagePlaceholderText' => __('Click here or drag and drop to add images.'), 'deleteImageText' => __('Delete image'), 'makeBaseText' => __('Make Base'), 'hiddenText' => __('Hidden'), 'imageManagementText' => __('Images and Videos')]);
     return $block;
 }