getUri() public method

The returned URI is not the same as the form "action" attribute. This method merges the value if the method is GET to mimics browser behavior.
public getUri ( ) : string
return string The URI
コード例 #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
ファイル: FormTest.php プロジェクト: ngitimfoyo/Nyari-AppPHP
 public function testGetBaseUri()
 {
     $dom = new \DOMDocument();
     $dom->loadHTML('<form method="post" action="foo.php"><input type="text" name="bar" value="bar" /><input type="submit" /></form>');
     $nodes = $dom->getElementsByTagName('input');
     $form = new Form($nodes->item($nodes->length - 1), 'http://www.foo.com/');
     $this->assertEquals('http://www.foo.com/foo.php', $form->getUri());
 }
コード例 #3
0
    /**
     * Submits a form.
     *
     * @param Form  $form   A Form instance
     * @param array $values An array of form field values
     *
     * @api
     */
    public function submit(Form $form, array $values = array())
    {
        $form->setValues($values);

        return $this->request($form->getMethod(), $form->getUri(), $form->getPhpValues(), $form->getPhpFiles());
    }
コード例 #4
0
ファイル: CrawlerTrait.php プロジェクト: Calky/uas
 /**
  * Make a request to the application using the given form.
  *
  * @param  \Symfony\Component\DomCrawler\Form  $form
  * @return $this
  */
 protected function makeRequestUsingForm(Form $form)
 {
     return $this->makeRequest($form->getMethod(), $form->getUri(), $this->extractParametersFromForm($form), [], $form->getFiles());
 }
コード例 #5
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());
 }
コード例 #6
0
 /**
  * Submit a form
  *
  * @param \Symfony\Component\DomCrawler\Form $form
  * @return \TYPO3\Flow\Http\Response
  * @api
  */
 public function submit(Form $form)
 {
     return $this->request($form->getUri(), $form->getMethod(), $form->getPhpValues(), $form->getPhpFiles());
 }
コード例 #7
0
ファイル: WebTestCase.php プロジェクト: doyolabs/symfony-test
 /**
  * 
  * @param \Symfony\Component\DomCrawler\Form $form
  * @param string    $method     The Request Method
  */
 public function submitForm(Form $form, $method = "POST")
 {
     $this->getClient()->request($method, $form->getUri(), $form->getPhpValues());
 }
コード例 #8
0
 public function getSonataAdminFormName(Form $form)
 {
     parse_str(parse_url($form->getUri(), PHP_URL_QUERY), $query);
     return $query['uniqid'];
 }
コード例 #9
0
ファイル: Client.php プロジェクト: Briareos/Undine
 /**
  * @param Form    $form
  * @param string  $package
  * @param string  $slug
  * @param Session $session
  *
  * @return Promise
  *
  * @rejects RequestException
  */
 public function disableModuleAsync(Form $form, $package, $slug, Session $session)
 {
     $formData = $form->getPhpValues();
     if (empty($formData['modules'][$package][$slug]['enable'])) {
         // The module is already disabled.
         return new FulfilledPromise(null);
     }
     unset($formData['modules'][$package][$slug]['enable']);
     return $this->client->requestAsync($form->getMethod(), $form->getUri(), [RequestOptions::COOKIES => $session->getCookieJar(), RequestOptions::AUTH => $session->getAuthData(), RequestOptions::FORM_PARAMS => $formData, RequestOptions::HEADERS => ['referer' => $form->getUri()], RequestOptions::ALLOW_REDIRECTS => false])->then(function () {
         // Resolve to null.
     });
 }