Index: library/Zend/Captcha/Dumb.php =================================================================== --- library/Zend/Captcha/Dumb.php (revision 24746) +++ library/Zend/Captcha/Dumb.php (working copy) @@ -37,6 +37,29 @@ class Zend_Captcha_Dumb extends Zend_Captcha_Word { /** + * CAPTCHA label + * @type string + */ + protected $_label = 'Please type this word backwards'; + + /** + * Set the label for the CAPTCHA + * @param string $label + */ + public function setLabel($label) + { + $this->_label = $label; + } + + /** + * Retrieve the label for the CAPTCHA + * @return string + */ + public function getLabel() + { + return $this->_label; + } + /** * Render the captcha * * @param Zend_View_Interface $view @@ -45,7 +68,7 @@ */ public function render(Zend_View_Interface $view = null, $element = null) { - return 'Please type this word backwards: ' + return $this->getLabel() . ': ' . strrev($this->getWord()) . ''; } Index: tests/Zend/Captcha/DumbTest.php =================================================================== --- tests/Zend/Captcha/DumbTest.php (revision 24746) +++ tests/Zend/Captcha/DumbTest.php (working copy) @@ -91,6 +91,23 @@ $this->assertContains(strrev($word), $html); $this->assertNotContains($word, $html); } + + /** + * @group ZF-11522 + */ + public function testDefaultLabelIsUsedWhenNoAlternateLabelSet() + { + $this->assertEquals('Please type this word backwards', $this->captcha->getLabel()); + } + + /** + * @group ZF-11522 + */ + public function testChangeLabelViaSetterMethod() + { + $this->captcha->setLabel('Testing'); + $this->assertEquals('Testing', $this->captcha->getLabel()); + } } class Zend_Captcha_DumbTest_SessionContainer