diff --git a/airtime_mvc/tests/application/services/database/ShowServiceDbTest.php b/airtime_mvc/tests/application/services/database/ShowServiceDbTest.php index 4dea8f456..76b405606 100644 --- a/airtime_mvc/tests/application/services/database/ShowServiceDbTest.php +++ b/airtime_mvc/tests/application/services/database/ShowServiceDbTest.php @@ -370,6 +370,7 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase $showService = new Application_Service_ShowService(null, $data); $showService->addUpdateShow($data); + //move the start date forward one week and the start time forward one hour $editData = ShowServiceData::getEditRepeatInstanceData(); //need to create a new service so it gets constructed with the new data @@ -419,8 +420,32 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase ); } - public function testCreateShowOverDaylightSavingsTime() + public function testRepeatShowCreationWhenUserMovesForwardInCalendar() { - + TestHelper::loginUser(); + + $data = ShowServiceData::getWeeklyRepeatNoEndNoRRData(); + $data["add_show_repeat_type"] = "1"; + $showService = new Application_Service_ShowService(null, $data); + + $showService->addUpdateShow($data); + + //simulate the user moves forward in the calendar + $end = new DateTime("2016-03-12", new DateTimeZone("UTC")); + $showService->delegateInstanceCreation(null, $end, 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, 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_repeatShowCreationWhenUserMovesForwardInCalendar.xml"), + $ds + ); } } diff --git a/airtime_mvc/tests/application/services/database/datasets/test_createWeeklyRepeatNoEndNoRRShow.xml b/airtime_mvc/tests/application/services/database/datasets/test_createWeeklyRepeatNoEndNoRRShow.xml index 937f0a111..b6a7c709b 100644 --- a/airtime_mvc/tests/application/services/database/datasets/test_createWeeklyRepeatNoEndNoRRShow.xml +++ b/airtime_mvc/tests/application/services/database/datasets/test_createWeeklyRepeatNoEndNoRRShow.xml @@ -29,9 +29,9 @@ 1 - + - +
idfirst_showlast_show diff --git a/airtime_mvc/tests/application/services/database/datasets/test_repeatShowCreationWhenUserMovesForwardInCalendar.xml b/airtime_mvc/tests/application/services/database/datasets/test_repeatShowCreationWhenUserMovesForwardInCalendar.xml new file mode 100644 index 000000000..d5f6ea36d --- /dev/null +++ b/airtime_mvc/tests/application/services/database/datasets/test_repeatShowCreationWhenUserMovesForwardInCalendar.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 + +
+ + + 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 + 1 + 2016-03-25 + 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-15 00:00:00 + 2016-01-15 01:00:00 + 1 + 0 + 0 + + + + + 3 + 2016-01-29 00:00:00 + 2016-01-29 01:00:00 + 1 + 0 + 0 + + + + + 4 + 2016-02-12 00:00:00 + 2016-02-12 01:00:00 + 1 + 0 + 0 + + + + + 5 + 2016-02-26 00:00:00 + 2016-02-26 01:00:00 + 1 + 0 + 0 + + + + + 6 + 2016-03-11 00:00:00 + 2016-03-11 01:00:00 + 1 + 0 + 0 + + + +
+ + +
+ + +
+ \ No newline at end of file