Esempio n. 1
0
 /**
  * @covers \Magento\Framework\Data\Form\Element\AbstractElement::getHtml()
  */
 public function testGetHtmlWithRenderer()
 {
     $this->_model->setRequired(true);
     $expectedHtml = 'some-html';
     $rendererMock = $this->getMockForAbstractClass('Magento\\Framework\\Data\\Form\\Element\\Renderer\\RendererInterface');
     $rendererMock->expects($this->once())->method('render')->with($this->_model)->will($this->returnValue($expectedHtml));
     $this->_model->setRenderer($rendererMock);
     $this->assertEquals($expectedHtml, $this->_model->getHtml());
     $this->assertEquals(' required-entry', $this->_model->getClass());
 }
 /**
  * Retrieve HTML markup for given form element
  *
  * @param \Magento\Framework\Data\Form\Element\AbstractElement $element
  * @return string
  */
 public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
 {
     $element->setRenderer($this);
     return parent::render($element);
 }