浏览代码

added a unit test for previous merge

Fabien Potencier 14 年之前
父节点
当前提交
de9f8ab47e
共有 1 个文件被更改,包括 17 次插入0 次删除
  1. 17 0
      tests/Symfony/Tests/Component/Form/AbstractLayoutTest.php

+ 17 - 0
tests/Symfony/Tests/Component/Form/AbstractLayoutTest.php

@@ -383,6 +383,23 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
         );
     }
 
+    public function testChoiceWithOnlyPreferred()
+    {
+        $form = $this->factory->createNamed('choice', 'na&me', '&a', array(
+            'property_path' => 'name',
+            'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
+            'preferred_choices' => array('&a', '&b'),
+            'multiple' => false,
+            'expanded' => false,
+        ));
+
+        $this->assertWidgetMatchesXpath($form->createView(), array(),
+'/select
+    [count(./option)=2]
+'
+        );
+    }
+
     public function testSingleChoiceNonRequired()
     {
         $form = $this->factory->createNamed('choice', 'na&me', '&a', array(