Beispiel #1
0
 public function testGetNext()
 {
     $day = new Day(new \DateTime('2012-01-01'));
     $this->assertEquals('2012-01-02', $day->getNext()->getBegin()->format('Y-m-d'));
     $day = new Day(new \DateTime('2012-01-31'));
     $this->assertEquals('2012-02-01', $day->getNext()->getBegin()->format('Y-m-d'));
 }
Beispiel #2
0
 public function testIsCurrent()
 {
     $currentDate = new \DateTime();
     $otherDate = clone $currentDate;
     $otherDate->add(new \DateInterval('P5D'));
     $currentDay = new Day(new \DateTime(date('Y-m-d')));
     $otherDay = $currentDay->getNext();
     $this->assertTrue($currentDay->contains($currentDate));
     $this->assertFalse($currentDay->contains($otherDate));
     $this->assertFalse($otherDay->contains($currentDate));
 }
Beispiel #3
0
 public function testCurrentDay()
 {
     $currentDate = new \DateTime();
     $otherDate = clone $currentDate;
     $otherDate->add(new \DateInterval('P5D'));
     $currentDay = new Day(new \DateTime(date('Y-m-d')), $this->prophesize(FactoryInterface::class)->reveal());
     $otherDay = $currentDay->getNext();
     $this->assertTrue($currentDay->contains($currentDate));
     $this->assertFalse($currentDay->contains($otherDate));
     $this->assertFalse($otherDay->contains($currentDate));
 }
 public function testDayTransmitToPreviousAndNext()
 {
     $day = new Day(new \DateTime('2013-01-01'), Day::SUNDAY);
     $this->assertSame(Day::SUNDAY, $day->getPrevious()->getFirstWeekday());
     $this->assertSame(Day::SUNDAY, $day->getNext()->getFirstWeekday());
 }