Beispiel #1
0
 public function testBindUsesValidationGroups()
 {
     $field = $this->createMockField('firstName');
     $form = new Form('author', new Author(), $this->validator);
     $form->add($field);
     $form->setValidationGroups('group');
     $this->validator->expects($this->once())->method('validate')->with($this->equalTo($form), $this->equalTo(array('group')));
     $form->bind(array());
     // irrelevant
 }
Beispiel #2
0
 public function testBindThrowsExceptionIfNoValidatorIsSet()
 {
     $field = $this->createMockField('firstName');
     $form = new Form('author', new Author());
     $form->add($field);
     $form->setValidationGroups('group');
     $this->setExpectedException('Symfony\\Component\\Form\\Exception\\FormException');
     $form->bind(array());
     // irrelevant
 }