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

Commit

Permalink
Fix Zend\Validator tests when missing ext/intl
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/AbstractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ public function testGlobalDefaultTranslatorNullByDefault()

public function testErrorMessagesAreTranslatedWhenTranslatorPresent()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$loader = new TestAsset\ArrayTranslator();
$loader->translations = array(
'fooMessage' => 'This is the translated message for %value%',
Expand All @@ -92,6 +96,10 @@ public function testErrorMessagesAreTranslatedWhenTranslatorPresent()

public function testCanTranslateMessagesInsteadOfKeys()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$loader = new TestAsset\ArrayTranslator();
$loader->translations = array(
'%value% was passed' => 'This is the translated message for %value%',
Expand Down Expand Up @@ -153,6 +161,10 @@ public function testTranslatorEnabledPerDefault()

public function testCanDisableTranslator()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$loader = new TestAsset\ArrayTranslator();
$loader->translations = array(
'%value% was passed' => 'This is the translated message for %value%',
Expand Down
4 changes: 4 additions & 0 deletions test/EmailAddressTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,10 @@ public function testGetMessages()
*/
public function testHostnameValidatorMessagesShouldBeTranslated()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$hostnameValidator = new Hostname();
$translations = array(
'hostnameIpAddressNotAllowed' => 'hostnameIpAddressNotAllowed translation',
Expand Down
4 changes: 4 additions & 0 deletions test/HostnameTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,10 @@ public function testGetAllow()
*/
public function testValidatorMessagesShouldBeTranslated()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$translations = array(
'hostnameInvalidLocalName' => 'this is the IP error message',
);
Expand Down
4 changes: 4 additions & 0 deletions test/StaticValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ public function testLocalTranslatorPreferredOverGlobalTranslator()

public function testMaximumErrorMessageLength()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$this->assertEquals(-1, AbstractValidator::getMessageLength());
AbstractValidator::setMessageLength(10);
$this->assertEquals(10, AbstractValidator::getMessageLength());
Expand Down

0 comments on commit 0fd1b39

Please sign in to comment.