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

Commit

Permalink
Merge branch 'hotfix/5111' into develop
Browse files Browse the repository at this point in the history
Forward port zendframework/zendframework#5111

Conflicts:
	tests/ZendTest/I18n/Translator/Loader/GettextTest.php
	tests/ZendTest/I18n/Translator/Loader/PhpArrayTest.php
  • Loading branch information
weierophinney committed Oct 22, 2013
2 parents 6f8316f + c8a1dba commit d97c259
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions test/ProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,10 @@ public function testPHPConstants()

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

$config = new Config($this->translatorData, true);
$translator = new Translator();
$translator->addTranslationFile('phparray', $this->translatorFile);
Expand All @@ -342,6 +346,23 @@ public function testTranslator()
$this->assertEquals('zwei Hunde', $config->pages[1]->label);
}

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

$this->setExpectedException('Zend\I18n\Exception\ExtensionNotLoadedException',
'Zend\I18n\Translator component requires the intl PHP extension');

$config = new Config($this->translatorData, true);
$translator = new Translator();
$translator->addTranslationFile('phparray', $this->translatorFile);
$processor = new TranslatorProcessor($translator);

$processor->process($config);
}

public function testTranslatorReadOnly()
{
$config = new Config($this->translatorData, false);
Expand All @@ -355,6 +376,26 @@ public function testTranslatorReadOnly()

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

$translator = new Translator();
$translator->addTranslationFile('phparray', $this->translatorFile);
$processor = new TranslatorProcessor($translator);

$this->assertEquals('ein Hund', $processor->processValue('one dog'));
}

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

$this->setExpectedException('Zend\I18n\Exception\ExtensionNotLoadedException',
'Zend\I18n\Translator component requires the intl PHP extension');

$translator = new Translator();
$translator->addTranslationFile('phparray', $this->translatorFile);
$processor = new TranslatorProcessor($translator);
Expand Down

0 comments on commit d97c259

Please sign in to comment.