From 8ba7e60ef62394ae3eed6c8d1c49c2454aa6a9fb Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Mon, 10 Feb 2014 22:26:10 +0700 Subject: [PATCH 1/2] added unit test for zendframework/zf2#5796 --- test/ExplodeTest.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/ExplodeTest.php b/test/ExplodeTest.php index 229eb6f07..6464a9f40 100644 --- a/test/ExplodeTest.php +++ b/test/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()); + } } From a44aa873cc5ba5ddbf19f5a569cb8586bcbb356f Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 12 Feb 2014 03:19:54 +0700 Subject: [PATCH 2/2] change test method name --- test/ExplodeTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/ExplodeTest.php b/test/ExplodeTest.php index 6464a9f40..f0df2ae22 100644 --- a/test/ExplodeTest.php +++ b/test/ExplodeTest.php @@ -134,7 +134,7 @@ public function testSetValidatorInvalidParam() /** * @group ZF2-5796 */ - public function testGetMessageNotChangeType() + public function testGetMessagesMultipleInvalid() { $validator = new Explode(array( 'validator' => new EmailAddress,