소스 검색

Merged r25147 from trunk; resolves ZF-9531

git-svn-id: http://framework.zend.com/svn/framework/standard/branches/release-1.12@25151 44c647ce-9c0f-0410-b52a-842ac1e357ba
cogo 13 년 전
부모
커밋
5b2bf992b8
2개의 변경된 파일4개의 추가작업 그리고 14개의 파일을 삭제
  1. 1 0
      library/Zend/Service/ReCaptcha.php
  2. 3 14
      tests/Zend/Service/ReCaptcha/ReCaptchaTest.php

+ 1 - 0
library/Zend/Service/ReCaptcha.php

@@ -482,6 +482,7 @@ HTML;
 
         /* Fetch an instance of the http client */
         $httpClient = self::getHttpClient();
+        $httpClient->resetParameters(true);
 
         $postParams = array('privatekey' => $this->_privateKey,
                             'remoteip'   => $this->_ip,

+ 3 - 14
tests/Zend/Service/ReCaptcha/ReCaptchaTest.php

@@ -210,20 +210,6 @@ class Zend_Service_ReCaptcha_ReCaptchaTest extends PHPUnit_Framework_TestCase
         $this->_reCaptcha->setPrivateKey($this->_privateKey);
         $this->_reCaptcha->setIp('127.0.0.1');
 
-        if (defined('TESTS_ZEND_SERVICE_RECAPTCHA_ONLINE_ENABLED') &&
-            constant('TESTS_ZEND_SERVICE_RECAPTCHA_ONLINE_ENABLED')) {
-
-            $this->_testVerifyOnline();
-        } else {
-            $this->_testVerifyOffline();
-        }
-    }
-
-    protected function _testVerifyOnline() {
-
-    }
-
-    protected function _testVerifyOffline() {
         $adapter = new Zend_Http_Client_Adapter_Test();
         $client = new Zend_Http_Client(null, array(
             'adapter' => $adapter
@@ -231,7 +217,10 @@ class Zend_Service_ReCaptcha_ReCaptchaTest extends PHPUnit_Framework_TestCase
 
         Zend_Service_ReCaptcha::setHttpClient($client);
 
+        // Set a header that will be reset in the recaptcha class before sending the request
+        $client->setHeaders('host', 'example.com');
         $resp = $this->_reCaptcha->verify('challengeField', 'responseField');
+        $this->assertNotSame('example.com', $client->getHeader('host'));
 
         // See if we have a valid object and that the status is false
         $this->assertTrue($resp instanceof Zend_Service_ReCaptcha_Response);