Parcourir la source

ZF-4453: Make the button and submit form elements be ignored by default.

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19123 44c647ce-9c0f-0410-b52a-842ac1e357ba
sidhighwind il y a 16 ans
Parent
commit
284595f4f8

+ 4 - 0
library/Zend/Form/Element/Submit.php

@@ -52,6 +52,10 @@ class Zend_Form_Element_Submit extends Zend_Form_Element_Xhtml
         if (is_string($spec) && ((null !== $options) && is_string($options))) {
             $options = array('label' => $options);
         }
+        
+        if (!isset($options['ignore'])) {
+            $options['ignore'] = true;
+        }
 
         parent::__construct($spec, $options);
     }

+ 5 - 0
tests/Zend/Form/Element/ButtonTest.php

@@ -147,6 +147,11 @@ class Zend_Form_Element_ButtonTest extends PHPUnit_Framework_TestCase
         $this->assertContains('Button Label', $html, $html);
         $this->assertNotContains('value="', $html);
     }
+    
+    public function testSetDefaultIgnoredToTrueWhenNotDefined()
+    {
+        $this->assertTrue($this->element->getIgnore());
+    }
 
     /**
      * Used by test methods susceptible to ZF-2794, marks a test as incomplete

+ 5 - 0
tests/Zend/Form/Element/SubmitTest.php

@@ -207,6 +207,11 @@ class Zend_Form_Element_SubmitTest extends PHPUnit_Framework_TestCase
         $this->assertContains('bar', $html);
         $this->assertNotContains('baz', $html);
     }
+    
+    public function testSetDefaultIgnoredToTrueWhenNotDefined()
+    {
+        $this->assertTrue($this->element->getIgnore());
+    }
 
     /**
      * Used by test methods susceptible to ZF-2794, marks a test as incomplete