Esempio 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'));
     }
 }
 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());
     }
 }
Esempio 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'));
     }
 }