function testValidate() { $form = new Form(new Controller(), 'Form', new FieldList(), new FieldList()); $f = new RecaptchaField('MyField'); $f->setHTTPClient(new RecaptchaFieldTest_HTTPClient()); $f->setForm($form); $v = new RequiredFields(); $_REQUEST['recaptcha_challenge_field'] = 'valid'; $_REQUEST['recaptcha_response_field'] = 'response'; $this->assertTrue($f->validate($v)); $_REQUEST['recaptcha_challenge_field'] = 'invalid'; $_REQUEST['recaptcha_response_field'] = 'response'; $this->assertFalse($f->validate($v)); unset($_REQUEST['recaptcha_challenge_field']); unset($_REQUEST['recaptcha_response_field']); }