Explorar el Código

Merged r25149 from trunk; resolves ZF-12477

git-svn-id: http://framework.zend.com/svn/framework/standard/branches/release-1.12@25153 44c647ce-9c0f-0410-b52a-842ac1e357ba
cogo hace 13 años
padre
commit
fb4b134912

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

@@ -467,19 +467,6 @@ HTML;
             throw new Zend_Service_ReCaptcha_Exception('Missing ip address');
         }
 
-        if (empty($challengeField)) {
-            /** @see Zend_Service_ReCaptcha_Exception */
-            require_once 'Zend/Service/ReCaptcha/Exception.php';
-            throw new Zend_Service_ReCaptcha_Exception('Missing challenge field');
-        }
-
-        if (empty($responseField)) {
-            /** @see Zend_Service_ReCaptcha_Exception */
-            require_once 'Zend/Service/ReCaptcha/Exception.php';
-
-            throw new Zend_Service_ReCaptcha_Exception('Missing response field');
-        }
-
         /* Fetch an instance of the http client */
         $httpClient = self::getHttpClient();
         $httpClient->resetParameters(true);

+ 4 - 6
tests/Zend/Service/ReCaptcha/ReCaptchaTest.php

@@ -266,18 +266,16 @@ class Zend_Service_ReCaptcha_ReCaptchaTest extends PHPUnit_Framework_TestCase
     }
 
     public function testVerifyWithMissingChallengeField() {
-        $this->setExpectedException('Zend_Service_ReCaptcha_Exception');
-
         $this->_reCaptcha->setPrivateKey($this->_privateKey);
         $this->_reCaptcha->setIp('127.0.0.1');
-        $this->_reCaptcha->verify('', 'response');
+        $response = $this->_reCaptcha->verify('', 'response');
+        $this->assertFalse($response->getStatus());
     }
 
     public function testVerifyWithMissingResponseField() {
-        $this->setExpectedException('Zend_Service_ReCaptcha_Exception');
-
         $this->_reCaptcha->setPrivateKey($this->_privateKey);
         $this->_reCaptcha->setIp('127.0.0.1');
-        $this->_reCaptcha->verify('challenge', '');
+        $response = $this->_reCaptcha->verify('challenge', '');
+        $this->assertFalse($response->getStatus());
     }
 }