SchedulerExportTests.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. require_once(dirname(__FILE__)."/../Schedule.php");
  3. class SchedulerExportTests extends PHPUnit_TestCase {
  4. function setup() {
  5. global $CC_CONFIG;
  6. $con = Propel::getConnection();
  7. // Clear the files table
  8. $sql = "DELETE FROM ".$CC_CONFIG["filesTable"];
  9. $con->exec($sql);
  10. // Add a file
  11. $values = array("filepath" => dirname(__FILE__)."/test10001.mp3");
  12. $this->storedFile = Application_Model_StoredFile::Insert($values, false);
  13. // Add a file
  14. $values = array("filepath" => dirname(__FILE__)."/test10002.mp3");
  15. $this->storedFile2 = Application_Model_StoredFile::Insert($values, false);
  16. // Clear the schedule table
  17. $sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"];
  18. $con->exec($sql);
  19. // Create a playlist
  20. $playlist = new Application_Model_Playlist();
  21. $playlist->create("Scheduler Unit Test");
  22. $result = $playlist->addAudioClip($this->storedFile->getId());
  23. $result = $playlist->addAudioClip($this->storedFile2->getId());
  24. $result = $playlist->addAudioClip($this->storedFile2->getId());
  25. // Schedule it
  26. $i = new Application_Model_ScheduleGroup();
  27. $this->groupIdCreated = $i->add('2010-11-11 01:30:23', null, $playlist->getId());
  28. }
  29. public function testExport() {
  30. echo Application_Model_Schedule::ExportRangeAsJson("2010-01-01 00:00:00", "2011-01-01 00:00:00");
  31. }
  32. }