From c59506b71fadc7eb6f67a9c8f753aaf79230c7a6 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Mon, 10 Feb 2014 22:26:10 +0700 Subject: [PATCH] added unit test for #5796 --- tests/ZendTest/Validator/ExplodeTest.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/ZendTest/Validator/ExplodeTest.php b/tests/ZendTest/Validator/ExplodeTest.php index 229eb6f0712..6464a9f40a9 100644 --- a/tests/ZendTest/Validator/ExplodeTest.php +++ b/tests/ZendTest/Validator/ExplodeTest.php @@ -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 testGetMessageNotChangeType() + { + $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('zf-devteam@zend.com,abc,defghij')); + $this->assertEquals($messages, $validator->getMessages()); + } }