Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Use TLS transport for Travis PHP 5.6
Browse files Browse the repository at this point in the history
  • Loading branch information
akrabat committed Feb 22, 2017
1 parent 6076a48 commit 8a5e745
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/ReCaptchaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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';
Expand All @@ -178,11 +181,21 @@ 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');
$context = ['g-recaptcha-response' => getenv('TESTS_ZEND_SERVICE_RECAPTCHA_RESPONSE')];

$this->assertTrue($captcha->isValid($value, $context));
}

private function getHttpClient()
{
return new HttpClient(null, [
'adapter' => new Socket([
'ssltransport' => 'tls',
])
]);
}
}

0 comments on commit 8a5e745

Please sign in to comment.