CC-5651: Unit Test the Scheduler

Added database test
This commit is contained in:
drigato 2014-01-21 16:43:45 -05:00
parent b2cff12569
commit c14640c81e
3 changed files with 166 additions and 4 deletions

View file

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

View file

@ -29,9 +29,9 @@
<value></value>
<value>1</value>
</row>
</table>
</table>
<table name="cc_show_days">
<table name="cc_show_days">
<column>id</column>
<column>first_show</column>
<column>last_show</column>

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></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>1</value>
<value>2016-03-25</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-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>3</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>4</value>
<value>2016-02-12 00:00:00</value>
<value>2016-02-12 01:00:00</value>
<value>1</value>
<value>0</value>
<value>0</value>
<null />
<value></value>
</row>
<row>
<value>5</value>
<value>2016-02-26 00:00:00</value>
<value>2016-02-26 01:00:00</value>
<value>1</value>
<value>0</value>
<value>0</value>
<null />
<value></value>
</row>
<row>
<value>6</value>
<value>2016-03-11 00:00:00</value>
<value>2016-03-11 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>