public function FormTest::testGetPhpValues in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/dom-crawler/Tests/FormTest.php \Symfony\Component\DomCrawler\Tests\FormTest::testGetPhpValues()
File
- vendor/
symfony/ dom-crawler/ Tests/ FormTest.php, line 424
Class
Namespace
Symfony\Component\DomCrawler\TestsCode
public function testGetPhpValues() {
$form = $this
->createForm('<form><input type="text" name="foo[bar]" value="foo" /><input type="text" name="bar" value="bar" /><input type="submit" /></form>');
$this
->assertEquals(array(
'foo' => array(
'bar' => 'foo',
),
'bar' => 'bar',
), $form
->getPhpValues(), '->getPhpValues() converts keys with [] to arrays');
$form = $this
->createForm('<form><input type="text" name="fo.o[ba.r]" value="foo" /><input type="text" name="ba r" value="bar" /><input type="submit" /></form>');
$this
->assertEquals(array(
'fo.o' => array(
'ba.r' => 'foo',
),
'ba r' => 'bar',
), $form
->getPhpValues(), '->getPhpValues() preserves periods and spaces in names');
$form = $this
->createForm('<form><input type="text" name="fo.o[ba.r][]" value="foo" /><input type="text" name="fo.o[ba.r][ba.z]" value="bar" /><input type="submit" /></form>');
$this
->assertEquals(array(
'fo.o' => array(
'ba.r' => array(
'foo',
'ba.z' => 'bar',
),
),
), $form
->getPhpValues(), '->getPhpValues() preserves periods and spaces in names recursively');
$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' => array(
'bar' => 'foo',
),
'bar' => 'bar',
), $form
->getPhpValues(), "->getPhpValues() doesn't return empty values");
}