From 0f4099e48163ef7b7557407048166834322571d8 Mon Sep 17 00:00:00 2001 From: drigato Date: Thu, 9 Jan 2014 16:58:56 -0500 Subject: [PATCH] CC-5651: Unit Test the Scheduler Added test for deleting a show instance --- .../tests/application/models/ShowTest.php | 27 ++++ .../models/files/test_deleteShowInstance.xml | 145 ++++++++++++++++++ 2 files changed, 172 insertions(+) create mode 100644 airtime_mvc/tests/application/models/files/test_deleteShowInstance.xml diff --git a/airtime_mvc/tests/application/models/ShowTest.php b/airtime_mvc/tests/application/models/ShowTest.php index 9500f4ed9..b57558460 100644 --- a/airtime_mvc/tests/application/models/ShowTest.php +++ b/airtime_mvc/tests/application/models/ShowTest.php @@ -159,4 +159,31 @@ class ShowTest extends Zend_Test_PHPUnit_DatabaseTestCase $ds ); } + + /* Tests that a show instances gets deleted from it's repeating sequence + * properly + */ + public function testDeleteShowInstance() + { + TestHelper::loginUser(); + + $data = ShowData::getWeeklyRepeatNoEndNoRRData(); + $service_show = new Application_Service_ShowService(null, $data); + $service_show->addUpdateShow($data); + //$service_show->deleteShow(3, true); + + $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, file_id, time_filled, last_scheduled, 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__)."/files/test_deleteShowInstance.xml"), + $ds + ); + } } diff --git a/airtime_mvc/tests/application/models/files/test_deleteShowInstance.xml b/airtime_mvc/tests/application/models/files/test_deleteShowInstance.xml new file mode 100644 index 000000000..ac61f015c --- /dev/null +++ b/airtime_mvc/tests/application/models/files/test_deleteShowInstance.xml @@ -0,0 +1,145 @@ + + + + id + name + url + genre + description + color + background_color + live_stream_using_airtime_auth + live_stream_using_custom_auth + live_stream_user + live_stream_pass + linked + is_linkable + + 1 + test show + + + + ffffff + 364492 + + + + + + 1 + +
+ + + id + first_show + last_show + start_time + timezone + duration + day + repeat_type + next_pop_date + show_id + record + + 1 + 2016-01-01 + + 00:00:00 + UTC + 01:00 + 5 + 0 + 2016-02-05 + 1 + 0 + +
+ + + id + starts + ends + show_id + record + rebroadcast + instance_id + file_id + time_filled + last_scheduled + modified_instance + + 1 + 2016-01-01 00:00:00 + 2016-01-01 01:00:00 + 1 + 0 + 0 + + + 00:00:00 + + + + + 2 + 2016-01-08 00:00:00 + 2016-01-08 01:00:00 + 1 + 0 + 0 + + + 00:00:00 + + + + + 3 + 2016-01-15 00:00:00 + 2016-01-15 01:00:00 + 1 + 0 + 0 + + + 00:00:00 + + 1 + + + 4 + 2016-01-22 00:00:00 + 2016-01-22 01:00:00 + 1 + 0 + 0 + + + 00:00:00 + + + + + 5 + 2016-01-29 00:00:00 + 2016-01-29 01:00:00 + 1 + 0 + 0 + + + 00:00:00 + + + +
+ + +
+ + +
+
\ No newline at end of file