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 }
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 }