public createForm ( $type, $data = null, array $options = [] ) | ||
$options | array |
public function createForm($type, $data = null, array $options = array())
{
return parent::createForm($type, $data, $options);
}
public function testCreateForm() { $form = $this->getMockBuilder('Symfony\\Component\\Form\\FormInterface')->getMock(); $formFactory = $this->getMockBuilder('Symfony\\Component\\Form\\FormFactoryInterface')->getMock(); $formFactory->expects($this->once())->method('create')->willReturn($form); $container = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\ContainerInterface')->getMock(); $container->expects($this->at(0))->method('get')->will($this->returnValue($formFactory)); $controller = new TestController(); $controller->setContainer($container); $this->assertEquals($form, $controller->createForm('foo')); }