word)) { unset($this->word); } $this->element = new Zend_Form_Element_Captcha( 'captchaD', array( 'captcha' => array( 'Dumb', 'sessionClass' => 'Zend_Captcha_DumbTest_SessionContainer' ) ) ); $this->captcha = $this->element->getCaptcha(); } /** * Tears down the fixture, for example, close a network connection. * This method is called after a test is executed. * * @return void */ public function tearDown() { } public function testRendersWordInReverse() { $id = $this->captcha->generate('test'); $word = $this->captcha->getWord(); $html = $this->captcha->render(new Zend_View); $this->assertContains(strrev($word), $html); $this->assertNotContains($word, $html); } } class Zend_Captcha_DumbTest_SessionContainer { protected static $_word; public function __get($name) { if ('word' == $name) { return self::$_word; } return null; } public function __set($name, $value) { if ('word' == $name) { self::$_word = $value; } else { $this->$name = $value; } } public function __isset($name) { if (('word' == $name) && (null !== self::$_word)) { return true; } return false; } public function __call($method, $args) { switch ($method) { case 'setExpirationHops': case 'setExpirationSeconds': $this->$method = array_shift($args); break; default: } } } // Call Zend_Captcha_DumbTest::main() if this source file is executed directly. if (PHPUnit_MAIN_METHOD == "Zend_Captcha_DumbTest::main") { Zend_Captcha_DumbTest::main(); }