[Form] Fixed failing FormDataExtractorTest
This commit is contained in:
parent
23f12faa53
commit
4807c5effc
@ -123,9 +123,13 @@ class FormDataExtractor implements FormDataExtractorInterface
|
|||||||
*/
|
*/
|
||||||
public function extractViewVariables(FormView $view)
|
public function extractViewVariables(FormView $view)
|
||||||
{
|
{
|
||||||
$data = array(
|
$data = array();
|
||||||
'id' => $view->vars['id']
|
|
||||||
);
|
// Set the ID in case no FormInterface object was collected for this
|
||||||
|
// view
|
||||||
|
if (isset($view->vars['id'])) {
|
||||||
|
$data['id'] = $view->vars['id'];
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($view->vars as $varName => $value) {
|
foreach ($view->vars as $varName => $value) {
|
||||||
$data['view_vars'][$varName] = $this->valueExporter->exportValue($value);
|
$data['view_vars'][$varName] = $this->valueExporter->exportValue($value);
|
||||||
|
@ -352,13 +352,16 @@ class FormDataExtractorTest extends \PHPUnit_Framework_TestCase
|
|||||||
'b' => 'foo',
|
'b' => 'foo',
|
||||||
'a' => 'bar',
|
'a' => 'bar',
|
||||||
'c' => 'baz',
|
'c' => 'baz',
|
||||||
|
'id' => 'foo_bar',
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertSame(array(
|
$this->assertSame(array(
|
||||||
|
'id' => 'foo_bar',
|
||||||
'view_vars' => array(
|
'view_vars' => array(
|
||||||
'a' => "'bar'",
|
'a' => "'bar'",
|
||||||
'b' => "'foo'",
|
'b' => "'foo'",
|
||||||
'c' => "'baz'",
|
'c' => "'baz'",
|
||||||
|
'id' => "'foo_bar'",
|
||||||
),
|
),
|
||||||
), $this->dataExtractor->extractViewVariables($view));
|
), $this->dataExtractor->extractViewVariables($view));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user