Example #1
0
 /**
  * Test that parsing and composing a valid URI returns the same URI
  *
  * @param array $posts
  * @param AbstractField[] $fields
  * @param string $getValueName
  *
  * @dataProvider formValueProvider
  */
 public function testGetValue(array $posts, array $fields, string $getValueName)
 {
     self::request()->setPosts($posts);
     self::request()->setMethod('POST');
     $form = new Form();
     foreach ($fields as $field) {
         $form->add($field);
     }
     $this->assertEquals($form->getValue($getValueName), $posts[$getValueName]);
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 protected function populateValue($element) : bool
 {
     $return = parent::populateValue($element);
     if (!$return && $this->isSubmit()) {
         $this->addErrorClass($element);
     }
     return $return;
 }
Example #3
0
 /**
  * @param Form $form
  */
 public function onAdd(Form $form)
 {
     $form->setMultipart();
 }