Forráskód Böngészése

added a unit test for previous merge

Fabien Potencier 14 éve
szülő
commit
de9f8ab47e

+ 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(