/**
  * Determine if the previous week was swapped due to a holiday.
  * @param  Carbon $date 
  * @return boolean       
  */
 private function previousWeekSwapped(Carbon $date)
 {
     $thisYear = $date->year;
     // we want to check who had and should have add the cabin last week
     $lastWeek = $date->subWeek();
     $lastWeekNumber = $this->getWeekNumber($lastWeek->day, $lastWeek->month, $lastWeek->year);
     // If subtracted to week 1, and the year's are different, no swap occurs.
     // An example of this is the beginning of 2017.
     if ($lastWeekNumber == 1 && $lastWeek->year != $thisYear) {
         return false;
     }
     // Normal rules (even/odd) which side would get the cabin
     $defaultFamily = $this->evenOddAssignment($lastWeekNumber, $lastWeek->year);
     // With the holiday rules, who was the previous week given too.
     $family = parent::determine($lastWeek->day, $lastWeek->month, $lastWeek->year);
     // If they are different then they were swapped
     return $defaultFamily != $family;
 }
 /**
  * @test
  */
 function it_respects_the_week_numbers_and_the_alternating_rules_at_the_end_of_the_year()
 {
     $ownership = new WeekOwnership();
     // according to the calendar-list,
     // wk1 in 2017 starts 12/30
     // welches get odd weeks in odd years, so it should be welch
     $side = $ownership->determine(31, 12, 2016);
     $this->assertSame('welch', $side);
     // A year when the last day of the week is 12/30,
     // and that week belongs to the schu's. The next
     // week starts on 12/31 and that year is even so
     // the schu's get that. They should have two weeks there then.
     $side = $ownership->determine(30, 12, 2021);
     $this->assertSame('schu', $side);
     $side = $ownership->determine(31, 12, 2021);
     $this->assertSame('schu', $side);
 }