コード例 #1
0
ファイル: DayTest.php プロジェクト: roadrunner/CalendR
 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'));
 }
コード例 #2
0
ファイル: DayTest.php プロジェクト: bekirduz/wordpress_4_1_1
 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));
 }
コード例 #3
0
ファイル: DayTest.php プロジェクト: morloderex/CalendR
 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));
 }
コード例 #4
0
 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());
 }