Skip to content

Commit

Permalink
Bugfix and tests fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mnapoli committed Dec 8, 2014
1 parent dca8fe4 commit 0761efd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 4 additions & 0 deletions core/Translate/Writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/PHPUnit/Unit/CliMulti/OutputTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down
11 changes: 7 additions & 4 deletions tests/PHPUnit/Unit/Translate/WriterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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'),
);
}

Expand Down

0 comments on commit 0761efd

Please sign in to comment.