/** * Tests if __toString() renders the "captcha solved" message * when the captcha is solved and frozen. */ public function test__toStringFrozenSolved() { $this->nc->toggleFrozen(true); //make sure we have a known captcha question $cap = new Text_CAPTCHA_Numeral(Text_CAPTCHA_Numeral::TEXT_CAPTCHA_NUMERAL_COMPLEXITY_ELEMENTARY, 10, 11); $this->nc->setNumeral($cap); //force session and question intialisation (string) $this->nc; $this->nc->setValue($this->nc->getSession()->answer); $str = (string) $this->nc; //not empty string $this->assertNotEquals('', $str, 'Frozen solved string is empty'); $data = $this->nc->getData(); $this->assertEquals($data['captchaSolved'], $str); }
public function testGetSession() { $c = new HTML_QuickForm2_Element_Captcha_Numeral(); $ses = $c->getSession(); $this->assertInstanceOf('HTML_QuickForm2_Element_Captcha_Session', $ses); }