CC-5715: Write database test to check the schedule start times after editing a repeating show and changing the repeat day

This commit is contained in:
drigato 2014-02-27 13:08:41 -05:00
parent 4cb785a062
commit 1715f2187d
2 changed files with 199 additions and 5 deletions

View file

@ -568,15 +568,15 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase
$scheduleItems = array(
0 => array(
"id" => 0,
"instance" => 1,
"timestamp" => time()
"id" => 0,
"instance" => 1,
"timestamp" => time()
)
);
$mediaItems = array(
0 => array(
"id" => 1,
"type" => "audioclip"
"id" => 1,
"type" => "audioclip"
)
);
$scheduler = new Application_Model_Scheduler();
@ -604,4 +604,61 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase
$ds
);
}
public function testChangeRepeatDayUpdatesScheduleCorrectly()
{
TestHelper::loginUser();
$data = ShowServiceData::getWeeklyRepeatNoEndNoRRData();
$data["add_show_start_date"] = "2016-01-29";
$data["add_show_day_check"] = array(5);
$data["add_show_linked"] = 1;
$showService = new Application_Service_ShowService(null, $data);
$showService->addUpdateShow($data);
//insert some fake tracks into cc_schedule table
$ccFiles = new CcFiles();
$ccFiles
->setDbCueIn("00:00:00")
->setDbCueOut("00:04:32")
->save();
$scheduleItems = array(
0 => array(
"id" => 0,
"instance" => 1,
"timestamp" => time()
)
);
$mediaItems = array(
0 => array(
"id" => 1,
"type" => "audioclip"
)
);
$scheduler = new Application_Model_Scheduler();
$scheduler->scheduleAfter($scheduleItems, $mediaItems);
//delete the first repeat day
$data["add_show_day_check"] = array(6);
$data["add_show_id"] = 1;
$showService = new Application_Service_ShowService(null, $data, true);
$showService->addUpdateShow($data);
$ds = new Zend_Test_PHPUnit_Db_DataSet_QueryDataSet(
$this->getConnection()
);
$ds->addTable('cc_show', 'select * from cc_show');
$ds->addTable('cc_show_days', 'select * from cc_show_days');
$ds->addTable('cc_show_instances', 'select id, starts, ends, show_id, record, rebroadcast, instance_id, modified_instance from cc_show_instances');
$ds->addTable('cc_show_rebroadcast', 'select * from cc_show_rebroadcast');
$ds->addTable('cc_show_hosts', 'select * from cc_show_hosts');
$ds->addTable('cc_schedule', 'select id, starts, ends, file_id, clip_length, fade_in, fade_out, cue_in, cue_out, instance_id, playout_status from cc_schedule');
$this->assertDataSetsEqual(
$this->createXmlDataSet(dirname(__FILE__)."/datasets/test_changeRepeatDayUpdatesScheduleCorrectly.xml"),
$ds
);
}
}