public function testSetTemplateContext()
 {
     $template = 'themedir/template.phtml';
     $context = new \Magento\Framework\DataObject();
     $this->_validator->expects($this->once())->method('isValid')->with($template)->will($this->returnValue(true));
     $this->_templateEngine->expects($this->once())->method('render')->with($context);
     $this->_block->setTemplateContext($context);
     $this->_block->fetchView($template);
 }
Beispiel #2
0
 public function testSetTemplateContext()
 {
     $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));
     $context = new \Magento\Framework\Object();
     $this->_templateEngine->expects($this->once())->method('render')->with($context);
     $this->_block->setTemplateContext($context);
     $this->_block->fetchView('themedir/template.phtml');
 }