Sfoglia il codice sorgente

ZF-4073: apply patch with passing unit test (courtesy Steve Horris)

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19125 44c647ce-9c0f-0410-b52a-842ac1e357ba
matthew 16 anni fa
parent
commit
f6747f1992
1 ha cambiato i file con 19 aggiunte e 0 eliminazioni
  1. 19 0
      tests/Zend/Form/Element/SubmitTest.php

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

@@ -179,6 +179,25 @@ class Zend_Form_Element_SubmitTest extends PHPUnit_Framework_TestCase
         $this->assertTrue($this->element->isChecked());
     }
 
+    /**
+     * Tests that the isChecked method works as expected when using a translator.
+     * @group ZF-4073
+     */
+    public function testIsCheckedReturnsExpectedValueWhenUsingTranslator()
+    {
+        $translations = array('label' => 'translation');
+        $translate = new Zend_Translate('array', $translations);
+
+        $submit = new Zend_Form_Element_Submit('foo', 'label');
+        $submit->setTranslator($translate);
+        $submit->setValue($translations['label']);
+        
+        $this->assertTrue($submit->isChecked());
+
+        $submit->setValue('label');
+        $this->assertFalse($submit->isChecked());
+    }
+
     /*
      * Tests if title attribute (tooltip) is translated if the default decorators are loaded.
      * These decorators should load the Tooltip decorator as the first decorator.