Prechádzať zdrojové kódy

[Form] Fixed failing DateFieldTest and TimeFieldTest

Bernhard Schussek 14 rokov pred
rodič
commit
acc5c76f77

+ 1 - 0
src/Symfony/Component/Form/FormFactory.php

@@ -613,6 +613,7 @@ class FormFactory
                 ->setValueTransformer(new DateTimeToArrayTransformer(array(
                     'input_timezone' => $options['data_timezone'],
                     'output_timezone' => $options['user_timezone'],
+                    'fields' => array('year', 'month', 'day'),
                 )))
                 ->addRendererPlugin(new DatePatternPlugin($formatter))
                 // Don't modify \DateTime classes by reference, we treat

+ 2 - 2
tests/Symfony/Tests/Component/Form/TimeFieldTest.php

@@ -78,12 +78,12 @@ class TimeFieldTest extends DateTimeTestCase
         $this->assertEquals($input, $field->getDisplayedData());
     }
 
-    public function testSubmit_raw()
+    public function testSubmit_array()
     {
         $field = $this->factory->getTimeField('name', array(
             'data_timezone' => 'UTC',
             'user_timezone' => 'UTC',
-            'type' => 'raw',
+            'type' => 'array',
         ));
 
         $input = array(