コード例 #1
0
 /**
  * @covers \Magento\Framework\View\Element\AbstractBlock::toHtml
  * @see testAssign()
  */
 public function testToHtml()
 {
     \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\App\\State')->setAreaCode('any area');
     $this->assertEmpty($this->_block->toHtml());
     $this->_block->setTemplate(uniqid('invalid_filename.phtml'));
     $this->assertEmpty($this->_block->toHtml());
 }
コード例 #2
0
 public function testFetchViewWithNoFileName()
 {
     $output = '';
     $template = false;
     $templatePath = 'wrong_template_path.pthml';
     $moduleName = 'Acme';
     $blockName = 'acme_test_module_test_block';
     $exception = "Invalid template file: '{$templatePath}' in module: '{$moduleName}' block's name: '{$blockName}'";
     $this->block->setTemplate($templatePath);
     $this->block->setData('module_name', $moduleName);
     $this->block->setNameInLayout($blockName);
     $this->validator->expects($this->once())->method('isValid')->with($template)->willReturn(false);
     $this->loggerMock->expects($this->once())->method('critical')->with($exception)->willReturn(null);
     $this->assertEquals($output, $this->block->fetchView($template));
 }
コード例 #3
0
ファイル: Button.php プロジェクト: shabbirvividads/magento2
 /**
  * {@inheritdoc}
  *
  * @param string $template
  * @return $this
  */
 public function setTemplate($template)
 {
     if (!empty($template)) {
         parent::setTemplate($template);
     }
     return $this;
 }
コード例 #4
0
 /**
  * @param OriginalBloc $baseImage
  * @param Template $block
  * @return Template
  *
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function afterCreateElementHtmlOutputBlock(OriginalBloc $baseImage, Template $block)
 {
     $block->setTemplate(self::ELEMENT_OUTPUT_TEMPLATE);
     return $block;
 }