function setup() { global $CC_CONFIG, $CC_DBC; // Clear the files table $sql = "DELETE FROM " . $CC_CONFIG["filesTable"]; $CC_DBC->query($sql); // Add a file $values = array("filepath" => dirname(__FILE__) . "/test10001.mp3"); $this->storedFile = StoredFile::Insert($values, false); // Add a file $values = array("filepath" => dirname(__FILE__) . "/test10002.mp3"); $this->storedFile2 = StoredFile::Insert($values, false); // Clear the schedule table $sql = "DELETE FROM " . $CC_CONFIG["scheduleTable"]; $CC_DBC->query($sql); // Create a playlist $playlist = new Playlist(); $playlist->create("Scheduler Unit Test"); $result = $playlist->addAudioClip($this->storedFile->getId()); $result = $playlist->addAudioClip($this->storedFile2->getId()); $result = $playlist->addAudioClip($this->storedFile2->getId()); // Schedule it $i = new ScheduleGroup(); $this->groupIdCreated = $i->add('2010-11-11 01:30:23', null, $playlist->getId()); }
function testIsScheduleEmptyInRange() { $i = new ScheduleGroup(); $this->groupIdCreated = $i->add('2011-10-10 01:30:23', $this->storedFile->getId()); if (PEAR::isError($this->groupIdCreated)) { $this->fail($this->groupIdCreated->getMessage()); return; } if (Schedule::isScheduleEmptyInRange('2011-10-10 01:30:23', '00:00:12.555')) { $this->fail("Reporting empty schedule when it isnt."); return; } // echo "groupid: ".$this->groupIdCreated."\n"; $success = $i->remove(); if ($success === false) { $this->fail("Failed to delete schedule group."); return; } if (!Schedule::isScheduleEmptyInRange('2011-10-10 01:30:23', '00:00:12.555')) { $this->fail("Reporting booked schedule when it isnt."); return; } }
/** * Add a media file as the last item in the show. * * @param int $file_id */ public function addFileToShow($file_id) { $sched = new ScheduleGroup(); $lastGroupId = $this->getLastGroupId(); if (is_null($lastGroupId)) { $groupId = $sched->add($this->_instanceId, $this->getShowStart(), $file_id); } else { $groupId = $sched->addFileAfter($this->_instanceId, $lastGroupId, $file_id); } RabbitMq::PushSchedule(); $this->updateScheduledTime(); }