瀏覽代碼

[Form] ChoiceField test for using ArrayObject as choices option

Jeremy Mikola 15 年之前
父節點
當前提交
2b776bf2e8
共有 1 個文件被更改,包括 14 次插入0 次删除
  1. 14 0
      tests/Symfony/Tests/Component/Form/ChoiceFieldTest.php

+ 14 - 0
tests/Symfony/Tests/Component/Form/ChoiceFieldTest.php

@@ -28,6 +28,20 @@ class ChoiceFieldTest extends \PHPUnit_Framework_TestCase
         )
     );
 
+    public function testConfigureChoicesWithArrayObject()
+    {
+        $choices = new \ArrayObject($this->choices);
+
+        $field = new ChoiceField('name', array(
+            'multiple' => false,
+            'expanded' => true,
+            'choices' => $choices,
+            'preferred_choices' => $this->preferredChoices,
+        ));
+
+        $this->assertEquals($this->choices, $choices->getArrayCopy());
+    }
+
     public function testBindSingleNonExpanded()
     {
         $field = new ChoiceField('name', array(