diff --git a/core/Translate/Writer.php b/core/Translate/Writer.php index 9ace61b74b6..5ea57a70033 100644 --- a/core/Translate/Writer.php +++ b/core/Translate/Writer.php @@ -207,6 +207,10 @@ protected function getTranslationPathBaseDirectory($base, $lang = null) } } + if ($base == 'tmp') { + return sprintf('%s/%s.json', StaticContainer::getContainer()->get('path.tmp'), $lang); + } + return sprintf('%s/%s/%s.json', PIWIK_INCLUDE_PATH, $base, $lang); } diff --git a/tests/PHPUnit/Unit/CliMulti/OutputTest.php b/tests/PHPUnit/Unit/CliMulti/OutputTest.php index c0105c67c30..11147627b8f 100644 --- a/tests/PHPUnit/Unit/CliMulti/OutputTest.php +++ b/tests/PHPUnit/Unit/CliMulti/OutputTest.php @@ -58,7 +58,7 @@ public function test_exists_ShouldReturnsFalse_IfNothingWrittenYet() public function test_getPathToFile_shouldReturnFullPath() { - $expectedEnd = '/tmp/climulti/myid.output'; + $expectedEnd = '/climulti/myid.output'; $this->assertStringEndsWith($expectedEnd, $this->output->getPathToFile()); $this->assertGreaterThan(strlen($expectedEnd), strlen($this->output->getPathToFile())); diff --git a/tests/PHPUnit/Unit/Translate/WriterTest.php b/tests/PHPUnit/Unit/Translate/WriterTest.php index 66e1efe30aa..e33ce6e74e4 100644 --- a/tests/PHPUnit/Unit/Translate/WriterTest.php +++ b/tests/PHPUnit/Unit/Translate/WriterTest.php @@ -8,6 +8,7 @@ namespace Piwik\Tests\Unit\Translate; +use Piwik\Container\StaticContainer; use Piwik\Translate\Filter\ByBaseTranslations; use Piwik\Translate\Filter\ByParameterCount; use Piwik\Translate\Filter\UnnecassaryWhitespaces; @@ -214,11 +215,13 @@ public function testGetTemporaryTranslationPath($language, $plugin, $path) public function getTranslationPathTemporaryTestData() { + $tmpPath = StaticContainer::getContainer()->get('path.tmp'); + return array( - array('de', null, PIWIK_INCLUDE_PATH . '/tmp/de.json'), - array('te', null, PIWIK_INCLUDE_PATH . '/tmp/te.json'), - array('de', 'CoreHome', PIWIK_INCLUDE_PATH . '/tmp/plugins/CoreHome/lang/de.json'), - array('pt-br', 'Actions', PIWIK_INCLUDE_PATH . '/tmp/plugins/Actions/lang/pt-br.json'), + array('de', null, $tmpPath . '/de.json'), + array('te', null, $tmpPath . '/te.json'), + array('de', 'CoreHome', $tmpPath . '/plugins/CoreHome/lang/de.json'), + array('pt-br', 'Actions', $tmpPath . '/plugins/Actions/lang/pt-br.json'), ); }