コード例 #1
0
 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', '');
 }
コード例 #2
0
ファイル: ReCaptchaTest.php プロジェクト: navassouza/zf2
 protected function _testVerifyOffline()
 {
     $adapter = new \Zend\Http\Client\Adapter\Test();
     $client = new \Zend\Http\Client(null, array('adapter' => $adapter));
     ReCaptcha\ReCaptcha::setDefaultHttpClient($client);
     $resp = $this->_reCaptcha->verify('challengeField', 'responseField');
     // See if we have a valid object and that the status is false
     $this->assertTrue($resp instanceof ReCaptcha\Response);
     $this->assertFalse($resp->getStatus());
 }
コード例 #3
0
ファイル: MailHide.php プロジェクト: robertodormepoco/zf2
 /**
  * Override the setPrivateKey method
  *
  * Override the parent method to store a binary representation of the private key as well.
  *
  * @param string $privateKey
  * @return \Zend\Service\ReCaptcha\MailHide
  */
 public function setPrivateKey($privateKey)
 {
     parent::setPrivateKey($privateKey);
     /* Pack the private key into a binary string */
     $this->privateKeyPacked = pack('H*', $this->privateKey);
     return $this;
 }