You are here

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

File

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

Class

FormTest

Namespace

Symfony\Component\DomCrawler\Tests

Code

public function testGetPhpFiles() {
  $form = $this
    ->createForm('<form method="post"><input type="file" name="foo[bar]" /><input type="text" name="bar" value="bar" /><input type="submit" /></form>');
  $this
    ->assertEquals(array(
    'foo' => array(
      'bar' => array(
        'name' => '',
        'type' => '',
        'tmp_name' => '',
        'error' => 4,
        'size' => 0,
      ),
    ),
  ), $form
    ->getPhpFiles(), '->getPhpFiles() converts keys with [] to arrays');
  $form = $this
    ->createForm('<form method="post"><input type="file" name="f.o o[bar]" /><input type="text" name="bar" value="bar" /><input type="submit" /></form>');
  $this
    ->assertEquals(array(
    'f.o o' => array(
      'bar' => array(
        'name' => '',
        'type' => '',
        'tmp_name' => '',
        'error' => 4,
        'size' => 0,
      ),
    ),
  ), $form
    ->getPhpFiles(), '->getPhpFiles() preserves periods and spaces in names');
  $form = $this
    ->createForm('<form method="post"><input type="file" name="f.o o[bar][ba.z]" /><input type="file" name="f.o o[bar][]" /><input type="text" name="bar" value="bar" /><input type="submit" /></form>');
  $this
    ->assertEquals(array(
    'f.o o' => array(
      'bar' => array(
        'ba.z' => array(
          'name' => '',
          'type' => '',
          'tmp_name' => '',
          'error' => 4,
          'size' => 0,
        ),
        array(
          'name' => '',
          'type' => '',
          'tmp_name' => '',
          'error' => 4,
          'size' => 0,
        ),
      ),
    ),
  ), $form
    ->getPhpFiles(), '->getPhpFiles() preserves periods and spaces in names recursively');
}