From 94912ed4453585f8029e563c847ff306ffae426f Mon Sep 17 00:00:00 2001 From: drigato Date: Mon, 6 Jan 2014 18:08:57 -0500 Subject: [PATCH] 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 --- airtime_mvc/tests/application/bootstrap.php | 3 ++ .../tests/application/models/ShowTest.php | 26 +++++++++++ .../application/models/files/cc_show_seed.xml | 44 ++++++++++++++++++- 3 files changed, 72 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/tests/application/bootstrap.php b/airtime_mvc/tests/application/bootstrap.php index bb5bdb43e..54b634f05 100644 --- a/airtime_mvc/tests/application/bootstrap.php +++ b/airtime_mvc/tests/application/bootstrap.php @@ -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()); diff --git a/airtime_mvc/tests/application/models/ShowTest.php b/airtime_mvc/tests/application/models/ShowTest.php index 8b93e6dad..c26ac054a 100644 --- a/airtime_mvc/tests/application/models/ShowTest.php +++ b/airtime_mvc/tests/application/models/ShowTest.php @@ -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 + ); + } } diff --git a/airtime_mvc/tests/application/models/files/cc_show_seed.xml b/airtime_mvc/tests/application/models/files/cc_show_seed.xml index 2bef820ad..988499585 100644 --- a/airtime_mvc/tests/application/models/files/cc_show_seed.xml +++ b/airtime_mvc/tests/application/models/files/cc_show_seed.xml @@ -14,5 +14,47 @@ live_stream_pass linked is_linkable - + + + + id + first_show + last_show + start_time + timezone + duration + day + repeat_type + next_pop_date + show_id + record +
+ + + id + starts + ends + show_id + record + rebroadcast + instance_id + file_id + time_filled + created + last_scheduled + modified_instance +
+ + + id + day_offset + start_time + show_id +
+ + + id + show_id + subjs_id +
\ No newline at end of file