diff options
Diffstat (limited to 'tests/PHPUnit/Core/PeriodTest.php')
-rw-r--r-- | tests/PHPUnit/Core/PeriodTest.php | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/tests/PHPUnit/Core/PeriodTest.php b/tests/PHPUnit/Core/PeriodTest.php index 6021218214..0b315b2527 100644 --- a/tests/PHPUnit/Core/PeriodTest.php +++ b/tests/PHPUnit/Core/PeriodTest.php @@ -6,6 +6,10 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ use Piwik\Period; +use Piwik\Date; +use Piwik\Period\Month; +use Piwik\Period\Day; +use Piwik\Period\Week; class PeriodTest extends PHPUnit_Framework_TestCase { @@ -15,13 +19,13 @@ class PeriodTest extends PHPUnit_Framework_TestCase */ public function testGetId() { - $period = new Piwik_Period_Day(Piwik_Date::today()); + $period = new Day(Date::today()); $this->assertNotEquals(0, $period->getId()); - $period = new Piwik_Period_Week(Piwik_Date::today()); + $period = new Week(Date::today()); $this->assertNotEquals(0, $period->getId()); - $period = new Piwik_Period_Month(Piwik_Date::today()); + $period = new Month(Date::today()); $this->assertNotEquals(0, $period->getId()); - $period = new Piwik_Period_Year(Piwik_Date::today()); + $period = new Piwik_Period_Year(Date::today()); $this->assertNotEquals(0, $period->getId()); } @@ -31,19 +35,19 @@ class PeriodTest extends PHPUnit_Framework_TestCase */ public function testGetLabel() { - $period = new Piwik_Period_Day(Piwik_Date::today()); + $period = new Day(Date::today()); $label = $period->getLabel(); $this->assertInternalType('string', $label); $this->assertNotEmpty($label); - $period = new Piwik_Period_Week(Piwik_Date::today()); + $period = new Week(Date::today()); $label = $period->getLabel(); $this->assertInternalType('string', $label); $this->assertNotEmpty($label); - $period = new Piwik_Period_Month(Piwik_Date::today()); + $period = new Month(Date::today()); $label = $period->getLabel(); $this->assertInternalType('string', $label); $this->assertNotEmpty($label); - $period = new Piwik_Period_Year(Piwik_Date::today()); + $period = new Piwik_Period_Year(Date::today()); $label = $period->getLabel(); $this->assertInternalType('string', $label); $this->assertNotEmpty($label); @@ -55,8 +59,8 @@ class PeriodTest extends PHPUnit_Framework_TestCase */ public function testFactoryDay() { - $period = Period::factory('day', Piwik_Date::today()); - $this->assertInstanceOf('Piwik_Period_Day', $period); + $period = Period::factory('day', Date::today()); + $this->assertInstanceOf('Day', $period); } /** @@ -65,8 +69,8 @@ class PeriodTest extends PHPUnit_Framework_TestCase */ public function testFactoryMonth() { - $period = Period::factory('month', Piwik_Date::today()); - $this->assertInstanceOf('Piwik_Period_Month', $period); + $period = Period::factory('month', Date::today()); + $this->assertInstanceOf('Month', $period); } /** @@ -75,8 +79,8 @@ class PeriodTest extends PHPUnit_Framework_TestCase */ public function testFactoryWeek() { - $period = Period::factory('week', Piwik_Date::today()); - $this->assertInstanceOf('Piwik_Period_Week', $period); + $period = Period::factory('week', Date::today()); + $this->assertInstanceOf('Week', $period); } /** @@ -85,7 +89,7 @@ class PeriodTest extends PHPUnit_Framework_TestCase */ public function testFactoryYear() { - $period = Period::factory('year', Piwik_Date::today()); + $period = Period::factory('year', Date::today()); $this->assertInstanceOf('Piwik_Period_Year', $period); } @@ -96,7 +100,7 @@ class PeriodTest extends PHPUnit_Framework_TestCase public function testFactoryInvalid() { try { - $period = Period::factory('inValid', Piwik_Date::today()); + $period = Period::factory('inValid', Date::today()); } catch (Exception $e) { return; } |