You are here

public function FormTest::testGetUriActionAbsolute in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dom-crawler/Tests/FormTest.php \Symfony\Component\DomCrawler\Tests\FormTest::testGetUriActionAbsolute()

File

vendor/symfony/dom-crawler/Tests/FormTest.php, line 500

Class

FormTest

Namespace

Symfony\Component\DomCrawler\Tests

Code

public function testGetUriActionAbsolute() {
  $formHtml = '<form id="login_form" action="https://login.foo.com/login.php?login_attempt=1" method="POST"><input type="text" name="foo" value="foo" /><input type="submit" /></form>';
  $form = $this
    ->createForm($formHtml);
  $this
    ->assertEquals('https://login.foo.com/login.php?login_attempt=1', $form
    ->getUri(), '->getUri() returns absolute URIs set in the action form');
  $form = $this
    ->createForm($formHtml, null, 'https://login.foo.com');
  $this
    ->assertEquals('https://login.foo.com/login.php?login_attempt=1', $form
    ->getUri(), '->getUri() returns absolute URIs set in the action form');
  $form = $this
    ->createForm($formHtml, null, 'https://login.foo.com/bar/');
  $this
    ->assertEquals('https://login.foo.com/login.php?login_attempt=1', $form
    ->getUri(), '->getUri() returns absolute URIs set in the action form');

  // The action URI haven't the same domain Host have an another domain as Host
  $form = $this
    ->createForm($formHtml, null, 'https://www.foo.com');
  $this
    ->assertEquals('https://login.foo.com/login.php?login_attempt=1', $form
    ->getUri(), '->getUri() returns absolute URIs set in the action form');
  $form = $this
    ->createForm($formHtml, null, 'https://www.foo.com/bar/');
  $this
    ->assertEquals('https://login.foo.com/login.php?login_attempt=1', $form
    ->getUri(), '->getUri() returns absolute URIs set in the action form');
}