[Form] Fixed failing FormDataExtractorTest

This commit is contained in:
Bernhard Schussek 2013-10-30 13:42:39 +01:00
parent 23f12faa53
commit 4807c5effc
2 changed files with 10 additions and 3 deletions

View File

@ -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);

View File

@ -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));
}