Example #1
0
 public function testValidateOption()
 {
     $options = new Options($this->get('translator'));
     $this->form->setOptions($options);
     $this->form->setDefinition(array('country' => array('caption' => 'Country', 'type' => 'string', 'options' => $this->form->getOptions('countries'))));
     $values = array('country' => 'DE');
     $errors = $this->form->setWritableValues($values)->validate()->getErrors();
     $this->assertEquals(0, count($errors));
     $this->form->clearErrors();
     $values = array('country' => 'XX');
     $errors = $this->form->setWritableValues($values)->validate()->getErrors();
     $this->assertEquals(1, count($errors));
 }