Exemple #1
0
 function it_can_tell_the_end_date()
 {
     $this->beConstructedWith(Month::fromName('June'), Year::fromNumber(2014));
     $date = $this->getEndDate();
     $date->getDay()->shouldReturn(30);
     $date->getPeriod()->shouldReturn($this);
 }
Exemple #2
0
 function it_can_forward_to_the_closest_specified_weekday()
 {
     $this->beConstructedWith(16, new Period(Month::fromName('April'), Year::fromNumber(2013)));
     $this->nextWeekday(Date::WEDNESDAY)->getDay()->shouldReturn(17);
     $this->nextWeekday(Date::MONDAY)->getDay()->shouldReturn(22);
     $this->nextWeekday(Date::TUESDAY)->getDay()->shouldReturn(16);
 }
Exemple #3
0
 public function previous()
 {
     if (1 === $this->month->toNumber()) {
         $month = Month::fromNumber(12);
         $year = $this->year->previous();
     } else {
         $month = $this->month->previous();
         $year = $this->year;
     }
     return new self($month, $year);
 }