/** * Get elements collection * * @return Collection */ public function getElements() { if (empty($this->_elements)) { $this->_elements = $this->_factoryCollection->create(['container' => $this]); } return $this->_elements; }
/** * @covers \Magento\Framework\Data\Form\Element\AbstractElement::removeField() */ public function testRemoveField() { $elementId = 'element_id'; $formMock = $this->getMock('Magento\\Framework\\Data\\Form\\AbstractForm', ['removeField'], [], '', false); $formMock->expects($this->once())->method('removeField')->with($elementId); $collectionMock = $this->getMock('\\Magento\\Framework\\Data\\Form\\Element\\Collection', ['remove'], [], '', false); $collectionMock->expects($this->once())->method('remove')->with($elementId); $this->_collectionFactoryMock->expects($this->any())->method('create')->will($this->returnValue($collectionMock)); $this->_model->setForm($formMock); $this->_model->removeField($elementId); }
/** * @covers \Magento\Framework\Data\Form\Element\CollectionFactory::create */ public function testCreate() { $this->assertInstanceOf('Magento\\Framework\\Data\\Form\\Element\\Collection', $this->_model->create([])); }