public function testWriteTranslations() { $this->service->writeTranslations(array('english_only_default_sample' => 'Exemple "default" seulement en anglais'), 'fr_FR', 'default'); $this->assertEquals(file_get_contents(getcwd() . '/TranslatorToolsTest/_files/expected/default/fr_FR.php'), file_get_contents(getcwd() . '/TranslatorToolsTest/_files/translations/default/fr_FR.php')); $this->service->writeTranslations(array('english_only_ini-domain_sample' => 'Exemple "ini-domain" seulement en anglais'), 'fr_FR', 'ini-domain'); $this->assertEquals(file_get_contents(getcwd() . '/TranslatorToolsTest/_files/expected/ini-domain/french-file.ini'), file_get_contents(getcwd() . '/TranslatorToolsTest/_files/translations/ini-domain/french-file.ini')); //Copy translation files \TranslatorToolsTest\Bootstrap::rcopy(__DIR__ . '/_files/original', __DIR__ . '/_files/translations'); }
/** * @see PHPUnit_Framework_TestCase::setUp() */ protected function setUp() { $oServiceManager = \TranslatorToolsTest\Bootstrap::getServiceManager(); $this->configuration = \Zend\Stdlib\ArrayUtils::merge($oServiceManager->get('Config'), include __DIR__ . '/../configuration.php'); $bAllowOverride = $oServiceManager->getAllowOverride(); if (!$bAllowOverride) { $oServiceManager->setAllowOverride(true); } $oServiceManager->setService('Config', $this->configuration)->setAllowOverride($bAllowOverride); $this->controller = new \TranslatorTools\Controller\ToolsController(); $this->request = new \Zend\Http\Request(); $this->routeMatch = new \Zend\Mvc\Router\RouteMatch(array('controller' => 'tools')); $this->event = new \Zend\Mvc\MvcEvent(); $this->event->setRouter(\Zend\Mvc\Router\Http\TreeRouteStack::factory(isset($this->configuration['router']) ? $this->configuration['router'] : array()))->setRouteMatch($this->routeMatch); $this->controller->setEvent($this->event); $this->controller->setServiceLocator($oServiceManager); }