/** * Get a form by a schema * * @param string $schema * * @return FormView */ public function formFromValue(FormValue $value) { if (null === ($schema = $value->getSchema())) { return false; } $entity = $this->eavManager->initializeEntity($schema); $form = $this->formFactory->create('eav_post', $entity, ['valueId' => $value->getId()]); return $form->createView(); }
public function testCreate() { $className = 'Magento\\Framework\\Data\\Form'; $formMock = $this->getMock($className, array(), array(), '', false); $this->_objectManagerMock->expects($this->once())->method('create')->with($className)->will($this->returnValue($formMock)); $formFactory = new FormFactory($this->_objectManagerMock, $className); $this->assertSame($formMock, $formFactory->create()); }