Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@googlemail.com>2014-08-24 23:01:40 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-08-24 23:14:45 +0400
commit156e75dc10ddc83af1cab876cde5447767144d17 (patch)
tree45ce17b1c74b3f994f820f939689d26415ca8d54 /tests/PHPUnit/Core
parent66051885ab45f9ee9ad0609a23d7e6d48e47868c (diff)
refs #5863 fixed some of the tests
Diffstat (limited to 'tests/PHPUnit/Core')
-rw-r--r--tests/PHPUnit/Core/Columns/DimensionTest.php2
-rw-r--r--tests/PHPUnit/Core/Period/DayTest.php15
-rw-r--r--tests/PHPUnit/Core/Period/MonthTest.php15
-rw-r--r--tests/PHPUnit/Core/Period/RangeTest.php12
-rw-r--r--tests/PHPUnit/Core/Period/WeekTest.php12
5 files changed, 42 insertions, 14 deletions
diff --git a/tests/PHPUnit/Core/Columns/DimensionTest.php b/tests/PHPUnit/Core/Columns/DimensionTest.php
index c9764fd1df..df694ee030 100644
--- a/tests/PHPUnit/Core/Columns/DimensionTest.php
+++ b/tests/PHPUnit/Core/Columns/DimensionTest.php
@@ -9,8 +9,6 @@
namespace Piwik\Plugins\Test;
// there is a test that requires the class to be defined in a plugin
-use Piwik\Cache\PersistentCache;
-use Piwik\Cache\StaticCache;
use Piwik\Columns\Dimension;
use Piwik\Config;
use Piwik\Plugin\Segment;
diff --git a/tests/PHPUnit/Core/Period/DayTest.php b/tests/PHPUnit/Core/Period/DayTest.php
index 8321a3bddc..93e3c40c56 100644
--- a/tests/PHPUnit/Core/Period/DayTest.php
+++ b/tests/PHPUnit/Core/Period/DayTest.php
@@ -215,7 +215,8 @@ class Period_DayTest extends PHPUnit_Framework_TestCase
*/
public function testGetLocalizedShortString()
{
- Translate::loadEnglishTranslation();
+ $this->loadEnglishTranslation();
+
$month = new Day(Date::factory('2024-10-09'));
$shouldBe = 'Wed 9 Oct';
$this->assertEquals($shouldBe, $month->getLocalizedShortString());
@@ -226,7 +227,8 @@ class Period_DayTest extends PHPUnit_Framework_TestCase
*/
public function testGetLocalizedLongString()
{
- Translate::loadEnglishTranslation();
+ $this->loadEnglishTranslation();
+
$month = new Day(Date::factory('2024-10-09'));
$shouldBe = 'Wednesday 9 October 2024';
$this->assertEquals($shouldBe, $month->getLocalizedLongString());
@@ -237,9 +239,16 @@ class Period_DayTest extends PHPUnit_Framework_TestCase
*/
public function testGetPrettyString()
{
- Translate::loadEnglishTranslation();
+ $this->loadEnglishTranslation();
+
$month = new Day(Date::factory('2024-10-09'));
$shouldBe = '2024-10-09';
$this->assertEquals($shouldBe, $month->getPrettyString());
}
+
+ private function loadEnglishTranslation()
+ {
+ Translate::loadEnglishTranslation();
+ \Piwik\Plugin\Manager::getInstance()->loadPluginTranslations('en');
+ }
} \ No newline at end of file
diff --git a/tests/PHPUnit/Core/Period/MonthTest.php b/tests/PHPUnit/Core/Period/MonthTest.php
index b22e209725..2b2de451e1 100644
--- a/tests/PHPUnit/Core/Period/MonthTest.php
+++ b/tests/PHPUnit/Core/Period/MonthTest.php
@@ -271,7 +271,8 @@ class Period_MonthTest extends PHPUnit_Framework_TestCase
*/
public function testGetLocalizedShortString()
{
- Translate::loadEnglishTranslation();
+ $this->loadEnglishTranslation();
+
$month = new Month(Date::factory('2024-10-09'));
$shouldBe = 'Oct 2024';
$this->assertEquals($shouldBe, $month->getLocalizedShortString());
@@ -282,7 +283,8 @@ class Period_MonthTest extends PHPUnit_Framework_TestCase
*/
public function testGetLocalizedLongString()
{
- Translate::loadEnglishTranslation();
+ $this->loadEnglishTranslation();
+
$month = new Month(Date::factory('2024-10-09'));
$shouldBe = '2024, October';
$this->assertEquals($shouldBe, $month->getLocalizedLongString());
@@ -293,9 +295,16 @@ class Period_MonthTest extends PHPUnit_Framework_TestCase
*/
public function testGetPrettyString()
{
- Translate::loadEnglishTranslation();
+ $this->loadEnglishTranslation();
+
$month = new Month(Date::factory('2024-10-09'));
$shouldBe = '2024-10';
$this->assertEquals($shouldBe, $month->getPrettyString());
}
+
+ private function loadEnglishTranslation()
+ {
+ Translate::loadEnglishTranslation();
+ \Piwik\Plugin\Manager::getInstance()->loadPluginTranslations('en');
+ }
} \ No newline at end of file
diff --git a/tests/PHPUnit/Core/Period/RangeTest.php b/tests/PHPUnit/Core/Period/RangeTest.php
index c99abfd3ef..17c9cb1ab6 100644
--- a/tests/PHPUnit/Core/Period/RangeTest.php
+++ b/tests/PHPUnit/Core/Period/RangeTest.php
@@ -1259,7 +1259,7 @@ class Period_RangeTest extends PHPUnit_Framework_TestCase
*/
public function testGetLocalizedShortString()
{
- Translate::loadEnglishTranslation();
+ $this->loadEnglishTranslation();
$month = new Range('range', '2000-12-09,2001-02-01');
$shouldBe = '9 Dec 00 - 1 Feb 01';
$this->assertEquals($shouldBe, $month->getLocalizedShortString());
@@ -1270,7 +1270,7 @@ class Period_RangeTest extends PHPUnit_Framework_TestCase
*/
public function testGetLocalizedLongString()
{
- Translate::loadEnglishTranslation();
+ $this->loadEnglishTranslation();
$month = new Range('range', '2023-05-09,2023-05-21');
$shouldBe = '8 May 23 - 21 May 23';
$this->assertEquals($shouldBe, $month->getLocalizedLongString());
@@ -1281,7 +1281,7 @@ class Period_RangeTest extends PHPUnit_Framework_TestCase
*/
public function testGetPrettyString()
{
- Translate::loadEnglishTranslation();
+ $this->loadEnglishTranslation();
$month = new Range('range', '2007-02-09,2007-03-15');
$shouldBe = 'From 2007-02-09 to 2007-03-15';
$this->assertEquals($shouldBe, $month->getPrettyString());
@@ -1309,4 +1309,10 @@ class Period_RangeTest extends PHPUnit_Framework_TestCase
$range = new Range($period, 'last' . $lastN);
$this->assertEquals($expectedLastN, $range->getNumberOfSubperiods());
}
+
+ private function loadEnglishTranslation()
+ {
+ Translate::loadEnglishTranslation();
+ \Piwik\Plugin\Manager::getInstance()->loadPluginTranslations('en');
+ }
}
diff --git a/tests/PHPUnit/Core/Period/WeekTest.php b/tests/PHPUnit/Core/Period/WeekTest.php
index e0d1ae7dc7..1fb02b434d 100644
--- a/tests/PHPUnit/Core/Period/WeekTest.php
+++ b/tests/PHPUnit/Core/Period/WeekTest.php
@@ -123,7 +123,7 @@ class Period_WeekTest extends PHPUnit_Framework_TestCase
*/
public function testGetLocalizedShortString()
{
- Translate::loadEnglishTranslation();
+ $this->loadEnglishTranslation();
$week = new Week(Date::factory('2024-10-09'));
$shouldBe = '7 Oct - 13 Oct 24';
$this->assertEquals($shouldBe, $week->getLocalizedShortString());
@@ -134,7 +134,7 @@ class Period_WeekTest extends PHPUnit_Framework_TestCase
*/
public function testGetLocalizedLongString()
{
- Translate::loadEnglishTranslation();
+ $this->loadEnglishTranslation();
$week = new Week(Date::factory('2024-10-09'));
$shouldBe = 'Week 7 October - 13 October 2024';
$this->assertEquals($shouldBe, $week->getLocalizedLongString());
@@ -145,9 +145,15 @@ class Period_WeekTest extends PHPUnit_Framework_TestCase
*/
public function testGetPrettyString()
{
- Translate::loadEnglishTranslation();
+ $this->loadEnglishTranslation();
$week = new Week(Date::factory('2024-10-09'));
$shouldBe = 'From 2024-10-07 to 2024-10-13';
$this->assertEquals($shouldBe, $week->getPrettyString());
}
+
+ private function loadEnglishTranslation()
+ {
+ Translate::loadEnglishTranslation();
+ \Piwik\Plugin\Manager::getInstance()->loadPluginTranslations('en');
+ }
}