[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)
|
||||
{
|
||||
$data = array(
|
||||
'id' => $view->vars['id']
|
||||
);
|
||||
$data = array();
|
||||
|
||||
// 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) {
|
||||
$data['view_vars'][$varName] = $this->valueExporter->exportValue($value);
|
||||
|
@ -352,13 +352,16 @@ class FormDataExtractorTest extends \PHPUnit_Framework_TestCase
|
||||
'b' => 'foo',
|
||||
'a' => 'bar',
|
||||
'c' => 'baz',
|
||||
'id' => 'foo_bar',
|
||||
);
|
||||
|
||||
$this->assertSame(array(
|
||||
'id' => 'foo_bar',
|
||||
'view_vars' => array(
|
||||
'a' => "'bar'",
|
||||
'b' => "'foo'",
|
||||
'c' => "'baz'",
|
||||
'id' => "'foo_bar'",
|
||||
),
|
||||
), $this->dataExtractor->extractViewVariables($view));
|
||||
}
|
||||
|
Reference in New Issue
Block a user