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); }
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')); } }
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()); }