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:
Diffstat (limited to 'tests/modules/Period.test.php')
-rw-r--r--tests/modules/Period.test.php238
1 files changed, 119 insertions, 119 deletions
diff --git a/tests/modules/Period.test.php b/tests/modules/Period.test.php
index 85d67026f7..ba13fe3bc1 100644
--- a/tests/modules/Period.test.php
+++ b/tests/modules/Period.test.php
@@ -26,34 +26,34 @@ class Test_Piwik_Period extends UnitTestCase
{
// echo $this->timer . "<br> ";
}
-
- public function test_getId()
- {
- $period = new Piwik_Period_Day( Piwik_Date::today() );
- $this->assertTrue( $period->getId() !== 0 );
- $period = new Piwik_Period_Week( Piwik_Date::today() );
- $this->assertTrue( $period->getId() !== 0 );
- $period = new Piwik_Period_Month( Piwik_Date::today() );
- $this->assertTrue( $period->getId() !== 0 );
- $period = new Piwik_Period_Year( Piwik_Date::today() );
- $this->assertTrue( $period->getId() !== 0 );
- }
-
- public function test_getLabel()
- {
- $period = new Piwik_Period_Day( Piwik_Date::today() );
- $label = $period->getLabel();
- $this->assertTrue( is_string($label) && !empty($label));
- $period = new Piwik_Period_Week( Piwik_Date::today() );
- $label = $period->getLabel();
- $this->assertTrue( is_string($label) && !empty($label));
- $period = new Piwik_Period_Month( Piwik_Date::today() );
- $label = $period->getLabel();
- $this->assertTrue( is_string($label) && !empty($label));
- $period = new Piwik_Period_Year( Piwik_Date::today() );
- $label = $period->getLabel();
- $this->assertTrue( is_string($label) && !empty($label));
- }
+
+ public function test_getId()
+ {
+ $period = new Piwik_Period_Day( Piwik_Date::today() );
+ $this->assertTrue( $period->getId() !== 0 );
+ $period = new Piwik_Period_Week( Piwik_Date::today() );
+ $this->assertTrue( $period->getId() !== 0 );
+ $period = new Piwik_Period_Month( Piwik_Date::today() );
+ $this->assertTrue( $period->getId() !== 0 );
+ $period = new Piwik_Period_Year( Piwik_Date::today() );
+ $this->assertTrue( $period->getId() !== 0 );
+ }
+
+ public function test_getLabel()
+ {
+ $period = new Piwik_Period_Day( Piwik_Date::today() );
+ $label = $period->getLabel();
+ $this->assertTrue( is_string($label) && !empty($label));
+ $period = new Piwik_Period_Week( Piwik_Date::today() );
+ $label = $period->getLabel();
+ $this->assertTrue( is_string($label) && !empty($label));
+ $period = new Piwik_Period_Month( Piwik_Date::today() );
+ $label = $period->getLabel();
+ $this->assertTrue( is_string($label) && !empty($label));
+ $period = new Piwik_Period_Year( Piwik_Date::today() );
+ $label = $period->getLabel();
+ $this->assertTrue( is_string($label) && !empty($label));
+ }
/**
* Testing Period_Day
@@ -98,97 +98,97 @@ class Test_Piwik_Period extends UnitTestCase
$this->assertEqual( $period->getSubperiods(), array());
$this->assertEqual( $period->getNumberOfSubperiods(), 0);
}
-
- // test date that doesn't exist, should return the corresponding correct date
- function test_day_getDateStart1()
- {
- // create the period
- $period = new Piwik_Period_Day( new Piwik_Date("2007-02-31"));
-
- // start date
- $startDate = $period->getDateStart();
-
- // expected string
- $this->assertEqual( $startDate->toString(), "2007-03-03");
-
- // check that for a day, getDateStart = getStartEnd
- $this->assertEqual($startDate, $period->getDateEnd() );
- }
-
- // test normal date
- function test_day_getDateStart2()
- {
- // create the period
- $period = new Piwik_Period_Day( new Piwik_Date("2007-01-03"));
-
- // start date
- $startDate = $period->getDateStart();
-
- // expected string
- $this->assertEqual( $startDate->toString(), "2007-01-03");
-
- // check that for a day, getDateStart = getStartEnd
- $this->assertEqual($startDate, $period->getDateEnd() );
- }
-
- // test last day of year
- function test_day_getDateStart3()
- {
- // create the period
- $period = new Piwik_Period_Day( new Piwik_Date("2007-12-31"));
-
- // start date
- $startDate = $period->getDateStart();
-
- // expected string
- $this->assertEqual( $startDate->toString(), "2007-12-31");
-
- // check that for a day, getDateStart = getStartEnd
- $this->assertEqual($startDate, $period->getDateEnd() );
- }
-
-
- // test date that doesn't exist, should return the corresponding correct date
- function test_day_getDateEnd1()
- {
- // create the period
- $period = new Piwik_Period_Day( new Piwik_Date("2007-02-31"));
-
- // end date
- $endDate = $period->getDateEnd();
-
- // expected string
- $this->assertEqual( $endDate->toString(), "2007-03-03");
-
- }
-
- // test normal date
- function test_day_getDateEnd2()
- {
- // create the period
- $period = new Piwik_Period_Day( new Piwik_Date("2007-04-15"));
-
- // end date
- $endDate = $period->getDateEnd();
-
- // expected string
- $this->assertEqual( $endDate->toString(), "2007-04-15");
- }
-
- // test last day of year
- function test_day_getDateEnd3()
- {
- // create the period
- $period = new Piwik_Period_Day( new Piwik_Date("2007-12-31"));
-
- // end date
- $endDate = $period->getDateEnd();
-
- // expected string
- $this->assertEqual( $endDate->toString(), "2007-12-31");
- }
-
- // test date that doesn't exist, should return the corresponding correct date
+
+ // test date that doesn't exist, should return the corresponding correct date
+ function test_day_getDateStart1()
+ {
+ // create the period
+ $period = new Piwik_Period_Day( new Piwik_Date("2007-02-31"));
+
+ // start date
+ $startDate = $period->getDateStart();
+
+ // expected string
+ $this->assertEqual( $startDate->toString(), "2007-03-03");
+
+ // check that for a day, getDateStart = getStartEnd
+ $this->assertEqual($startDate, $period->getDateEnd() );
+ }
+
+ // test normal date
+ function test_day_getDateStart2()
+ {
+ // create the period
+ $period = new Piwik_Period_Day( new Piwik_Date("2007-01-03"));
+
+ // start date
+ $startDate = $period->getDateStart();
+
+ // expected string
+ $this->assertEqual( $startDate->toString(), "2007-01-03");
+
+ // check that for a day, getDateStart = getStartEnd
+ $this->assertEqual($startDate, $period->getDateEnd() );
+ }
+
+ // test last day of year
+ function test_day_getDateStart3()
+ {
+ // create the period
+ $period = new Piwik_Period_Day( new Piwik_Date("2007-12-31"));
+
+ // start date
+ $startDate = $period->getDateStart();
+
+ // expected string
+ $this->assertEqual( $startDate->toString(), "2007-12-31");
+
+ // check that for a day, getDateStart = getStartEnd
+ $this->assertEqual($startDate, $period->getDateEnd() );
+ }
+
+
+ // test date that doesn't exist, should return the corresponding correct date
+ function test_day_getDateEnd1()
+ {
+ // create the period
+ $period = new Piwik_Period_Day( new Piwik_Date("2007-02-31"));
+
+ // end date
+ $endDate = $period->getDateEnd();
+
+ // expected string
+ $this->assertEqual( $endDate->toString(), "2007-03-03");
+
+ }
+
+ // test normal date
+ function test_day_getDateEnd2()
+ {
+ // create the period
+ $period = new Piwik_Period_Day( new Piwik_Date("2007-04-15"));
+
+ // end date
+ $endDate = $period->getDateEnd();
+
+ // expected string
+ $this->assertEqual( $endDate->toString(), "2007-04-15");
+ }
+
+ // test last day of year
+ function test_day_getDateEnd3()
+ {
+ // create the period
+ $period = new Piwik_Period_Day( new Piwik_Date("2007-12-31"));
+
+ // end date
+ $endDate = $period->getDateEnd();
+
+ // expected string
+ $this->assertEqual( $endDate->toString(), "2007-12-31");
+ }
+
+ // test date that doesn't exist, should return the corresponding correct date
/**
* Testing Period_Month