getValues() public method

The returned array does not include file fields (@see getFiles).
public getValues ( ) : array
return array An array of field values
コード例 #1
0
 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);
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 /**
  * 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());
 }