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

Commit

Permalink
Merge branch 'hotfix/4729'
Browse files Browse the repository at this point in the history
Close #4729
  • Loading branch information
Mike Willbanks committed Jun 26, 2013
2 parents 150fdc3 + 8e326c4 commit 02cf68e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions library/Zend/Captcha/ReCaptcha.php
Expand Up @@ -126,6 +126,12 @@ public function __construct($options = null)
parent::__construct($options);

if (!empty($options)) {
if (array_key_exists('private_key', $options)) {
$this->getService()->setPrivateKey($options['private_key']);
}
if (array_key_exists('public_key', $options)) {
$this->getService()->setPublicKey($options['public_key']);
}
$this->setOptions($options);
}
}
Expand Down
13 changes: 13 additions & 0 deletions tests/ZendTest/Captcha/ReCaptchaTest.php
Expand Up @@ -88,6 +88,19 @@ public function testSetAndGetPublicAndPrivateKeys()
$this->assertSame($privKey, $captcha->getService()->getPrivateKey());
}

public function testSetAndGetRecaptchaServicePublicAndPrivateKeysFromOptions()
{
$publicKey = 'publicKey';
$privateKey = 'privateKey';
$options = array(
'public_key' => $publicKey,
'private_key' => $privateKey
);
$captcha = new ReCaptcha($options);
$this->assertSame($publicKey, $captcha->getService()->getPublicKey());
$this->assertSame($privateKey, $captcha->getService()->getPrivateKey());
}

/** @group ZF-7654 */
public function testConstructorShouldAllowSettingLangOptionOnServiceObject()
{
Expand Down

0 comments on commit 02cf68e

Please sign in to comment.