This repository has been archived by the owner on Jan 31, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'hotfix/4120' into develop
- Loading branch information
103 parents
a07f208
+
4ea0bc2
+
860b725
+
7d29287
+
49a7844
+
3836aa0
+
de1fe83
+
929eb12
+
6e6902f
+
f823467
+
f3b3f76
+
93aff47
+
5f2adec
+
7674ec8
+
2200ed2
+
f033c86
+
d43a2da
+
4434323
+
88b21e1
+
b02b602
+
b692de7
+
7f833d2
+
2eaf4da
+
a7848de
+
5bd9f85
+
d7a26e8
+
173f53d
+
bd77e8e
+
45f017e
+
118612c
+
3a09f79
+
47d92bc
+
dbf56ad
+
a753b61
+
6467186
+
5ac4124
+
2bf68ca
+
e7cd709
+
7a552db
+
f112e0c
+
cec42fc
+
066eb37
+
3569d8b
+
00def10
+
ecae47b
+
0e552a5
+
4f854c2
+
2b17650
+
c1c0447
+
73b1f80
+
dd4a335
+
a40eb42
+
9262db1
+
bdbd950
+
6d50117
+
10b08a7
+
f692a0d
+
ebe63d3
+
528260b
+
5f04a7f
+
c0dcd12
+
224f280
+
8785f25
+
866539b
+
d711927
+
e280213
+
002f0d4
+
5ffcbbe
+
8937705
+
5803840
+
3d7cd9a
+
6b14f0e
+
24bd169
+
0eba870
+
4e4acfe
+
9e243bd
+
e156354
+
2a84563
+
3f1f758
+
4e425f4
+
7030f97
+
ea08a0f
+
213ebd9
+
5d80740
+
800c29c
+
be31ff1
+
8f989d6
+
8b02a8b
+
4cfd82c
+
c411f06
+
4229561
+
b321e3b
+
2e660f9
+
3fff65f
+
a2eb7bf
+
82469ff
+
22fa741
+
99819cb
+
8c16404
+
a7c0820
+
963d2fe
+
1100f88
+
825f640
commit 92c9b0f
Showing
4 changed files
with
59 additions
and
6 deletions.
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 |
---|---|---|
|
@@ -13,6 +13,8 @@ | |
use ReflectionMethod; | ||
use Zend\I18n\Translator\Translator; | ||
use Zend\Validator\AbstractValidator; | ||
use Zend\Validator\EmailAddress; | ||
use Zend\Validator\Hostname; | ||
|
||
/** | ||
* @category Zend | ||
|
@@ -181,10 +183,12 @@ public function testGetMessageTemplates() | |
{ | ||
$messages = $this->validator->getMessageTemplates(); | ||
$this->assertEquals( | ||
array('fooMessage' => '%value% was passed'), $messages); | ||
array('fooMessage' => '%value% was passed', | ||
'barMessage' => '%value% was wrong'), $messages); | ||
|
||
$this->assertEquals( | ||
array(TestAsset\ConcreteValidator::FOO_MESSAGE => '%value% was passed'), | ||
array(TestAsset\ConcreteValidator::FOO_MESSAGE => '%value% was passed', | ||
TestAsset\ConcreteValidator::BAR_MESSAGE => '%value% was wrong'), | ||
$messages | ||
); | ||
} | ||
|
@@ -239,6 +243,52 @@ public function testMessageCreationWithNestedArrayValueDoesNotRaiseNotice() | |
$this->assertContains('baz', $message); | ||
} | ||
|
||
public function testNonIdenticalMessagesAllReturned() | ||
{ | ||
$this->assertFalse($this->validator->isValid('invalid')); | ||
|
||
$messages = $this->validator->getMessages(); | ||
|
||
$this->assertCount(2, $messages); | ||
$this->assertEquals(array( | ||
TestAsset\ConcreteValidator::FOO_MESSAGE => 'invalid was passed', | ||
TestAsset\ConcreteValidator::BAR_MESSAGE => 'invalid was wrong' | ||
), $messages); | ||
} | ||
|
||
public function testIdenticalMessagesNotReturned() | ||
{ | ||
$this->validator->setMessage('Default error message'); | ||
|
||
$this->assertFalse($this->validator->isValid('invalid')); | ||
|
||
$messages = $this->validator->getMessages(); | ||
|
||
$this->assertCount(1, $messages); | ||
$this->assertEquals('Default error message', reset($messages)); | ||
} | ||
|
||
public function testIdenticalAndNonIdenticalMessagesReturned() | ||
{ | ||
$validator = new EmailAddress(); | ||
|
||
$this->assertFalse($validator->isValid('[email protected]')); | ||
$this->assertCount(3, $validator->getMessages()); | ||
$this->assertArrayHasKey(EmailAddress::INVALID_HOSTNAME, $validator->getMessages()); | ||
$this->assertArrayHasKey(Hostname::UNKNOWN_TLD, $validator->getMessages()); | ||
$this->assertArrayHasKey(Hostname::LOCAL_NAME_NOT_ALLOWED, $validator->getMessages()); | ||
|
||
$validator->setMessages(array( | ||
EmailAddress::INVALID_HOSTNAME => 'This is the same error message', | ||
Hostname::UNKNOWN_TLD => 'This is the same error message' | ||
)); | ||
|
||
$this->assertFalse($validator->isValid('[email protected]')); | ||
$this->assertCount(2, $validator->getMessages()); | ||
$this->assertArrayHasKey(EmailAddress::INVALID_HOSTNAME, $validator->getMessages()); | ||
$this->assertArrayHasKey(Hostname::LOCAL_NAME_NOT_ALLOWED, $validator->getMessages()); | ||
} | ||
|
||
/** | ||
* Ignores a raised PHP error when in effect, but throws a flag to indicate an error occurred | ||
* | ||
|
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