CC-2833: Use ClassLoaders for PHP Files

-Done for class Schedule and ScheduleGroup
This commit is contained in:
martin 2011-09-23 16:50:00 -04:00
parent cd95170b06
commit 1e9a8a28fe
13 changed files with 264 additions and 267 deletions

View file

@ -29,14 +29,14 @@ class SchedulerTests extends PHPUnit_TestCase {
function testDateToId() {
$dateStr = "2006-04-02 10:20:08.123456";
$id = ScheduleGroup::dateToId($dateStr);
$id = Application_Model_ScheduleGroup::dateToId($dateStr);
$expected = "20060402102008123";
if ($id != $expected) {
$this->fail("Did not convert date to ID correctly #1: $id != $expected");
}
$dateStr = "2006-04-02 10:20:08";
$id = ScheduleGroup::dateToId($dateStr);
$id = Application_Model_ScheduleGroup::dateToId($dateStr);
$expected = "20060402102008000";
if ($id != $expected) {
$this->fail("Did not convert date to ID correctly #2: $id != $expected");
@ -44,13 +44,13 @@ class SchedulerTests extends PHPUnit_TestCase {
}
function testAddAndRemoveAudioFile() {
$i = new ScheduleGroup();
$i = new Application_Model_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());
}
$i = new ScheduleGroup($this->groupIdCreated);
$i = new Application_Model_ScheduleGroup($this->groupIdCreated);
$result = $i->remove();
if ($result != 1) {
$this->fail("Did not remove item.");
@ -65,12 +65,12 @@ class SchedulerTests extends PHPUnit_TestCase {
$result = $playlist->addAudioClip($this->storedFile2->getId());
$result = $playlist->addAudioClip($this->storedFile2->getId());
$i = new ScheduleGroup();
$i = new Application_Model_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);
$group = new Application_Model_ScheduleGroup($this->groupIdCreated);
if ($group->count() != 3) {
$this->fail("Wrong number of items added.");
}
@ -88,13 +88,13 @@ class SchedulerTests extends PHPUnit_TestCase {
}
function testIsScheduleEmptyInRange() {
$i = new ScheduleGroup();
$i = new Application_Model_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')) {
if (Application_Model_Schedule::isScheduleEmptyInRange('2011-10-10 01:30:23', '00:00:12.555')) {
$this->fail("Reporting empty schedule when it isnt.");
return;
}
@ -104,7 +104,7 @@ class SchedulerTests extends PHPUnit_TestCase {
$this->fail("Failed to delete schedule group.");
return;
}
if (!Schedule::isScheduleEmptyInRange('2011-10-10 01:30:23', '00:00:12.555')) {
if (!Application_Model_Schedule::isScheduleEmptyInRange('2011-10-10 01:30:23', '00:00:12.555')) {
$this->fail("Reporting booked schedule when it isnt.");
return;
}
@ -112,11 +112,11 @@ class SchedulerTests extends PHPUnit_TestCase {
/*
function testGetItems() {
$i1 = new ScheduleGroup();
$i1 = new Application_Model_ScheduleGroup();
$groupId1 = $i1->add('2008-01-01 12:00:00.000', $this->storedFile->getId());
$i2 = new ScheduleGroup();
$i2 = new Application_Model_ScheduleGroup();
$i2->addAfter($groupId1, $this->storedFile->getId());
$items = Schedule::GetItems("2008-01-01", "2008-01-02");
$items = Application_Model_Schedule::GetItems("2008-01-01", "2008-01-02");
if (count($items) != 2) {
$this->fail("Wrong number of items returned.");
return;