Example #1
0
 /**
  * @group Core
  * @group Period
  * @group Period_Month
  */
 public function testMonthDSTChangeOct()
 {
     $month = new Piwik_Period_Month(Piwik_Date::factory("2017-10-31"));
     $correct = array("2017-10-01", "2017-10-02", "2017-10-03", "2017-10-04", "2017-10-05", "2017-10-06", "2017-10-07", "2017-10-08", "2017-10-09", "2017-10-10", "2017-10-11", "2017-10-12", "2017-10-13", "2017-10-14", "2017-10-15", "2017-10-16", "2017-10-17", "2017-10-18", "2017-10-19", "2017-10-20", "2017-10-21", "2017-10-22", "2017-10-23", "2017-10-24", "2017-10-25", "2017-10-26", "2017-10-27", "2017-10-28", "2017-10-29", "2017-10-30", "2017-10-31");
     $this->assertEquals($correct, $month->toString());
     $this->assertEquals(31, $month->getNumberOfSubperiods());
 }
Example #2
0
 /**
  * @group Core
  * @group Period
  * @group Period_Range
  */
 public function testRangePreviousmonth()
 {
     $range = new Piwik_Period_Range('month', 'previous10');
     $end = Piwik_Date::today();
     $end = $end->subMonth(1);
     $correct = array();
     for ($i = 0; $i < 10; $i++) {
         $date = $end->subMonth($i);
         $week = new Piwik_Period_Month($date);
         $correct[] = $week->toString();
     }
     $correct = array_reverse($correct);
     $this->assertEquals(10, $range->getNumberOfSubperiods());
     $this->assertEquals($correct, $range->toString());
 }
Example #3
0
 function test_range_previousmonth()
 {
     $range = new Piwik_Period_Range('month', 'previous10');
     $end = Piwik_Date::today();
     $end = $end->subMonth(1);
     $correct = array();
     for ($i = 0; $i < 10; $i++) {
         $date = $end->subMonth($i);
         $week = new Piwik_Period_Month($date);
         $correct[] = $week->toString();
     }
     $correct = array_reverse($correct);
     $this->assertEqual($range->getNumberOfSubperiods(), 10);
     $this->assertEqual($range->isFinished(), true);
     $this->assertEqual($range->toString(), $correct);
 }