コード例 #1
0
 function it_should_return_shows_sorted_in_order_of_play_from_now()
 {
     $this->beConstructedThrough('mergeFromTimeSlots', [$this->getTimeSlots()]);
     ScheduleTime::setTestNow(Carbon::create(2015, 4, 22, 12));
     $shows = $this->getShowsInPlayOrder();
     $firstShow = $shows->first();
     $firstShow->nowPlaying()->shouldBe(true);
     $shows->get(1)->start()->shouldBe($firstShow->end());
     $shows->last()->end()->shouldBe($firstShow->start());
     $this->count()->shouldBe($shows->count());
 }
コード例 #2
0
 function it_should_return_if_show_is_now_playing()
 {
     $this->nowPlaying()->shouldBe(false);
     $today = ScheduleTime::now();
     $this->airsDayOfWeek($today->dayOfWeek());
     $this->startsAt($today->hour());
     $this->nowPlaying()->shouldBe(true);
     $this->startsAt($today->hour() - 1);
     $this->nowPlaying()->shouldBe(false);
     $this->extendShowByHour();
     $this->nowPlaying()->shouldBe(true);
 }
コード例 #3
0
 public function nowPlaying()
 {
     $today = ScheduleTime::now();
     if ($this->airDayOfWeek() != $today->dayOfWeek()) {
         return false;
     }
     if ($this->startingHour > $today->hour() || $this->endingHour <= $today->hour()) {
         return false;
     }
     return true;
 }
コード例 #4
0
 public static function now()
 {
     return ScheduleTime::fromDate(Carbon::now('America/New_York'));
 }