public function testRenderWithStoredElements() { $this->_helperMock->expects($this->any())->method('getScript')->will($this->returnArgument(0)); $fieldMock = $this->getMock('Magento\\Framework\\Data\\Form\\Element\\Text', ['getId', 'getTooltip', 'toHtml'], [], '', false, false, true); $fieldMock->expects($this->any())->method('getId')->will($this->returnValue('test_field_id')); $fieldMock->expects($this->any())->method('getTooltip')->will($this->returnValue('test_field_tootip')); $fieldMock->expects($this->any())->method('toHtml')->will($this->returnValue('test_field_toHTML')); $helper = new \Magento\TestFramework\Helper\ObjectManager($this); $factory = $this->getMock('Magento\\Framework\\Data\\Form\\Element\\Factory', [], [], '', false); $factoryColl = $this->getMock('Magento\\Framework\\Data\\Form\\Element\\CollectionFactory', [], [], '', false); $formMock = $this->getMock('Magento\\Framework\\Data\\Form\\AbstractForm', [], [$factory, $factoryColl]); $collection = $helper->getObject('Magento\\Framework\\Data\\Form\\Element\\Collection', ['container' => $formMock]); $collection->add($fieldMock); $this->_elementMock->expects($this->any())->method('getElements')->will($this->returnValue($collection)); $actual = $this->_object->render($this->_elementMock); $this->assertContains('test_field_toHTML', $actual); $expected = '<div id="row_test_field_id_comment" class="system-tooltip-box"' . ' style="display:none;">test_field_tootip</div>'; $this->assertContains($expected, $actual); }