예제 #1
0
 public function testGetMonth()
 {
     $calendar = new Calendar();
     $month = $calendar->getMonth(new \DateTime('2012-01-01'));
     $this->assertInstanceOf('CalendR\\Period\\Month', $month);
     $month = $calendar->getMonth(2012, 01);
     $this->assertInstanceOf('CalendR\\Period\\Month', $month);
 }
예제 #2
0
 public function testIterateOnMonth()
 {
     $calendar = new Calendar();
     $month = $calendar->getMonth(2013, 3);
     foreach ($month as $week) {
         $this->assertSame(Day::MONDAY, (int) $week->getBegin()->format('w'));
     }
     $calendar->setFirstWeekday(Day::SUNDAY);
     $month = $calendar->getMonth(2013, 3);
     foreach ($month as $week) {
         $this->assertSame(Day::SUNDAY, (int) $week->getBegin()->format('w'));
     }
 }
예제 #3
0
 public function testSetFirstWeekday()
 {
     $factory = new \CalendR\Calendar();
     $month = $factory->getMonth(2014, 5);
     $this->assertSame($factory->getFirstWeekday(), $month->getFirstWeekday());
     $month->setFirstWeekday(Day::FRIDAY);
     $this->assertSame(Day::FRIDAY, $factory->getFirstWeekday());
     $month->setFirstWeekday(Day::THURSDAY);
     $this->assertSame(Day::THURSDAY, $factory->getFirstWeekday());
 }