CC-2833: Use ClassLoaders for PHP Files
-made MusicDir, Playlist and StoredFile autoload
This commit is contained in:
parent
4e79a88adc
commit
2be0960ed5
22 changed files with 124 additions and 551 deletions
|
@ -12,18 +12,18 @@ class SchedulerExportTests extends PHPUnit_TestCase {
|
|||
|
||||
// Add a file
|
||||
$values = array("filepath" => dirname(__FILE__)."/test10001.mp3");
|
||||
$this->storedFile = StoredFile::Insert($values, false);
|
||||
$this->storedFile = Application_Model_StoredFile::Insert($values, false);
|
||||
|
||||
// Add a file
|
||||
$values = array("filepath" => dirname(__FILE__)."/test10002.mp3");
|
||||
$this->storedFile2 = StoredFile::Insert($values, false);
|
||||
$this->storedFile2 = Application_Model_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 = new Application_Model_Playlist();
|
||||
$playlist->create("Scheduler Unit Test");
|
||||
$result = $playlist->addAudioClip($this->storedFile->getId());
|
||||
$result = $playlist->addAudioClip($this->storedFile2->getId());
|
||||
|
|
|
@ -16,11 +16,11 @@ class SchedulerTests extends PHPUnit_TestCase {
|
|||
|
||||
// Add a file
|
||||
$values = array("filepath" => dirname(__FILE__)."/test10001.mp3");
|
||||
$this->storedFile = StoredFile::Insert($values, false);
|
||||
$this->storedFile = Application_Model_StoredFile::Insert($values, false);
|
||||
|
||||
// Add a file
|
||||
$values = array("filepath" => dirname(__FILE__)."/test10002.mp3");
|
||||
$this->storedFile2 = StoredFile::Insert($values, false);
|
||||
$this->storedFile2 = Application_Model_StoredFile::Insert($values, false);
|
||||
|
||||
// Clear the schedule table
|
||||
//$sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"];
|
||||
|
@ -59,7 +59,7 @@ class SchedulerTests extends PHPUnit_TestCase {
|
|||
|
||||
function testAddAndRemovePlaylist() {
|
||||
// Create a playlist
|
||||
$playlist = new Playlist();
|
||||
$playlist = new Application_Model_Playlist();
|
||||
$playlist->create("Scheduler Unit Test ".uniqid());
|
||||
$result = $playlist->addAudioClip($this->storedFile->getId());
|
||||
$result = $playlist->addAudioClip($this->storedFile2->getId());
|
||||
|
@ -84,7 +84,7 @@ class SchedulerTests extends PHPUnit_TestCase {
|
|||
$this->fail("Did not remove item.");
|
||||
}
|
||||
|
||||
Playlist::Delete($playlist->getId());
|
||||
Application_Model_Playlist::Delete($playlist->getId());
|
||||
}
|
||||
|
||||
function testIsScheduleEmptyInRange() {
|
||||
|
|
|
@ -43,7 +43,7 @@ class StoredFileTest extends PHPUnit_TestCase {
|
|||
|
||||
// Delete any old data from previous tests
|
||||
$md5 = md5_file($filePath);
|
||||
$duplicate = StoredFile::RecallByMd5($md5);
|
||||
$duplicate = Application_Model_StoredFile::RecallByMd5($md5);
|
||||
if ($duplicate) {
|
||||
$duplicate->delete();
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class StoredFileTest extends PHPUnit_TestCase {
|
|||
// Test inserting a file by linking
|
||||
$values = array("filepath" => $filePath,
|
||||
"dc:description" => "Unit test ".time());
|
||||
$storedFile = StoredFile::Insert($values, false);
|
||||
$storedFile = Application_Model_StoredFile::Insert($values, false);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
$this->fail("Failed to create StoredFile: ".$storedFile->getMessage());
|
||||
return;
|
||||
|
@ -64,7 +64,7 @@ class StoredFileTest extends PHPUnit_TestCase {
|
|||
}
|
||||
|
||||
// Test loading metadata
|
||||
$f = new StoredFile();
|
||||
$f = new Application_Model_StoredFile();
|
||||
$f->__setGunid($storedFile->getGunid());
|
||||
$f->loadMetadata();
|
||||
if (!is_array($md = $f->getMetadata())) {
|
||||
|
@ -74,7 +74,7 @@ class StoredFileTest extends PHPUnit_TestCase {
|
|||
//var_dump($md);
|
||||
|
||||
// Check if the length field has been set.
|
||||
$f2 = StoredFile::RecallByGunid($storedFile->getGunid());
|
||||
$f2 = Application_Model_StoredFile::RecallByGunid($storedFile->getGunid());
|
||||
$m2 = $f2->getMetadata();
|
||||
if (!isset($m2["length"]) || $m2["length"] == "00:00:00.000000") {
|
||||
$this->fail("Length not reporting correctly in metadata.");
|
||||
|
|
|
@ -24,17 +24,17 @@ $CC_DBC->query($sql);
|
|||
|
||||
/*
|
||||
// Create a playlist
|
||||
$playlist = new Playlist();
|
||||
$playlist = new Application_Model_Playlist();
|
||||
$playlist->create("Calendar Load test playlist ".uniqid());
|
||||
|
||||
// Add a file
|
||||
$values = array("filepath" => __DIR__."/test10001.mp3");
|
||||
$storedFile = StoredFile::Insert($values, false);
|
||||
$storedFile = Application_Model_StoredFile::Insert($values, false);
|
||||
$result = $playlist->addAudioClip($storedFile->getId());
|
||||
|
||||
// Add a file
|
||||
$values = array("filepath" => __DIR__."/test10002.mp3");
|
||||
$storedFile2 = StoredFile::Insert($values, false);
|
||||
$storedFile2 = Application_Model_StoredFile::Insert($values, false);
|
||||
|
||||
$result = $playlist->addAudioClip($storedFile2->getId());
|
||||
$result = $playlist->addAudioClip($storedFile2->getId());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue