CC-5651: Unit Test the Scheduler

Added some linked show tests
This commit is contained in:
drigato 2014-01-24 17:25:40 -05:00
parent 2bbc42f532
commit d6aabfdc88
3 changed files with 321 additions and 0 deletions

View file

@ -417,4 +417,51 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase
$ds
);
}
public function testLinkedShow()
{
TestHelper::loginUser();
/** Test creating a linked show **/
$data = ShowServiceData::getWeeklyRepeatNoEndNoRRData();
$data["add_show_linked"] = 1;
$showService = new Application_Service_ShowService(null, $data);
$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');
$this->assertDataSetsEqual(
$this->createXmlDataSet(dirname(__FILE__)."/datasets/test_createLinkedShow.xml"),
$ds
);
/** Test unlinking a show **/
// TODO: find out why linked and is_linkable columns are getting set to NULL
$data["add_show_id"] = 1;
$data["add_show_linked"] = 0;
$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 order by id');
$ds->addTable('cc_show_rebroadcast', 'select * from cc_show_rebroadcast');
$ds->addTable('cc_show_hosts', 'select * from cc_show_hosts');
$this->assertDataSetsEqual(
$this->createXmlDataSet(dirname(__FILE__)."/datasets/test_unlinkLinkedShow.xml"),
$ds
);
}
}