CC-5651: Unit Test the Scheduler

Created file that returns test data
Added a non-repeating, non-record&rebroadcast show creation test (not working yet)
Updated the cc_show_seed.xml file to include all 5 show tables
This commit is contained in:
drigato 2014-01-06 18:08:57 -05:00
parent fea3f4073a
commit 94912ed445
3 changed files with 72 additions and 1 deletions

View File

@ -43,6 +43,9 @@ set_include_path(APPLICATION_PATH . '/services' . PATH_SEPARATOR . get_include_p
//Controller plugins.
set_include_path(APPLICATION_PATH . '/controllers/plugins' . PATH_SEPARATOR . get_include_path());
//test data
set_include_path(APPLICATION_PATH . '/../tests/application/testdata' . PATH_SEPARATOR . get_include_path());
//Zend framework
if (file_exists('/usr/share/php/libzend-framework-php')) {
set_include_path('/usr/share/php/libzend-framework-php' . PATH_SEPARATOR . get_include_path());

View File

@ -3,6 +3,7 @@ require_once "Zend/Test/PHPUnit/DatabaseTestCase.php";
require_once "ShowService.php";
require_once "../application/configs/conf.php";
require_once "AirtimeInstall.php";
require_once "ShowData.php";
class ShowTest extends Zend_Test_PHPUnit_DatabaseTestCase
{
@ -103,4 +104,29 @@ class ShowTest extends Zend_Test_PHPUnit_DatabaseTestCase
$ds
);
}
/* Tests that a non-repeating, non-record, and non-rebroadcast show
* gets created properly
*/
public function testNoRepeatNoRRShowCreated()
{
$data = ShowData::getNoRepeatNoRRData();
$showService = new Application_Service_ShowService();
$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 * 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__)."/files/cc_show_insertIntoAssertion.xml"),
$ds
);
}
}

View File

@ -14,5 +14,47 @@
<column>live_stream_pass</column>
<column>linked</column>
<column>is_linkable</column>
</table>
</table>
<table name="cc_show_days">
<column>id</column>
<column>first_show</column>
<column>last_show</column>
<column>start_time</column>
<column>timezone</column>
<column>duration</column>
<column>day</column>
<column>repeat_type</column>
<column>next_pop_date</column>
<column>show_id</column>
<column>record</column>
</table>
<table name="cc_show_instances">
<column>id</column>
<column>starts</column>
<column>ends</column>
<column>show_id</column>
<column>record</column>
<column>rebroadcast</column>
<column>instance_id</column>
<column>file_id</column>
<column>time_filled</column>
<column>created</column>
<column>last_scheduled</column>
<column>modified_instance</column>
</table>
<table name="cc_show_rebroadcast">
<column>id</column>
<column>day_offset</column>
<column>start_time</column>
<column>show_id</column>
</table>
<table name="cc_show_hosts">
<column>id</column>
<column>show_id</column>
<column>subjs_id</column>
</table>
</dataset>