$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(['fo.o' =>
['ba.r' =>
['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(['foo' =>
['bar' => 'foo'
], 'bar' => 'bar'
],
$form->
getPhpValues(), "->getPhpValues() doesn't return empty values"
);
} public function testGetFiles() { $form =
$this->
createForm('<form><input type="file" name="foo[bar]" /><input type="text" name="bar" value="bar" /><input type="submit" /></form>'
);
$this->
assertEquals([],
$form->
getFiles(), '->getFiles() returns an empty array if method is get'
);
$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(['foo[bar]' =>
['name' => '', 'type' => '', 'tmp_name' => '', 'error' => 4, 'size' => 0
]],
$form->
getFiles(), '->getFiles() only returns file fields for POST'
);
$form =
$this->
createForm('<form method="post"><input type="file" name="foo[bar]" /><input type="text" name="bar" value="bar" /><input type="submit" /></form>', 'put'
);
$this->
assertEquals(['foo[bar]' =>
['name' => '', 'type' => '', 'tmp_name' => '', 'error' => 4, 'size' => 0
]],
$form->
getFiles(), '->getFiles() only returns file fields for PUT'
);
$form =
$this->
createForm('<form method="post"><input type="file" name="foo[bar]" /><input type="text" name="bar" value="bar" /><input type="submit" /></form>', 'delete'
);
$this->
assertEquals(['foo[bar]' =>
['name' => '', 'type' => '', 'tmp_name' => '', 'error' => 4, 'size' => 0
]],
$form->
getFiles(), '->getFiles() only returns file fields for DELETE'
);
$form =
$this->
createForm('<form method="post"><input type="file" name="foo[bar]" /><input type="text" name="bar" value="bar" /><input type="submit" /></form>', 'patch'
);