Esempio n. 1
0
 public function testAddUsesFieldFromFactoryIfStringIsGiven()
 {
     $author = new \stdClass();
     $field = $this->createMockField('firstName');
     $factory = $this->getMock('Symfony\\Component\\Form\\FieldFactory\\FieldFactoryInterface');
     $factory->expects($this->once())->method('getInstance')->with($this->equalTo($author), $this->equalTo('firstName'), $this->equalTo(array('foo' => 'bar')))->will($this->returnValue($field));
     $form = $this->createMockForm();
     $form->expects($this->once())->method('getFieldFactory')->will($this->returnValue($factory));
     $group = new TestFieldGroup('author');
     $group->setParent($form);
     $group->setData($author);
     $group->add('firstName', array('foo' => 'bar'));
     $this->assertSame($field, $group['firstName']);
 }