Beispiel #1
0
 public function testGetDatePeriod()
 {
     $day = new Day(new \DateTime('2012-01-31'));
     foreach ($day->getDatePeriod() as $dateTime) {
         $this->assertEquals('2012-01-31', $dateTime->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));
 }
 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());
 }
Beispiel #4
0
 public function testIsCurrent()
 {
     $currentDay = new Day(new \DateTime('00:00:00'), $this->prophesize(FactoryInterface::class)->reveal());
     $otherDay = new Day(new \DateTime('1988-11-12'), $this->prophesize(FactoryInterface::class)->reveal());
     $this->assertTrue($currentDay->isCurrent());
     $this->assertFalse($otherDay->isCurrent());
 }
Beispiel #5
0
 public function testIsCurrent()
 {
     $currentDay = new Day(new \DateTime());
     $otherDay = new Day(new \DateTime('1988-11-12'));
     $this->assertTrue($currentDay->isCurrent());
     $this->assertFalse($otherDay->isCurrent());
 }