Fixed all unit tests, they are all working now.

This commit is contained in:
paul.baranowski 2010-11-19 15:51:58 -05:00
parent 1786501b10
commit a643e4c755
4 changed files with 218 additions and 231 deletions

View File

@ -93,7 +93,7 @@ class ScheduleGroup {
." {$this->groupId}, $p_audioFileId)";
$result = $CC_DBC->query($sql);
if (PEAR::isError($result)) {
var_dump($sql);
//var_dump($sql);
return $result;
}
return $this->groupId;
@ -109,7 +109,7 @@ class ScheduleGroup {
// Check if there are any conflicts with existing entries
$length = trim($playlist->getLength());
var_dump($length);
//var_dump($length);
if (empty($length)) {
return new PEAR_Error("Length is empty.");
}
@ -123,10 +123,10 @@ class ScheduleGroup {
$itemStartTime = $p_datetime;
$plItems = $playlist->getContents();
var_dump($plItems);
//var_dump($plItems);
foreach ($plItems as $row) {
$trackLength = $row["cliplength"];
var_dump($trackLength);
//var_dump($trackLength);
$sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"]
." (id, playlist_id, starts, ends, group_id, file_id,"
." clip_length, cue_in, cue_out, fade_in, fade_out)"
@ -136,7 +136,7 @@ class ScheduleGroup {
." '{$row['cueout']}', '{$row['fadein']}','{$row['fadeout']}')";
$result = $CC_DBC->query($sql);
if (PEAR::isError($result)) {
var_dump($sql);
//var_dump($sql);
return $result;
}
$itemStartTime = $CC_DBC->getOne("SELECT TIMESTAMP '$itemStartTime' + INTERVAL '$trackLength'");
@ -173,7 +173,7 @@ class ScheduleGroup {
}
$sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"]
." WHERE group_id = ".$this->groupId;
//echo $sql;
return $CC_DBC->query($sql);
}
@ -229,9 +229,9 @@ class Schedule {
." WHERE (starts >= '$p_datetime') "
." AND (ends <= (TIMESTAMP '$p_datetime' + INTERVAL '$p_length'))";
//$_SESSION["debug"] = $sql;
var_dump($sql);
//var_dump($sql);
$count = $CC_DBC->GetOne($sql);
var_dump($count);
//var_dump($count);
return ($count == '0');
}

View File

@ -161,78 +161,78 @@ function camp_get_audio_metadata($p_filename, $p_testonly = false)
$titleKey = 'dc:title';
$flds = array(
'dc:format' => array(
array('path'=>"['mime_type']", 'ignoreEnc'=>TRUE),
),
array('path'=>"['mime_type']", 'ignoreEnc'=>TRUE),
),
'ls:bitrate' => array(
array('path'=>"['bitrate']", 'ignoreEnc'=>TRUE),
array('path'=>"['audio']['bitrate']", 'ignoreEnc'=>TRUE),
),
array('path'=>"['bitrate']", 'ignoreEnc'=>TRUE),
array('path'=>"['audio']['bitrate']", 'ignoreEnc'=>TRUE),
),
'ls:samplerate' => array(
array('path'=>"['audio']['sample_rate']", 'ignoreEnc'=>TRUE),
),
array('path'=>"['audio']['sample_rate']", 'ignoreEnc'=>TRUE),
),
'ls:encoder' => array(
array('path'=>"['audio']['codec']", 'ignoreEnc'=>TRUE),
),
array('path'=>"['audio']['codec']", 'ignoreEnc'=>TRUE),
),
'dcterms:extent'=> array(
array('path'=>"['playtime_seconds']", 'ignoreEnc'=>TRUE),
),
array('path'=>"['playtime_seconds']", 'ignoreEnc'=>TRUE),
),
'ls:composer'=> array(
array('path'=>"['id3v2']['comments']['composer']", 'dataPath'=>"[0]", 'ignoreEnc'=>TRUE),
array('path'=>"['id3v2']['TCOM'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
array('path'=>"['tags']['id3v2']['composer']", 'dataPath'=>"[0]", 'ignoreEnc'=>TRUE),
array('path'=>"['ogg']['comments']['composer']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['tags']['vorbiscomment']['composer']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
),
array('path'=>"['id3v2']['comments']['composer']", 'dataPath'=>"[0]", 'ignoreEnc'=>TRUE),
array('path'=>"['id3v2']['TCOM'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
array('path'=>"['tags']['id3v2']['composer']", 'dataPath'=>"[0]", 'ignoreEnc'=>TRUE),
array('path'=>"['ogg']['comments']['composer']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['tags']['vorbiscomment']['composer']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
),
'dc:description'=> array(
array('path'=>"['id3v1']['comments']['comment']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['id3v2']['comments']['comments']", 'dataPath'=>"[0]", 'ignoreEnc'=>TRUE),
array('path'=>"['id3v2']['COMM'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
array('path'=>"['tags']['id3v2']['comments']", 'dataPath'=>"[0]", 'ignoreEnc'=>TRUE),
array('path'=>"['ogg']['comments']['comment']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['tags']['vorbiscomment']['comment']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
),
array('path'=>"['id3v1']['comments']['comment']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['id3v2']['comments']['comments']", 'dataPath'=>"[0]", 'ignoreEnc'=>TRUE),
array('path'=>"['id3v2']['COMM'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
array('path'=>"['tags']['id3v2']['comments']", 'dataPath'=>"[0]", 'ignoreEnc'=>TRUE),
array('path'=>"['ogg']['comments']['comment']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['tags']['vorbiscomment']['comment']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
),
'dc:type'=> array(
array('path'=>"['id3v1']", 'dataPath'=>"['genre']", 'encPath'=>"['encoding']"),
array('path'=>"['id3v2']['comments']['content_type']", 'dataPath'=>"[0]", 'ignoreEnc'=>TRUE),
array('path'=>"['id3v2']['TCON'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
array('path'=>"['ogg']['comments']['genre']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['tags']['vorbiscomment']['genre']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
),
array('path'=>"['id3v1']", 'dataPath'=>"['genre']", 'encPath'=>"['encoding']"),
array('path'=>"['id3v2']['comments']['content_type']", 'dataPath'=>"[0]", 'ignoreEnc'=>TRUE),
array('path'=>"['id3v2']['TCON'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
array('path'=>"['ogg']['comments']['genre']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['tags']['vorbiscomment']['genre']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
),
'dc:title' => array(
array('path'=>"['id3v2']['comments']['title']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['id3v2']['TIT2'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
array('path'=>"['id3v2']['TT2'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
array('path'=>"['id3v1']", 'dataPath'=>"['title']", 'encPath'=>"['encoding']"),
array('path'=>"['ogg']['comments']['title']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['tags']['vorbiscomment']['title']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
),
array('path'=>"['id3v2']['comments']['title']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['id3v2']['TIT2'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
array('path'=>"['id3v2']['TT2'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
array('path'=>"['id3v1']", 'dataPath'=>"['title']", 'encPath'=>"['encoding']"),
array('path'=>"['ogg']['comments']['title']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['tags']['vorbiscomment']['title']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
),
'dc:creator' => array(
array('path'=>"['id3v2']['comments']['artist']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['id3v2']['TPE1'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
array('path'=>"['id3v2']['TP1'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
array('path'=>"['id3v1']", 'dataPath'=>"['artist']", 'encPath'=>"['encoding']"),
array('path'=>"['ogg']['comments']['artist']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['tags']['vorbiscomment']['artist']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
),
array('path'=>"['id3v2']['comments']['artist']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['id3v2']['TPE1'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
array('path'=>"['id3v2']['TP1'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
array('path'=>"['id3v1']", 'dataPath'=>"['artist']", 'encPath'=>"['encoding']"),
array('path'=>"['ogg']['comments']['artist']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['tags']['vorbiscomment']['artist']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
),
'dc:source' => array(
array('path'=>"['id3v2']['comments']['album']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['id3v2']['TALB'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
array('path'=>"['id3v2']['TAL'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
array('path'=>"['ogg']['comments']['album']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['tags']['vorbiscomment']['album']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
),
array('path'=>"['id3v2']['comments']['album']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['id3v2']['TALB'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
array('path'=>"['id3v2']['TAL'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
array('path'=>"['ogg']['comments']['album']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['tags']['vorbiscomment']['album']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
),
'ls:encoded_by' => array(
array('path'=>"['id3v2']['TENC'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
array('path'=>"['id3v2']['TEN'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
array('path'=>"['ogg']['comments']['encoded-by']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['tags']['vorbiscomment']['encoded-by']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
),
array('path'=>"['id3v2']['TENC'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
array('path'=>"['id3v2']['TEN'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
array('path'=>"['ogg']['comments']['encoded-by']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['tags']['vorbiscomment']['encoded-by']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
),
'ls:track_num' => array(
array('path'=>"['id3v2']['TRCK'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
array('path'=>"['id3v2']['TRK'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
array('path'=>"['ogg']['comments']['tracknumber']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['tags']['vorbiscomment']['tracknumber']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
),
array('path'=>"['id3v2']['TRCK'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
array('path'=>"['id3v2']['TRK'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
array('path'=>"['ogg']['comments']['tracknumber']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['tags']['vorbiscomment']['tracknumber']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
),
// 'ls:genre' => array(
// array('path'=>"['id3v1']", 'dataPath'=>"['genre']", 'encPath'=>"['encoding']"),
// array('path'=>"['id3v2']['TCON'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
@ -241,16 +241,16 @@ function camp_get_audio_metadata($p_filename, $p_testonly = false)
// array('path'=>"['tags']['vorbiscomment']['genre']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
// ),
'ls:channels' => array(
array('path'=>"['audio']['channels']", 'ignoreEnc'=>TRUE),
),
array('path'=>"['audio']['channels']", 'ignoreEnc'=>TRUE),
),
'ls:year' => array(
array('path'=>"['comments']['date']"),
array('path'=>"['ogg']['comments']['date']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['tags']['vorbiscomment']['date']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
),
array('path'=>"['comments']['date']"),
array('path'=>"['ogg']['comments']['date']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['tags']['vorbiscomment']['date']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
),
'ls:filename' => array(
array('path'=>"['filename']"),
),
array('path'=>"['filename']"),
),
);
$mdata = array();
if (isset($infoFromFile['audio'])) {
@ -1661,73 +1661,50 @@ class StoredFile {
/**
* Get and optionally create subdirectory in real filesystem for storing
* raw media data.
* Get real filename of raw media data
*
* @return string
*/
// private function _getResDir()
// {
// global $CC_CONFIG, $CC_DBC;
// $resDir = $CC_CONFIG['storageDir']."/".substr($this->gunid, 0, 3);
// //$this->gb->debugLog("$resDir");
// // see Transport::_getResDir too for resDir name create code
// if (!is_dir($resDir)) {
// mkdir($resDir, 02775);
// chmod($resDir, 02775);
// }
// return $resDir;
// }
public function getRealFilePath()
{
return $this->filepath;
}
public function getRealFileName()
{
return $this->gunid.".".$this->getFileExtension();
}
/**
* Get the URL to access this file.
*/
public function getFileUrl()
{
global $CC_CONFIG;
return "http://".$CC_CONFIG["storageUrlHost"]
.$CC_CONFIG["apiPath"]."get_media.php?file="
.$this->gunid.".".$this->getFileExtension();
}
/**
* Get real filename of raw media data
*
* @return string
*/
public function getRealFilePath()
{
return $this->filepath;
}
/**
* Get the URL to access this file.
*/
public function getFileUrl()
{
global $CC_CONFIG;
return "http://".$CC_CONFIG["storageUrlHost"]
.$CC_CONFIG["apiPath"]."get_media.php?file={$this->getRealFileName()}";
}
/**
* Get real filename of metadata file
*
* @return string
* @see MetaData
*/
public function getRealMetadataFileName()
{
//return $this->md->getFileName();
return $this->md["name"];
}
/**
* Get real filename of metadata file
*
* @return string
* @see MetaData
*/
public function getRealMetadataFileName()
{
//return $this->md->getFileName();
return $this->md["name"];
}
/**
* Create and return name for temporary symlink.
*
* @todo Should be more unique
* @return string
*/
private function _getAccessFileName($p_token, $p_ext='EXT')
{
global $CC_CONFIG;
return $CC_CONFIG['accessDir']."/$p_token.$p_ext";
}
/**
* Create and return name for temporary symlink.
*
* @todo Should be more unique
* @return string
*/
private function _getAccessFileName($p_token, $p_ext='EXT')
{
global $CC_CONFIG;
return $CC_CONFIG['accessDir']."/$p_token.$p_ext";
}
} // class StoredFile
?>
} // class StoredFile
?>

View File

@ -1,7 +1,7 @@
<?php
$path = dirname(__FILE__).'/../../3rd_party/php/pear';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
$WHITE_SCREEN_OF_DEATH = true;
$WHITE_SCREEN_OF_DEATH = false;
require_once(dirname(__FILE__).'/../../conf.php');
require_once('DB.php');

View File

@ -3,116 +3,126 @@ require_once(dirname(__FILE__)."/../Schedule.php");
class SchedulerTests extends PHPUnit_TestCase {
private $groupIdCreated;
private $storedFile;
private $storedFile2;
private $groupIdCreated;
private $storedFile;
private $storedFile2;
function setup() {
global $CC_CONFIG, $CC_DBC;
function setup() {
global $CC_CONFIG, $CC_DBC;
// Clear the files table
//$sql = "DELETE FROM ".$CC_CONFIG["filesTable"];
//$CC_DBC->query($sql);
// 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__)."/test10001.mp3");
$this->storedFile = StoredFile::Insert($values, false);
// Add a file
$values = array("filepath" => dirname(__FILE__)."/test10002.mp3");
$this->storedFile2 = 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);
}
function testDateToId() {
$dateStr = "2006-04-02 10:20:08.123456";
$id = ScheduleGroup::dateToId($dateStr);
$expected = "20060402102008123";
if ($id != $expected) {
$this->fail("Did not convert date to ID correctly #1: $id != $expected");
// Clear the schedule table
//$sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"];
//$CC_DBC->query($sql);
}
$dateStr = "2006-04-02 10:20:08";
$id = ScheduleGroup::dateToId($dateStr);
$expected = "20060402102008000";
if ($id != $expected) {
$this->fail("Did not convert date to ID correctly #2: $id != $expected");
}
}
function testDateToId() {
$dateStr = "2006-04-02 10:20:08.123456";
$id = ScheduleGroup::dateToId($dateStr);
$expected = "20060402102008123";
if ($id != $expected) {
$this->fail("Did not convert date to ID correctly #1: $id != $expected");
}
function testAddAndRemoveAudioFile() {
$i = new ScheduleGroup();
$this->groupIdCreated = $i->add('2010-10-10 01:30:23', $this->storedFile->getId());
if (PEAR::isError($this->groupIdCreated)) {
$this->fail("Failed to create scheduled item: ". $this->groupIdCreated->getMessage());
$dateStr = "2006-04-02 10:20:08";
$id = ScheduleGroup::dateToId($dateStr);
$expected = "20060402102008000";
if ($id != $expected) {
$this->fail("Did not convert date to ID correctly #2: $id != $expected");
}
}
$i = new ScheduleGroup($this->groupIdCreated);
$result = $i->remove();
if ($result != 1) {
$this->fail("Did not remove item.");
}
}
function testAddAndRemoveAudioFile() {
$i = new ScheduleGroup();
$this->groupIdCreated = $i->add('2010-10-10 01:30:23', $this->storedFile->getId());
if (PEAR::isError($this->groupIdCreated)) {
$this->fail("Failed to create scheduled item: ". $this->groupIdCreated->getMessage());
}
function testAddAndRemovePlaylist() {
// Create a playlist
$playlist = new Playlist();
$playlist->create("Scheduler Unit Test ".uniqid());
$result = $playlist->addAudioClip($this->storedFile->getId());
$result = $playlist->addAudioClip($this->storedFile2->getId());
$result = $playlist->addAudioClip($this->storedFile2->getId());
$i = new ScheduleGroup();
$this->groupIdCreated = $i->add('2010-11-11 01:30:23', null, $playlist->getId());
if (PEAR::isError($this->groupIdCreated)) {
$this->fail("Failed to create scheduled item: ". $this->groupIdCreated->getMessage());
$i = new ScheduleGroup($this->groupIdCreated);
$result = $i->remove();
if ($result != 1) {
$this->fail("Did not remove item.");
}
}
$group = new ScheduleGroup($this->groupIdCreated);
if ($group->count() != 3) {
$this->fail("Wrong number of items added.");
}
$items = $group->getItems();
if (!is_array($items) || ($items[1]["starts"] != "2010-11-11 01:30:34.231")) {
$this->fail("Wrong start time for 2nd item.");
function testAddAndRemovePlaylist() {
// Create a playlist
$playlist = new Playlist();
$playlist->create("Scheduler Unit Test ".uniqid());
$result = $playlist->addAudioClip($this->storedFile->getId());
$result = $playlist->addAudioClip($this->storedFile2->getId());
$result = $playlist->addAudioClip($this->storedFile2->getId());
$i = new ScheduleGroup();
$this->groupIdCreated = $i->add('2010-11-11 01:30:23', null, $playlist->getId());
if (PEAR::isError($this->groupIdCreated)) {
$this->fail("Failed to create scheduled item: ". $this->groupIdCreated->getMessage());
}
$group = new ScheduleGroup($this->groupIdCreated);
if ($group->count() != 3) {
$this->fail("Wrong number of items added.");
}
$items = $group->getItems();
if (!is_array($items) || ($items[1]["starts"] != "2010-11-11 01:30:34.231")) {
$this->fail("Wrong start time for 2nd item.");
}
$result = $group->remove();
if ($result != 1) {
$this->fail("Did not remove item.");
}
Playlist::Delete($playlist->getId());
}
$result = $group->remove();
if ($result != 1) {
$this->fail("Did not remove item.");
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;
}
}
Playlist::Delete($playlist->getId());
}
function testIsScheduleEmptyInRange() {
$i = new ScheduleGroup();
$this->groupIdCreated = $i->add('2011-10-10 01:30:23', $this->storedFile->getId());
if (Schedule::isScheduleEmptyInRange('2011-10-10 01:30:23', '00:00:01.432153')) {
$this->fail("Reporting empty schedule when it isnt.");
function testGetItems() {
$i1 = new ScheduleGroup();
$groupId1 = $i1->add('2008-01-01 12:00:00.000', $this->storedFile->getId());
$i2 = new ScheduleGroup();
$i2->addAfter($groupId1, $this->storedFile->getId());
$items = Schedule::GetItems("2008-01-01", "2008-01-02");
if (count($items) != 2) {
$this->fail("Wrong number of items returned.");
return;
}
$i1->remove();
$i2->remove();
}
$i->remove();
if (!Schedule::isScheduleEmptyInRange('2011-10-10 01:30:23', '00:00:01.432153')) {
$this->fail("Reporting booked schedule when it isnt.");
}
}
function testGetItems() {
$i1 = new ScheduleGroup();
$groupId1 = $i1->add('2008-01-01 12:00:00.000', $this->storedFile->getId());
$i2 = new ScheduleGroup();
$i2->addAfter($groupId1, $this->storedFile->getId());
$items = Schedule::GetItems("2008-01-01", "2008-01-02");
if (count($items) != 2) {
$this->fail("Wrong number of items returned.");
return;
}
$i1->remove();
$i2->remove();
}
}
?>