diff --git a/airtime_mvc/tests/application/models/ShowTest.php b/airtime_mvc/tests/application/models/ShowTest.php index f285aeec2..2cfc41123 100644 --- a/airtime_mvc/tests/application/models/ShowTest.php +++ b/airtime_mvc/tests/application/models/ShowTest.php @@ -123,7 +123,7 @@ class ShowTest extends Zend_Test_PHPUnit_DatabaseTestCase ); $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_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'); @@ -150,7 +150,7 @@ class ShowTest extends Zend_Test_PHPUnit_DatabaseTestCase ); $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_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'); @@ -176,7 +176,7 @@ class ShowTest extends Zend_Test_PHPUnit_DatabaseTestCase ); $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 order by id'); + $ds->addTable('cc_show_instances', 'select id, starts, ends, show_id, record, rebroadcast, instance_id, modified_instance from cc_show_instances order by id'); $ds->addTable('cc_show_rebroadcast', 'select * from cc_show_rebroadcast'); $ds->addTable('cc_show_hosts', 'select * from cc_show_hosts'); @@ -210,7 +210,7 @@ class ShowTest extends Zend_Test_PHPUnit_DatabaseTestCase ); $ds->addTable('cc_show', 'select * from cc_show'); $ds->addTable('cc_show_days', 'select * from cc_show_days order by first_show'); - $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 order by id'); + $ds->addTable('cc_show_instances', 'select id, starts, ends, show_id, record, rebroadcast, instance_id, modified_instance from cc_show_instances order by id'); $ds->addTable('cc_show_rebroadcast', 'select * from cc_show_rebroadcast'); $ds->addTable('cc_show_hosts', 'select * from cc_show_hosts'); @@ -219,4 +219,33 @@ class ShowTest extends Zend_Test_PHPUnit_DatabaseTestCase $ds ); } + + public function testEditRepeatingShowInstance() + { + TestHelper::loginUser(); + + $data = ShowData::getWeeklyRepeatNoEndNoRRData(); + $showService = new Application_Service_ShowService(null, $data); + + $showService->addUpdateShow($data); + $editData = ShowData::getEditRepeatInstanceData(); + + //need to create a new service so it gets constructed with the new data + $showService = new Application_Service_ShowService(null, $editData); + $showService->editRepeatingShowInstance($editData); + + $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 order by id'); + $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_editRepeatingShowInstance.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 5dc86ce14..970146a1e 100644 --- a/airtime_mvc/tests/application/models/files/cc_show_seed.xml +++ b/airtime_mvc/tests/application/models/files/cc_show_seed.xml @@ -11,5 +11,11 @@ shows_populated_until 2016-02-07 00:00:00 + + 2 + + timezone + UTC + \ No newline at end of file diff --git a/airtime_mvc/tests/application/models/files/test_deleteShowInstance.xml b/airtime_mvc/tests/application/models/files/test_deleteShowInstance.xml index 4044f8bb6..108680979 100644 --- a/airtime_mvc/tests/application/models/files/test_deleteShowInstance.xml +++ b/airtime_mvc/tests/application/models/files/test_deleteShowInstance.xml @@ -66,9 +66,6 @@ record rebroadcast instance_id - file_id - time_filled - last_scheduled modified_instance 1 @@ -78,9 +75,6 @@ 0 0 - - 00:00:00 - @@ -91,9 +85,6 @@ 0 0 - - 00:00:00 - @@ -104,9 +95,6 @@ 0 0 - - 00:00:00 - 1 @@ -117,9 +105,6 @@ 0 0 - - 00:00:00 - @@ -130,9 +115,6 @@ 0 0 - - 00:00:00 - @@ -143,9 +125,6 @@ 0 0 - - 00:00:00 - diff --git a/airtime_mvc/tests/application/models/files/test_deleteShowInstanceAndAllFollowing.xml b/airtime_mvc/tests/application/models/files/test_deleteShowInstanceAndAllFollowing.xml index 8b4933304..cdf4f2e37 100644 --- a/airtime_mvc/tests/application/models/files/test_deleteShowInstanceAndAllFollowing.xml +++ b/airtime_mvc/tests/application/models/files/test_deleteShowInstanceAndAllFollowing.xml @@ -92,9 +92,6 @@ record rebroadcast instance_id - file_id - time_filled - last_scheduled modified_instance 1 @@ -104,9 +101,6 @@ 0 0 - - 00:00:00 - 1 @@ -117,9 +111,6 @@ 0 0 - - 00:00:00 - @@ -130,9 +121,6 @@ 0 0 - - 00:00:00 - @@ -143,9 +131,6 @@ 0 0 - - 00:00:00 - 1 @@ -156,9 +141,6 @@ 0 0 - - 00:00:00 - 1 @@ -169,9 +151,6 @@ 0 0 - - 00:00:00 - 1 @@ -182,9 +161,6 @@ 0 0 - - 00:00:00 - @@ -195,9 +171,6 @@ 0 0 - - 00:00:00 - 1 @@ -208,9 +181,6 @@ 0 0 - - 00:00:00 - @@ -221,9 +191,6 @@ 0 0 - - 00:00:00 - 1 @@ -234,9 +201,6 @@ 0 0 - - 00:00:00 - 1 @@ -247,9 +211,6 @@ 0 0 - - 00:00:00 - @@ -260,9 +221,6 @@ 0 0 - - 00:00:00 - @@ -273,9 +231,6 @@ 0 0 - - 00:00:00 - @@ -286,9 +241,6 @@ 0 0 - - 00:00:00 - 1 @@ -299,9 +251,6 @@ 0 0 - - 00:00:00 - 1 diff --git a/airtime_mvc/tests/application/models/files/test_editRepeatingShowInstance.xml b/airtime_mvc/tests/application/models/files/test_editRepeatingShowInstance.xml new file mode 100644 index 000000000..860e77eaa --- /dev/null +++ b/airtime_mvc/tests/application/models/files/test_editRepeatingShowInstance.xml @@ -0,0 +1,160 @@ + + + + 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-12 + 1 + 0 + + + 2 + 2016-01-08 + 2016-01-09 + 01:00:00 + UTC + 01:00 + 5 + -1 + 2016-01-08 + 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 + + 1 + + + 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 + + + + + 7 + 2016-01-08 01:00:00 + 2016-01-08 02:00:00 + 1 + 0 + 0 + + + +
+ + +
+ + +
+
\ No newline at end of file diff --git a/airtime_mvc/tests/application/models/files/test_noRepeatNoRRShowCreated.xml b/airtime_mvc/tests/application/models/files/test_noRepeatNoRRShowCreated.xml index e68e42c2d..dc49416a0 100644 --- a/airtime_mvc/tests/application/models/files/test_noRepeatNoRRShowCreated.xml +++ b/airtime_mvc/tests/application/models/files/test_noRepeatNoRRShowCreated.xml @@ -66,9 +66,6 @@ record rebroadcast instance_id - file_id - time_filled - last_scheduled modified_instance 1 @@ -78,9 +75,6 @@ 0 0 - - 00:00:00 - diff --git a/airtime_mvc/tests/application/models/files/test_weeklyRepeatNoEndNoRRShowCreated.xml b/airtime_mvc/tests/application/models/files/test_weeklyRepeatNoEndNoRRShowCreated.xml index 8ed91fe2a..937f0a111 100644 --- a/airtime_mvc/tests/application/models/files/test_weeklyRepeatNoEndNoRRShowCreated.xml +++ b/airtime_mvc/tests/application/models/files/test_weeklyRepeatNoEndNoRRShowCreated.xml @@ -66,9 +66,6 @@ record rebroadcast instance_id - file_id - time_filled - last_scheduled modified_instance 1 @@ -78,9 +75,6 @@ 0 0 - - 00:00:00 - @@ -91,9 +85,6 @@ 0 0 - - 00:00:00 - @@ -104,9 +95,6 @@ 0 0 - - 00:00:00 - @@ -117,9 +105,6 @@ 0 0 - - 00:00:00 - @@ -130,9 +115,6 @@ 0 0 - - 00:00:00 - @@ -143,9 +125,6 @@ 0 0 - - 00:00:00 - diff --git a/airtime_mvc/tests/application/testdata/ShowData.php b/airtime_mvc/tests/application/testdata/ShowData.php index 6cba64241..ac51b8265 100644 --- a/airtime_mvc/tests/application/testdata/ShowData.php +++ b/airtime_mvc/tests/application/testdata/ShowData.php @@ -155,4 +155,30 @@ Class ShowData { return array(1,2,3,4,5); } + + public static function getEditRepeatInstanceData() + { + return array( + "add_show_id" => 1, + "add_show_instance_id" => 2, + "add_show_name" => "test show", + "add_show_url" => null, + "add_show_genre" => null, + "add_show_description" => null, + "add_show_start_date" => "2016-01-08", + "add_show_start_time" => "01:00", + "add_show_end_date_no_repeat" => "2016-01-08", + "add_show_end_time" => "02:00", + "add_show_duration" => "01h 00m", + "add_show_timezone" => "UTC", + "add_show_repeats" => 0, + "add_show_linked" => 0, + "add_show_no_end" => 0, + "cb_airtime_auth" => 0, + "cb_custom_auth" => 0, + "add_show_record" => 0, + "add_show_rebroadcast" => 0, + "add_show_hosts" => null + ); + } } \ No newline at end of file