forked from zendframework/zendframework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request zendframework#5808 from samsonasik/fix/multiple-in…
…valid-explodevalidator Fixes zendframework#5796
- Loading branch information
Showing
2 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
namespace ZendTest\Validator; | ||
|
||
use Zend\Validator\Explode; | ||
use Zend\Validator\EmailAddress; | ||
|
||
/** | ||
* @group Zend_Validator | ||
|
@@ -129,4 +130,25 @@ public function testSetValidatorInvalidParam() | |
$validator = new Explode(); | ||
$validator->setValidator('inarray'); | ||
} | ||
|
||
/** | ||
* @group ZF2-5796 | ||
*/ | ||
public function testGetMessagesMultipleInvalid() | ||
{ | ||
$validator = new Explode(array( | ||
'validator' => new EmailAddress, | ||
'valueDelimiter' => ',', | ||
'breakOnFirstFailure' => true, | ||
)); | ||
|
||
$messages = array( | ||
0 => array( | ||
'emailAddressInvalidFormat' => 'The input is not a valid email address. Use the basic format local-part@hostname', | ||
), | ||
); | ||
|
||
$this->assertFalse($validator->isValid('[email protected],abc,defghij')); | ||
$this->assertEquals($messages, $validator->getMessages()); | ||
} | ||
} |