From 03bb0e1df93439f9be57ec298b89d458c514328b Mon Sep 17 00:00:00 2001 From: drigato Date: Fri, 7 Mar 2014 15:59:57 -0500 Subject: [PATCH] CC-5725 Changing a show's repeat type removes first instance from repeating seriesCC-5726: Write database test cases for CC-5725 --- .../services/database/ShowServiceDbTest.php | 65 +++++++++++ .../datasets/test_weeklyToBiWeekly.xml | 107 ++++++++++++++++++ 2 files changed, 172 insertions(+) create mode 100644 airtime_mvc/tests/application/services/database/datasets/test_weeklyToBiWeekly.xml diff --git a/airtime_mvc/tests/application/services/database/ShowServiceDbTest.php b/airtime_mvc/tests/application/services/database/ShowServiceDbTest.php index 576ac7ca1..0531bbbe0 100644 --- a/airtime_mvc/tests/application/services/database/ShowServiceDbTest.php +++ b/airtime_mvc/tests/application/services/database/ShowServiceDbTest.php @@ -661,4 +661,69 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase $ds ); } + + public function testChangeRepeatTypeFromWeeklyToNoRepeat() + { + TestHelper::loginUser(); + + //test change repeat type from weekly to no-repeat + $data = ShowServiceData::getWeeklyRepeatNoEndNoRRData(); + $showService = new Application_Service_ShowService(null, $data); + $showService->addUpdateShow($data); + + $data["add_show_repeats"] = 0; + $data["add_show_id"] = 1; + $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'); + $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_createNoRepeatNoRRShow.xml"), + $ds + ); + } + + public function testChangeRepeatTypeFromWeeklyToBiWeekly() + { + TestHelper::loginUser(); + + //test change repeat type weekly to bi-weekly + $data = ShowServiceData::getWeeklyRepeatNoEndNoRRData(); + $showService = new Application_Service_ShowService(null, $data); + $showService->addUpdateShow($data); + + $data["add_show_id"] = 1; + $data["add_show_repeat_type"] = 1; + $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'); + $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_weeklyToBiWeekly.xml"), + $ds + ); + } + + public function testChangeRepeatTypeFromMonthlyWeeklyToNoRepeat() + { + + } } diff --git a/airtime_mvc/tests/application/services/database/datasets/test_weeklyToBiWeekly.xml b/airtime_mvc/tests/application/services/database/datasets/test_weeklyToBiWeekly.xml new file mode 100644 index 000000000..9e65db067 --- /dev/null +++ b/airtime_mvc/tests/application/services/database/datasets/test_weeklyToBiWeekly.xml @@ -0,0 +1,107 @@ + + + + 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 + + 2 + 2016-01-01 + + 00:00:00 + UTC + 01:00 + 5 + 1 + 2016-02-12 + 1 + 0 + +
+ + + id + starts + ends + show_id + record + rebroadcast + instance_id + modified_instance + + 7 + 2016-01-01 00:00:00 + 2016-01-01 01:00:00 + 1 + 0 + 0 + + + + + 8 + 2016-01-15 00:00:00 + 2016-01-15 01:00:00 + 1 + 0 + 0 + + + + + 9 + 2016-01-29 00:00:00 + 2016-01-29 01:00:00 + 1 + 0 + 0 + + + +
+ + +
+ + +
+
\ No newline at end of file