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());
     }
 }
Exemple #2
0
 public function testIsCurrent()
 {
     $currentDate = new \DateTime();
     $otherDate = clone $currentDate;
     $otherDate->add(new \DateInterval('P5M'));
     $currentMonth = new Month(new \DateTime(date('Y-m') . '-01'), $this->prophesize(FactoryInterface::class)->reveal());
     $otherMonth = $currentMonth->getNext();
     $this->assertTrue($currentMonth->contains($currentDate));
     $this->assertFalse($currentMonth->contains($otherDate));
     $this->assertFalse($otherMonth->contains($currentDate));
 }
 public function testIsCurrent()
 {
     $currentDate = new \DateTime();
     $otherDate = clone $currentDate;
     $otherDate->add(new \DateInterval('P5M'));
     $currentMonth = new Month(new \DateTime(date('Y-m') . '-01'));
     $otherMonth = $currentMonth->getNext();
     $this->assertTrue($currentMonth->contains($currentDate));
     $this->assertFalse($currentMonth->contains($otherDate));
     $this->assertFalse($otherMonth->contains($currentDate));
 }
Exemple #4
0
 public function testGetNext()
 {
     $month = new Month(new \DateTime('2012-01-01'));
     $this->assertEquals('2012-02-01', $month->getNext()->getBegin()->format('Y-m-d'));
     $month = new Month(new \DateTime('2012-12-01'));
     $this->assertEquals('2013-01-01', $month->getNext()->getBegin()->format('Y-m-d'));
 }