getValues() public method

The returned array does not include file fields (@see getFiles).
public getValues ( ) : array
return array An array of field values
 protected function makeRequestUsingForm(Form $form)
 {
     $files = [];
     $plainFiles = $form->getFiles();
     foreach ($plainFiles as $key => $file) {
         $files[$key] = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['size'], $file['error'], true);
     }
     return $this->makeRequest($form->getMethod(), $form->getUri(), $form->getValues(), [], $files);
 }
 public function isValid(Form $form)
 {
     if ($form->has('token')) {
         $values = $form->getValues();
         $values['token'] = 'modified by csrf scanner';
         $form->setValues($values);
         $this->client->submit($form);
         $status = $this->client->getResponse()->getStatus();
         if (403 == $status) {
             return true;
         }
         $this->message = "403 response expected, but got a {$status}";
     } else {
         $this->message = "No 'token' input field found";
     }
     return false;
 }
 /**
  * Extract the parameters from the given form.
  *
  * @param  \Symfony\Component\DomCrawler\Form  $form
  * @return array
  */
 protected function extractParametersFromForm(Form $form)
 {
     parse_str(http_build_query($form->getValues()), $parameters);
     return $parameters;
 }
示例#4
0
 /**
  * Make a request to a URL using form parameters.
  *
  * @param  Form $form
  * @return static
  */
 protected function makeRequestUsingForm(Form $form)
 {
     return $this->makeRequest($form->getMethod(), $form->getUri(), $form->getValues(), [], $form->getFiles());
 }