You are here

public function FormTest::testGetValues in Zircon Profile 8.0

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

File

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

Class

FormTest

Namespace

Symfony\Component\DomCrawler\Tests

Code

public function testGetValues() {
  $form = $this
    ->createForm('<form><input type="text" name="foo[bar]" value="foo" /><input type="text" name="bar" value="bar" /><select multiple="multiple" name="baz[]"></select><input type="submit" /></form>');
  $this
    ->assertEquals(array(
    'foo[bar]' => 'foo',
    'bar' => 'bar',
    'baz' => array(),
  ), $form
    ->getValues(), '->getValues() returns all form field values');
  $form = $this
    ->createForm('<form><input type="checkbox" name="foo" value="foo" /><input type="text" name="bar" value="bar" /><input type="submit" /></form>');
  $this
    ->assertEquals(array(
    'bar' => 'bar',
  ), $form
    ->getValues(), '->getValues() does not include not-checked checkboxes');
  $form = $this
    ->createForm('<form><input type="file" name="foo" value="foo" /><input type="text" name="bar" value="bar" /><input type="submit" /></form>');
  $this
    ->assertEquals(array(
    'bar' => 'bar',
  ), $form
    ->getValues(), '->getValues() does not include file input fields');
  $form = $this
    ->createForm('<form><input type="text" name="foo" value="foo" disabled="disabled" /><input type="text" name="bar" value="bar" /><input type="submit" /></form>');
  $this
    ->assertEquals(array(
    'bar' => 'bar',
  ), $form
    ->getValues(), '->getValues() does not include disabled fields');
}