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

Commit

Permalink
Merge pull request zendframework/zendframework#1885 from weierophinne…
Browse files Browse the repository at this point in the history
…y/hotfix/captcha-validator-messages

Fix error messages in captcha validators
  • Loading branch information
Freeaqingme committed Jul 13, 2012
5 parents c98293e + 8ab0513 + 91eef93 + ec0fa7a + 9fa1b67 commit 72c713c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/AbstractWord.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ abstract class AbstractWord extends AbstractAdapter
* Error messages
* @var array
*/
protected $_messageTemplates = array(
protected $messageTemplates = array(
self::MISSING_VALUE => 'Empty captcha value',
self::MISSING_ID => 'Captcha ID field is missing',
self::BAD_CAPTCHA => 'Captcha value is wrong',
Expand Down
2 changes: 1 addition & 1 deletion src/ReCaptcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class ReCaptcha extends AbstractAdapter
* Error messages
* @var array
*/
protected $_messageTemplates = array(
protected $messageTemplates = array(
self::MISSING_VALUE => 'Missing captcha fields',
self::ERR_CAPTCHA => 'Failed to validate captcha',
self::BAD_CAPTCHA => 'Captcha value is wrong: %value%',
Expand Down
8 changes: 8 additions & 0 deletions test/CommonWordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,12 @@ public function testLoadInvalidSessionClass()
$this->setExpectedException('Zend\Captcha\Exception\InvalidArgumentException', 'not found');
$wordAdapter->getSession();
}

public function testErrorMessages()
{
$wordAdapter = new $this->wordClass;
$this->assertFalse($wordAdapter->isValid('foo'));
$messages = $wordAdapter->getMessages();
$this->assertFalse(empty($messages));
}
}

0 comments on commit 72c713c

Please sign in to comment.