public function testValidateWrong() { $tc = new HTML_QuickForm2_Element_Captcha_TextCAPTCHA(null, null, array('captchaType' => 'Word', 'phrase' => '123')); $tc->setSession(new HTML_QuickForm2_Element_Captcha_Session_Mock()); $tc->setValue('234'); $vcm = new ReflectionMethod(get_class($tc), 'validate'); $vcm->setAccessible(true); $this->assertFalse($vcm->invoke($tc)); }
public function testAlreadySolved() { $tc = new HTML_QuickForm2_Element_Captcha_TextCAPTCHA(null, null, array('captchaType' => 'Word', 'phrase' => '123')); $tc->setSession(new HTML_QuickForm2_Element_Captcha_Session_Mock()); $tc->setValue(123); $one = (string) $tc; $two = (string) $tc; $this->assertContains('Captcha already solved', $one); $this->assertEquals($one, $two); }