public function testMonthTransmitToWeek() { $month = new Month(new \DateTime('2013-01-01'), Day::SUNDAY); $this->assertSame(Day::SUNDAY, $month->getPrevious()->getFirstWeekday()); $this->assertSame(Day::SUNDAY, $month->getNext()->getFirstWeekday()); $this->assertSame(Day::SUNDAY, $month->getExtendedMonth()->getFirstWeekday()); foreach ($month as $week) { $this->assertSame(Day::SUNDAY, $week->getFirstWeekday()); } }
public function testGetPrevious() { $month = new Month(new \DateTime('2012-01-01'), $this->prophesize(FactoryInterface::class)->reveal()); $this->assertEquals('2011-12-01', $month->getPrevious()->getBegin()->format('Y-m-d')); $month = new Month(new \DateTime('2012-03-01'), $this->prophesize(FactoryInterface::class)->reveal()); $this->assertEquals('2012-02-01', $month->getPrevious()->getBegin()->format('Y-m-d')); }
public function testGetPrevious() { $month = new Month(new \DateTime('2012-01-01')); $this->assertEquals('2011-12-01', $month->getPrevious()->getBegin()->format('Y-m-d')); $month = new Month(new \DateTime('2012-03-01')); $this->assertEquals('2012-02-01', $month->getPrevious()->getBegin()->format('Y-m-d')); }