Example #1
0
 public function testGetPrevious()
 {
     $day = new Day(new \DateTime('2012-01-01'));
     $this->assertEquals('2011-12-31', $day->getPrevious()->getBegin()->format('Y-m-d'));
     $day = new Day(new \DateTime('2012-01-31'));
     $this->assertEquals('2012-01-30', $day->getPrevious()->getBegin()->format('Y-m-d'));
 }
Example #2
0
 public function testGetPrevious()
 {
     $day = new Day(new \DateTime('2012-01-01'), $this->prophesize(FactoryInterface::class)->reveal());
     $this->assertEquals('2011-12-31', $day->getPrevious()->getBegin()->format('Y-m-d'));
     $day = new Day(new \DateTime('2012-01-31'), $this->prophesize(FactoryInterface::class)->reveal());
     $this->assertEquals('2012-01-30', $day->getPrevious()->getBegin()->format('Y-m-d'));
 }
 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());
 }