Fixed all unit tests, they are all working now.
This commit is contained in:
parent
1786501b10
commit
a643e4c755
|
@ -93,7 +93,7 @@ class ScheduleGroup {
|
||||||
." {$this->groupId}, $p_audioFileId)";
|
." {$this->groupId}, $p_audioFileId)";
|
||||||
$result = $CC_DBC->query($sql);
|
$result = $CC_DBC->query($sql);
|
||||||
if (PEAR::isError($result)) {
|
if (PEAR::isError($result)) {
|
||||||
var_dump($sql);
|
//var_dump($sql);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
return $this->groupId;
|
return $this->groupId;
|
||||||
|
@ -109,7 +109,7 @@ class ScheduleGroup {
|
||||||
|
|
||||||
// Check if there are any conflicts with existing entries
|
// Check if there are any conflicts with existing entries
|
||||||
$length = trim($playlist->getLength());
|
$length = trim($playlist->getLength());
|
||||||
var_dump($length);
|
//var_dump($length);
|
||||||
if (empty($length)) {
|
if (empty($length)) {
|
||||||
return new PEAR_Error("Length is empty.");
|
return new PEAR_Error("Length is empty.");
|
||||||
}
|
}
|
||||||
|
@ -123,10 +123,10 @@ class ScheduleGroup {
|
||||||
$itemStartTime = $p_datetime;
|
$itemStartTime = $p_datetime;
|
||||||
|
|
||||||
$plItems = $playlist->getContents();
|
$plItems = $playlist->getContents();
|
||||||
var_dump($plItems);
|
//var_dump($plItems);
|
||||||
foreach ($plItems as $row) {
|
foreach ($plItems as $row) {
|
||||||
$trackLength = $row["cliplength"];
|
$trackLength = $row["cliplength"];
|
||||||
var_dump($trackLength);
|
//var_dump($trackLength);
|
||||||
$sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"]
|
$sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"]
|
||||||
." (id, playlist_id, starts, ends, group_id, file_id,"
|
." (id, playlist_id, starts, ends, group_id, file_id,"
|
||||||
." clip_length, cue_in, cue_out, fade_in, fade_out)"
|
." clip_length, cue_in, cue_out, fade_in, fade_out)"
|
||||||
|
@ -136,7 +136,7 @@ class ScheduleGroup {
|
||||||
." '{$row['cueout']}', '{$row['fadein']}','{$row['fadeout']}')";
|
." '{$row['cueout']}', '{$row['fadein']}','{$row['fadeout']}')";
|
||||||
$result = $CC_DBC->query($sql);
|
$result = $CC_DBC->query($sql);
|
||||||
if (PEAR::isError($result)) {
|
if (PEAR::isError($result)) {
|
||||||
var_dump($sql);
|
//var_dump($sql);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
$itemStartTime = $CC_DBC->getOne("SELECT TIMESTAMP '$itemStartTime' + INTERVAL '$trackLength'");
|
$itemStartTime = $CC_DBC->getOne("SELECT TIMESTAMP '$itemStartTime' + INTERVAL '$trackLength'");
|
||||||
|
@ -173,7 +173,7 @@ class ScheduleGroup {
|
||||||
}
|
}
|
||||||
$sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"]
|
$sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"]
|
||||||
." WHERE group_id = ".$this->groupId;
|
." WHERE group_id = ".$this->groupId;
|
||||||
|
//echo $sql;
|
||||||
return $CC_DBC->query($sql);
|
return $CC_DBC->query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,9 +229,9 @@ class Schedule {
|
||||||
." WHERE (starts >= '$p_datetime') "
|
." WHERE (starts >= '$p_datetime') "
|
||||||
." AND (ends <= (TIMESTAMP '$p_datetime' + INTERVAL '$p_length'))";
|
." AND (ends <= (TIMESTAMP '$p_datetime' + INTERVAL '$p_length'))";
|
||||||
//$_SESSION["debug"] = $sql;
|
//$_SESSION["debug"] = $sql;
|
||||||
var_dump($sql);
|
//var_dump($sql);
|
||||||
$count = $CC_DBC->GetOne($sql);
|
$count = $CC_DBC->GetOne($sql);
|
||||||
var_dump($count);
|
//var_dump($count);
|
||||||
return ($count == '0');
|
return ($count == '0');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1660,30 +1660,6 @@ class StoredFile {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get and optionally create subdirectory in real filesystem for storing
|
|
||||||
* 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 getRealFileName()
|
|
||||||
{
|
|
||||||
return $this->gunid.".".$this->getFileExtension();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get real filename of raw media data
|
* Get real filename of raw media data
|
||||||
*
|
*
|
||||||
|
@ -1701,7 +1677,8 @@ class StoredFile {
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
return "http://".$CC_CONFIG["storageUrlHost"]
|
return "http://".$CC_CONFIG["storageUrlHost"]
|
||||||
.$CC_CONFIG["apiPath"]."get_media.php?file={$this->getRealFileName()}";
|
.$CC_CONFIG["apiPath"]."get_media.php?file="
|
||||||
|
.$this->gunid.".".$this->getFileExtension();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1729,5 +1706,5 @@ class StoredFile {
|
||||||
return $CC_CONFIG['accessDir']."/$p_token.$p_ext";
|
return $CC_CONFIG['accessDir']."/$p_token.$p_ext";
|
||||||
}
|
}
|
||||||
|
|
||||||
} // class StoredFile
|
} // class StoredFile
|
||||||
?>
|
?>
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
$path = dirname(__FILE__).'/../../3rd_party/php/pear';
|
$path = dirname(__FILE__).'/../../3rd_party/php/pear';
|
||||||
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
|
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(dirname(__FILE__).'/../../conf.php');
|
||||||
require_once('DB.php');
|
require_once('DB.php');
|
||||||
|
|
|
@ -70,7 +70,6 @@ class SchedulerTests extends PHPUnit_TestCase {
|
||||||
if (PEAR::isError($this->groupIdCreated)) {
|
if (PEAR::isError($this->groupIdCreated)) {
|
||||||
$this->fail("Failed to create scheduled item: ". $this->groupIdCreated->getMessage());
|
$this->fail("Failed to create scheduled item: ". $this->groupIdCreated->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
$group = new ScheduleGroup($this->groupIdCreated);
|
$group = new ScheduleGroup($this->groupIdCreated);
|
||||||
if ($group->count() != 3) {
|
if ($group->count() != 3) {
|
||||||
$this->fail("Wrong number of items added.");
|
$this->fail("Wrong number of items added.");
|
||||||
|
@ -91,12 +90,23 @@ class SchedulerTests extends PHPUnit_TestCase {
|
||||||
function testIsScheduleEmptyInRange() {
|
function testIsScheduleEmptyInRange() {
|
||||||
$i = new ScheduleGroup();
|
$i = new ScheduleGroup();
|
||||||
$this->groupIdCreated = $i->add('2011-10-10 01:30:23', $this->storedFile->getId());
|
$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')) {
|
if (PEAR::isError($this->groupIdCreated)) {
|
||||||
$this->fail("Reporting empty schedule when it isnt.");
|
$this->fail($this->groupIdCreated->getMessage());
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
$i->remove();
|
if (Schedule::isScheduleEmptyInRange('2011-10-10 01:30:23', '00:00:12.555')) {
|
||||||
if (!Schedule::isScheduleEmptyInRange('2011-10-10 01:30:23', '00:00:01.432153')) {
|
$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.");
|
$this->fail("Reporting booked schedule when it isnt.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue