diff --git a/test/ProcessorTest.php b/test/ProcessorTest.php index 058cd8a..02fd833 100644 --- a/test/ProcessorTest.php +++ b/test/ProcessorTest.php @@ -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); @@ -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); @@ -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);