From 1acdf2ca800cd832a2f9ee792d9d680a5bdf0197 Mon Sep 17 00:00:00 2001 From: drigato Date: Thu, 27 Feb 2014 07:35:08 -0500 Subject: [PATCH] CC-5716: Write database test to check the show content after editing a repeating show and removing a repeat day --- .../services/database/ShowServiceDbTest.php | 56 +++++++ ...tRepeatShowDayUpdatesScheduleCorrectly.xml | 137 ++++++++++++++++++ 2 files changed, 193 insertions(+) create mode 100644 airtime_mvc/tests/application/services/database/datasets/test_removeFirstRepeatShowDayUpdatesScheduleCorrectly.xml diff --git a/airtime_mvc/tests/application/services/database/ShowServiceDbTest.php b/airtime_mvc/tests/application/services/database/ShowServiceDbTest.php index 3fdf769f3..718b55c14 100644 --- a/airtime_mvc/tests/application/services/database/ShowServiceDbTest.php +++ b/airtime_mvc/tests/application/services/database/ShowServiceDbTest.php @@ -542,4 +542,60 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase $ds ); } + + /** + * Tests that when you remove the first repeat show day, which changes + * the show's first instance start date, updates the scheduled content + * correctly + */ + public function testRemoveFirstRepeatShowDayUpdatesScheduleCorrectly() + { + TestHelper::loginUser(); + + $data = ShowServiceData::getWeeklyRepeatNoEndNoRRData(); + $data["add_show_day_check"] = array(3,4); + $data["add_show_linked"] = 1; + $showService = new Application_Service_ShowService(null, $data); + $showService->addUpdateShow($data); + + //insert some fake tracks into cc_schedule table + $scheduleItems = array( + 0 => array( + "id" => 0, + "instance" => 1 + ) + ); + $mediaItems = array( + 0 => array( + "id" => 1, + "cliplength" => "00:04:32", + "cuein" => "00:00:00", + "cueout" => "00:04:32", + "fadein" => 00.5, + "fadeout" => 00.5, + "sched_id" => null, + "type" => 0 + ), + 1 => array( + "id" => 2, + "cliplength" => "00:03:21", + "cuein" => "00:00:00", + "cueout" => "00:03:21", + "fadein" => 00.5, + "fadeout" => 00.5, + "sched_id" => null, + "type" => 0 + ) + ); + $scheduler = new Application_Model_Scheduler(); + $scheduler->scheduleAfter($scheduleItems, $mediaItems); + + //delete the first repeat day + $data["add_show_day_check"] = array(4); + $data["add_show_id"] = 1; + $showService = new Application_Service_ShowService(null, $data, true); + $showService->addUpdateShow($data); + + + } } diff --git a/airtime_mvc/tests/application/services/database/datasets/test_removeFirstRepeatShowDayUpdatesScheduleCorrectly.xml b/airtime_mvc/tests/application/services/database/datasets/test_removeFirstRepeatShowDayUpdatesScheduleCorrectly.xml new file mode 100644 index 000000000..871729009 --- /dev/null +++ b/airtime_mvc/tests/application/services/database/datasets/test_removeFirstRepeatShowDayUpdatesScheduleCorrectly.xml @@ -0,0 +1,137 @@ + + + + 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 + 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-12 + 1 + 0 + +
+ + + id + starts + ends + show_id + record + rebroadcast + instance_id + modified_instance + + 1 + 2016-01-01 00:00:00 + 2016-01-01 01:00:00 + 1 + 0 + 0 + + + + + 2 + 2016-01-08 00:00:00 + 2016-01-08 01:00:00 + 1 + 0 + 0 + + + + + 3 + 2016-01-15 00:00:00 + 2016-01-15 01:00:00 + 1 + 0 + 0 + + + + + 4 + 2016-01-22 00:00:00 + 2016-01-22 01:00:00 + 1 + 0 + 0 + + + + + 5 + 2016-01-29 00:00:00 + 2016-01-29 01:00:00 + 1 + 0 + 0 + + + + + 6 + 2016-02-05 00:00:00 + 2016-02-05 01:00:00 + 1 + 0 + 0 + + + +
+ + +
+ + +
+
\ No newline at end of file