Ejemplo n.º 1
0
 public function testGetDatePeriod()
 {
     $date = new \DateTime('2012-01-01');
     $year = new Year($date);
     foreach ($year->getDatePeriod() as $dateTime) {
         $this->assertEquals($date->format('Y-m-d'), $dateTime->format('Y-m-d'));
         $date->add(new \DateInterval('P1D'));
     }
 }
Ejemplo n.º 2
0
 public function testYearTransmitToMonth()
 {
     $year = new Year(new \DateTime('2013-01-01'), Day::SUNDAY);
     $this->assertSame(Day::SUNDAY, $year->getPrevious()->getFirstWeekday());
     $this->assertSame(Day::SUNDAY, $year->getNext()->getFirstWeekday());
     foreach ($year as $month) {
         $this->assertSame(Day::SUNDAY, $month->getFirstWeekday());
     }
 }
Ejemplo n.º 3
0
 public function testGetDatePeriod()
 {
     $date = new \DateTime('2012-01-01');
     $year = new Year($date, $this->prophesize(FactoryInterface::class)->reveal());
     foreach ($year->getDatePeriod() as $dateTime) {
         $this->assertEquals($date->format('Y-m-d'), $dateTime->format('Y-m-d'));
         $date->add(new \DateInterval('P1D'));
     }
 }