CC-5716: Write database test to check the show content after editing a repeating show and removing a repeat day

This commit is contained in:
drigato 2014-02-27 07:35:08 -05:00
parent 753003639f
commit 1acdf2ca80
2 changed files with 193 additions and 0 deletions

View File

@ -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);
}
}

View File

@ -0,0 +1,137 @@
<?xml version="1.0" ?>
<dataset>
<table name="cc_show">
<column>id</column>
<column>name</column>
<column>url</column>
<column>genre</column>
<column>description</column>
<column>color</column>
<column>background_color</column>
<column>live_stream_using_airtime_auth</column>
<column>live_stream_using_custom_auth</column>
<column>live_stream_user</column>
<column>live_stream_pass</column>
<column>linked</column>
<column>is_linkable</column>
<row>
<value>1</value>
<value>test show</value>
<null />
<null />
<null />
<value>ffffff</value>
<value>364492</value>
<value></value>
<value></value>
<null />
<null />
<value>1</value>
<value>1</value>
</row>
</table>
<table name="cc_show_days">
<column>id</column>
<column>first_show</column>
<column>last_show</column>
<column>start_time</column>
<column>timezone</column>
<column>duration</column>
<column>day</column>
<column>repeat_type</column>
<column>next_pop_date</column>
<column>show_id</column>
<column>record</column>
<row>
<value>1</value>
<value>2016-01-01</value>
<null />
<value>00:00:00</value>
<value>UTC</value>
<value>01:00</value>
<value>5</value>
<value>0</value>
<value>2016-02-12</value>
<value>1</value>
<value>0</value>
</row>
</table>
<table name="cc_show_instances">
<column>id</column>
<column>starts</column>
<column>ends</column>
<column>show_id</column>
<column>record</column>
<column>rebroadcast</column>
<column>instance_id</column>
<column>modified_instance</column>
<row>
<value>1</value>
<value>2016-01-01 00:00:00</value>
<value>2016-01-01 01:00:00</value>
<value>1</value>
<value>0</value>
<value>0</value>
<null />
<value></value>
</row>
<row>
<value>2</value>
<value>2016-01-08 00:00:00</value>
<value>2016-01-08 01:00:00</value>
<value>1</value>
<value>0</value>
<value>0</value>
<null />
<value></value>
</row>
<row>
<value>3</value>
<value>2016-01-15 00:00:00</value>
<value>2016-01-15 01:00:00</value>
<value>1</value>
<value>0</value>
<value>0</value>
<null />
<value></value>
</row>
<row>
<value>4</value>
<value>2016-01-22 00:00:00</value>
<value>2016-01-22 01:00:00</value>
<value>1</value>
<value>0</value>
<value>0</value>
<null />
<value></value>
</row>
<row>
<value>5</value>
<value>2016-01-29 00:00:00</value>
<value>2016-01-29 01:00:00</value>
<value>1</value>
<value>0</value>
<value>0</value>
<null />
<value></value>
</row>
<row>
<value>6</value>
<value>2016-02-05 00:00:00</value>
<value>2016-02-05 01:00:00</value>
<value>1</value>
<value>0</value>
<value>0</value>
<null />
<value></value>
</row>
</table>
<table name="cc_show_rebroadcast">
</table>
<table name="cc_show_hosts">
</table>
</dataset>