diff --git a/test/ReCaptchaTest.php b/test/ReCaptchaTest.php index a2e590f..9a872db 100644 --- a/test/ReCaptchaTest.php +++ b/test/ReCaptchaTest.php @@ -10,6 +10,8 @@ namespace ZendTest\Captcha; use Zend\Captcha\ReCaptcha; +use Zend\Http\Client as HttpClient; +use Zend\Http\Client\Adapter\Socket; use ZendService\ReCaptcha\ReCaptcha as ReCaptchaService; /** @@ -163,6 +165,7 @@ public function testValidationForDifferentElementName() 'secret_key' => getenv('TESTS_ZEND_SERVICE_RECAPTCHA_SECRET_KEY'), ]); $captcha->getService()->setIp('127.0.0.1'); + $captcha->getService()->setHttpClient($this->getHttpClient()); $response = getenv('TESTS_ZEND_SERVICE_RECAPTCHA_RESPONSE'); $value = 'g-recaptcha-response'; @@ -178,6 +181,7 @@ public function testValidationForResponseElementName() 'secret_key' => getenv('TESTS_ZEND_SERVICE_RECAPTCHA_SECRET_KEY'), ]); $captcha->getService()->setIp('127.0.0.1'); + $captcha->getService()->setHttpClient($this->getHttpClient()); $response = getenv('TESTS_ZEND_SERVICE_RECAPTCHA_RESPONSE'); $value = getenv('TESTS_ZEND_SERVICE_RECAPTCHA_RESPONSE'); @@ -185,4 +189,13 @@ public function testValidationForResponseElementName() $this->assertTrue($captcha->isValid($value, $context)); } + + private function getHttpClient() + { + return new HttpClient(null, [ + 'adapter' => new Socket([ + 'ssltransport' => 'tls', + ]) + ]); + } }