You are here

public function FormTest::provideGetUriValues 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::provideGetUriValues()

File

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

Class

FormTest

Namespace

Symfony\Component\DomCrawler\Tests

Code

public function provideGetUriValues() {
  return array(
    array(
      'returns the URI of the form',
      '<form action="/foo"><input type="submit" /></form>',
      array(),
      '/foo',
    ),
    array(
      'appends the form values if the method is get',
      '<form action="/foo"><input type="text" name="foo" value="foo" /><input type="submit" /></form>',
      array(),
      '/foo?foo=foo',
    ),
    array(
      'appends the form values and merges the submitted values',
      '<form action="/foo"><input type="text" name="foo" value="foo" /><input type="submit" /></form>',
      array(
        'foo' => 'bar',
      ),
      '/foo?foo=bar',
    ),
    array(
      'does not append values if the method is post',
      '<form action="/foo" method="post"><input type="text" name="foo" value="foo" /><input type="submit" /></form>',
      array(),
      '/foo',
    ),
    array(
      'does not append values if the method is patch',
      '<form action="/foo" method="post"><input type="text" name="foo" value="foo" /><input type="submit" /></form>',
      array(),
      '/foo',
      'PUT',
    ),
    array(
      'does not append values if the method is delete',
      '<form action="/foo" method="post"><input type="text" name="foo" value="foo" /><input type="submit" /></form>',
      array(),
      '/foo',
      'DELETE',
    ),
    array(
      'does not append values if the method is put',
      '<form action="/foo" method="post"><input type="text" name="foo" value="foo" /><input type="submit" /></form>',
      array(),
      '/foo',
      'PATCH',
    ),
    array(
      'appends the form values to an existing query string',
      '<form action="/foo?bar=bar"><input type="text" name="foo" value="foo" /><input type="submit" /></form>',
      array(),
      '/foo?bar=bar&foo=foo',
    ),
    array(
      'replaces query values with the form values',
      '<form action="/foo?bar=bar"><input type="text" name="bar" value="foo" /><input type="submit" /></form>',
      array(),
      '/foo?bar=foo',
    ),
    array(
      'returns an empty URI if the action is empty',
      '<form><input type="submit" /></form>',
      array(),
      '/',
    ),
    array(
      'appends the form values even if the action is empty',
      '<form><input type="text" name="foo" value="foo" /><input type="submit" /></form>',
      array(),
      '/?foo=foo',
    ),
    array(
      'chooses the path if the action attribute value is a sharp (#)',
      '<form action="#" method="post"><input type="text" name="foo" value="foo" /><input type="submit" /></form>',
      array(),
      '/#',
    ),
  );
}