Просмотр исходного кода

Merge r25186 to 1.12 release branch

git-svn-id: http://framework.zend.com/svn/framework/standard/branches/release-1.12@25187 44c647ce-9c0f-0410-b52a-842ac1e357ba
frosch 13 лет назад
Родитель
Сommit
80b275d720
2 измененных файлов с 27 добавлено и 2 удалено
  1. 1 2
      library/Zend/View/Helper/FormSelect.php
  2. 26 0
      tests/Zend/View/Helper/FormSelectTest.php

+ 1 - 2
library/Zend/View/Helper/FormSelect.php

@@ -177,8 +177,7 @@ class Zend_View_Helper_FormSelect extends Zend_View_Helper_FormElement
 
 
         $opt = '<option'
-             . ' value="' . $this->view->escape($value) . '"'
-             . ' label="' . $this->view->escape($label) . '"';
+             . ' value="' . $this->view->escape($value) . '"';
 
              if ($class) {
              $opt .= ' class="' . $class . '"';

+ 26 - 0
tests/Zend/View/Helper/FormSelectTest.php

@@ -76,6 +76,32 @@ class Zend_View_Helper_FormSelectTest extends PHPUnit_Framework_TestCase
         unset($this->helper, $this->view);
     }
 
+    /**
+     * @group ZF-10661
+     */
+    public function testRenderingWithOptions()
+    {
+        $html = $this->helper->formSelect(
+            'foo',
+            null,
+            null,
+            array(
+                 'bar' => 'Bar',
+                 'baz' => 'Baz',
+            )
+        );
+
+        $expected = '<select name="foo" id="foo">'
+                  . PHP_EOL
+                  . '    <option value="bar">Bar</option>'
+                  . PHP_EOL
+                  . '    <option value="baz">Baz</option>'
+                  . PHP_EOL
+                  . '</select>';
+
+        $this->assertSame($expected, $html);
+    }
+
     public function testFormSelectWithNameOnlyCreatesEmptySelect()
     {
         $html = $this->helper->formSelect('foo');