Ver Fonte

revert r22461

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22462 44c647ce-9c0f-0410-b52a-842ac1e357ba
alab há 15 anos atrás
pai
commit
26e2acd55e
2 ficheiros alterados com 4 adições e 27 exclusões
  1. 4 9
      library/Zend/Form.php
  2. 0 18
      tests/Zend/Form/FormTest.php

+ 4 - 9
library/Zend/Form.php

@@ -1248,16 +1248,11 @@ class Zend_Form implements Iterator, Countable, Zend_Validate_Interface
      *
      * Sets values for all elements specified in the array of $defaults.
      *
-     * @param mixed $defaults array|ArrayAccess
+     * @param  array $defaults
      * @return Zend_Form
      */
-    public function setDefaults($defaults)
+    public function setDefaults(array $defaults)
     {
-        if (!is_array($defaults) && !($defaults instanceof ArrayAccess)) {
-            throw new Zend_Form_Exception(__METHOD__ .
-                                          ' expects param $defaults to be an array or an ArrayAccess Object');
-        }
-
         $eBelongTo = null;
 
         if ($this->isArray()) {
@@ -2022,10 +2017,10 @@ class Zend_Form implements Iterator, Countable, Zend_Validate_Interface
      *
      * Proxies to {@link setDefaults()}
      *
-     * @param mixed $values array|ArrayAccess
+     * @param  array $values
      * @return Zend_Form
      */
-    public function populate($values)
+    public function populate(array $values)
     {
         return $this->setDefaults($values);
     }

+ 0 - 18
tests/Zend/Form/FormTest.php

@@ -4310,22 +4310,6 @@ class Zend_Form_FormTest extends PHPUnit_Framework_TestCase
     }
 
     /**
-     * @group ZF-10016
-     */
-    public function testSetDefaultsAcceptsArrayAccessObject()
-    {
-        $val = new ArrayObject(array('foo' => 'val'));
-        $this->assertTrue($val instanceof ArrayAccess);
-
-        try {
-            $this->form->addElement('text', 'foo')
-                       ->setDefaults($val);
-        } catch (Zend_Form_Exception $e) {}
-        
-        $this->assertSame('val', $this->form->foo->getValue());
-    }
-
-    /**
      * Used by test methods susceptible to ZF-2794, marks a test as incomplete
      *
      * @link   http://framework.zend.com/issues/browse/ZF-2794
@@ -4348,8 +4332,6 @@ class Zend_Form_FormTest extends PHPUnit_Framework_TestCase
     {
         $this->assertSame($this->form, $this->form->loadDefaultDecorators());
     }
-
-
 }
 
 class Zend_Form_FormTest_DisplayGroup extends Zend_Form_DisplayGroup