Restoring some tests in airtime_mvc

This commit is contained in:
Zachary Klosko 2020-11-19 14:45:08 -05:00
parent 128c6b37fa
commit 8a7bd6b952
42 changed files with 4757 additions and 0 deletions

View File

@ -0,0 +1,83 @@
<?php
error_reporting(E_ALL | E_STRICT);
// load composer autoloader
require_once __DIR__.'/../../../vendor/autoload.php';
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../application/'));
// Define path to configs directory
define('CONFIG_PATH', APPLICATION_PATH . '/configs/');
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'testing'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath('./library'),
get_include_path(),
)));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
get_include_path(),
realpath(APPLICATION_PATH . '/../library')
)));
// Ensure vendor/ is on the include path
set_include_path(implode(PATH_SEPARATOR, array(
get_include_path(),
realpath(APPLICATION_PATH . '/../../vendor'),
realpath(APPLICATION_PATH . '/../../vendor/zf1s/zend-loader/library')
)));
set_include_path(implode(PATH_SEPARATOR, array(
get_include_path(),
realpath(APPLICATION_PATH . '/../../vendor/propel/propel1/runtime/lib')
)));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
get_include_path(),
realpath(APPLICATION_PATH . '/../../install_minimal/include')
)));
require_once CONFIG_PATH . '/constants.php';
Logging::setLogPath(LIBRETIME_LOG_DIR . '/zendphp.log');
set_include_path(APPLICATION_PATH . '/common' . PATH_SEPARATOR . get_include_path());
//Propel classes.
set_include_path(APPLICATION_PATH . '/models' . PATH_SEPARATOR . get_include_path());
//Services
set_include_path(APPLICATION_PATH . '/services' . PATH_SEPARATOR . get_include_path());
//models
set_include_path(APPLICATION_PATH . '/models' . PATH_SEPARATOR . get_include_path());
//Controllers.
set_include_path(APPLICATION_PATH . '/controllers' . PATH_SEPARATOR . get_include_path());
//Controller plugins.
set_include_path(APPLICATION_PATH . '/controllers/plugins' . PATH_SEPARATOR . get_include_path());
//test data
set_include_path(APPLICATION_PATH . '/../tests/application/testdata' . PATH_SEPARATOR . get_include_path());
//helper functions
set_include_path(APPLICATION_PATH . '/../tests/application/helpers' . PATH_SEPARATOR . get_include_path());
//cloud storage files
set_include_path(APPLICATION_PATH . '/cloud_storage' . PATH_SEPARATOR . get_include_path());
require_once APPLICATION_PATH.'/configs/conf.php';
require_once 'propel/propel1/runtime/lib/Propel.php';
Propel::init("../application/configs/airtime-conf-production.php");
Zend_Session::start();

View File

@ -0,0 +1,356 @@
<?php
set_include_path(__DIR__.'/../../airtime_mvc/library' . PATH_SEPARATOR . get_include_path());
#require_once('Zend/Loader/Autoloader.php');
class AirtimeInstall
{
const CONF_DIR_BINARIES = "/usr/lib/airtime";
const CONF_DIR_WWW = "/usr/share/airtime";
const CONF_DIR_LOG = LIBRETIME_LOG_DIR;
public static $databaseTablesCreated = false;
public static function GetAirtimeSrcDir()
{
return __DIR__."/../../..";
}
public static function GetUtilsSrcDir()
{
return __DIR__."/../../../../utils";
}
/**
* Ensures that the user is running this PHP script with root
* permissions. If not running with root permissions, causes the
* script to exit.
*/
public static function ExitIfNotRoot()
{
// Need to check that we are superuser before running this.
if(posix_geteuid() != 0){
echo "Must be root user.\n";
exit(1);
}
}
/**
* Return the version of Airtime currently installed.
* If not installed, return null.
*
* @return NULL|string
*/
public static function GetVersionInstalled()
{
try {
$con = Propel::getConnection();
} catch (PropelException $e) {
return null;
}
if (file_exists('/etc/airtime/airtime.conf')) {
$values = parse_ini_file('/etc/airtime/airtime.conf', true);
}
else {
return null;
}
$sql = "SELECT valstr FROM cc_pref WHERE keystr = 'system_version' LIMIT 1";
try {
$version = $con->query($sql)->fetchColumn(0);
} catch (PDOException $e){
// no pref table therefore Airtime is not installed.
//We only get here if airtime database exists, but the table doesn't
//This state sometimes happens if a previous Airtime uninstall couldn't remove
//the database because it was busy, so it just removed the tables instead.
return null;
}
//if version is empty string, then version is older than version 1.8.0
if ($version == '') {
try {
// If this table exists, then it's version 1.7.0
$sql = "SELECT * FROM cc_show_rebroadcast LIMIT 1";
$result = $con->query($sql)->fetchColumn(0);
$version = "1.7.0";
} catch (Exception $e) {
$version = null;
}
}
return $version;
}
public static function DbTableExists($p_name)
{
$con = Propel::getConnection();
try {
$sql = "SELECT * FROM ".$p_name." LIMIT 1";
$con->query($sql);
} catch (PDOException $e){
return false;
}
return true;
}
public static function InstallQuery($sql, $verbose = true)
{
$con = Propel::getConnection();
try {
$con->exec($sql);
if ($verbose) {
echo "done.\n";
}
} catch (Exception $e) {
echo "Error!\n".$e->getMessage()."\n";
echo " SQL statement was:\n";
echo " ".$sql."\n\n";
}
}
public static function DropSequence($p_sequenceName)
{
AirtimeInstall::InstallQuery("DROP SEQUENCE IF EXISTS $p_sequenceName", false);
}
/**
* Try to connect to the database. Return true on success, false on failure.
* @param boolean $p_exitOnError
* Exit the program on failure.
* @return boolean
*/
public static function DbConnect($p_exitOnError = true)
{
$CC_CONFIG = Config::getConfig();
try {
$con = Propel::getConnection();
} catch (Exception $e) {
echo $e->getMessage().PHP_EOL;
echo "Database connection problem.".PHP_EOL;
echo "Check if database '{$CC_CONFIG['dsn']['database']}' exists".
" with corresponding permissions.".PHP_EOL;
if ($p_exitOnError) {
exit(1);
}
return false;
}
return true;
}
/* TODO: This function should be moved to the media-monitor
* install script. */
public static function InstallStorageDirectory()
{
$CC_CONFIG = Config::getConfig();
echo "* Storage directory setup".PHP_EOL;
$ini = parse_ini_file(__DIR__."/airtime-install.ini");
$stor_dir = $ini["storage_dir"];
$dirs = array($stor_dir, $stor_dir."/organize");
foreach ($dirs as $dir){
if (!file_exists($dir)) {
if (mkdir($dir, 02775, true)){
$rp = realpath($dir);
echo "* Directory $rp created".PHP_EOL;
} else {
echo "* Failed creating {$dir}".PHP_EOL;
exit(1);
}
}
else if (is_writable($dir)) {
$rp = realpath($dir);
echo "* Skipping directory already exists: $rp".PHP_EOL;
}
else {
$rp = realpath($dir);
echo "* Error: Directory already exists, but is not writable: $rp".PHP_EOL;
exit(1);
}
echo "* Giving Apache permission to access $rp".PHP_EOL;
$success = chown($rp, $CC_CONFIG["webServerUser"]);
$success = chgrp($rp, $CC_CONFIG["webServerUser"]);
$success = chmod($rp, 0775);
}
}
public static function CreateDatabaseUser()
{
$CC_CONFIG = Config::getConfig();
echo " * Creating Airtime database user".PHP_EOL;
$username = $CC_CONFIG['dsn']['username'];
$password = $CC_CONFIG['dsn']['password'];
$command = "echo \"CREATE USER $username ENCRYPTED PASSWORD '$password' LOGIN CREATEDB NOCREATEUSER;\" | su postgres -c psql 2>/dev/null";
@exec($command, $output, $results);
if ($results == 0) {
echo " * Database user '{$CC_CONFIG['dsn']['username']}' created.".PHP_EOL;
} else {
if (count($output) > 0) {
echo " * Could not create user '{$CC_CONFIG['dsn']['username']}': ".PHP_EOL;
echo implode(PHP_EOL, $output);
}
else {
echo " * Database user '{$CC_CONFIG['dsn']['username']}' already exists.".PHP_EOL;
}
}
}
public static function CreateDatabase()
{
$CC_CONFIG = Config::getConfig();
$database = $CC_CONFIG['dsn']['database'];
$username = $CC_CONFIG['dsn']['username'];
$password = $CC_CONFIG['dsn']['password'];
$hostspec = $CC_CONFIG['dsn']['hostspec'];
echo " * Creating Airtime database: " . $database . PHP_EOL;
$dbExists = false;
try {
$con = pg_connect('user='.$username.' password='.$password.' host='.$hostspec);
pg_query($con, 'CREATE DATABASE '.$database.' WITH ENCODING \'UTF8\' TEMPLATE template0 OWNER '.$username.';');
} catch (Exception $e) {
// rethrow if not a "database already exists" error
if ($e->getCode() != 2 && strpos($e->getMessage(), 'already exists') !== false) throw $e;
echo " * Database already exists." . PHP_EOL;
$dbExists = true;
}
if (!$dbExists) {
echo " * Database $database created.".PHP_EOL;
}
return $dbExists;
}
public static function InstallPostgresScriptingLanguage()
{
$con = Propel::getConnection();
// Install postgres scripting language
$sql = 'SELECT COUNT(*) FROM pg_language WHERE lanname = \'plpgsql\'';
$langIsInstalled = $con->query($sql)->fetchColumn(0);
if ($langIsInstalled == '0') {
echo " * Installing Postgres scripting language".PHP_EOL;
$sql = "CREATE LANGUAGE 'plpgsql'";
AirtimeInstall::InstallQuery($sql, false);
} else {
echo " * Postgres scripting language already installed".PHP_EOL;
}
}
public static function CreateDatabaseTables($p_dbuser, $p_dbpasswd, $p_dbname, $p_dbhost)
{
echo " * Creating database tables".PHP_EOL;
// Put Propel sql files in Database
//$command = AirtimeInstall::CONF_DIR_WWW."/library/propel/generator/bin/propel-gen ".AirtimeInstall::CONF_DIR_WWW."/build/ insert-sql 2>/dev/null";
$dir = self::GetAirtimeSrcDir()."/build/sql/";
$files = array("schema.sql", "sequences.sql", "views.sql", "triggers.sql", "defaultdata.sql");
foreach ($files as $f){
$command = "export PGPASSWORD=$p_dbpasswd && psql --username $p_dbuser --dbname $p_dbname --host $p_dbhost --file $dir$f 2>&1";
@exec($command, $output, $results);
}
AirtimeInstall::$databaseTablesCreated = true;
}
public final static function UpdateDatabaseTables() {
UpgradeManager::doUpgrade();
}
public static function SetAirtimeVersion($p_version)
{
$con = Propel::getConnection();
$sql = "DELETE FROM cc_pref WHERE keystr = 'system_version'";
$con->exec($sql);
Application_Model_Preference::SetAirtimeVersion($p_version);
}
public static function SetUniqueId()
{
$uniqueId = md5(uniqid("", true));
Application_Model_Preference::SetUniqueId($uniqueId);
}
public static function GetAirtimeVersion()
{
$config = Config::getConfig();
return $config['airtime_version'];
}
public static function DeleteFilesRecursive($p_path)
{
$command = "rm -rf \"$p_path\"";
exec($command);
}
public static function InstallPhpCode()
{
$CC_CONFIG = Config::getConfig();
echo "* Installing PHP code to ".AirtimeInstall::CONF_DIR_WWW.PHP_EOL;
exec("mkdir -p ".AirtimeInstall::CONF_DIR_WWW);
exec("cp -R ".AirtimeInstall::GetAirtimeSrcDir()."/* ".AirtimeInstall::CONF_DIR_WWW);
}
public static function UninstallPhpCode()
{
echo "* Removing PHP code from ".AirtimeInstall::CONF_DIR_WWW.PHP_EOL;
exec('rm -rf "'.AirtimeInstall::CONF_DIR_WWW.'"');
}
public static function DirCheck()
{
echo "Legend: \"+\" means the dir/file exists, \"-\" means that it does not.".PHP_EOL;
$dirs = array(AirtimeInstall::CONF_DIR_BINARIES,
AirtimeInstall::CONF_DIR_WWW,
AirtimeIni::CONF_FILE_AIRTIME,
AirtimeIni::CONF_FILE_LIQUIDSOAP,
AirtimeIni::CONF_FILE_PYPO,
AirtimeIni::CONF_FILE_RECORDER,
"/usr/lib/airtime/pypo",
"/var/log/airtime",
"/var/log/airtime/pypo",
"/var/tmp/airtime/pypo");
foreach ($dirs as $f) {
if (file_exists($f)) {
echo "+ $f".PHP_EOL;
} else {
echo "- $f".PHP_EOL;
}
}
}
public static function CreateZendPhpLogFile(){
$CC_CONFIG = Config::getConfig();
$path = AirtimeInstall::CONF_DIR_LOG;
$file = $path.'/zendphp.log';
if (!file_exists($path)){
mkdir($path, 0755, true);
}
touch($file);
chmod($file, 0644);
chown($file, $CC_CONFIG['webServerUser']);
chgrp($file, $CC_CONFIG['webServerUser']);
}
public static function RemoveLogDirectories(){
$path = AirtimeInstall::CONF_DIR_LOG;
echo "* Removing logs directory ".$path.PHP_EOL;
exec("rm -rf \"$path\"");
}
public static function removeVirtualEnvDistributeFile(){
echo "* Removing distribute-0.6.10.tar.gz".PHP_EOL;
if(file_exists('/usr/share/python-virtualenv/distribute-0.6.10.tar.gz')){
exec("rm -f /usr/share/python-virtualenv/distribute-0.6.10.tar.gz");
}
}
public static function printUsage($opts)
{
$msg = $opts->getUsageMessage();
echo PHP_EOL."Usage: airtime-install [options]";
echo substr($msg, strpos($msg, "\n")).PHP_EOL;
}
public static function getOpts()
{
try {
$autoloader = Zend_Loader_Autoloader::getInstance();
$opts = new Zend_Console_Getopt(
array(
'help|h' => 'Displays usage information.',
'overwrite|o' => 'Overwrite any existing config files.',
'preserve|p' => 'Keep any existing config files.',
'no-db|n' => 'Turn off database install.',
'reinstall|r' => 'Force a fresh install of this Airtime Version',
'webonly|w' => 'Install only web files'
)
);
$opts->parse();
} catch (Zend_Console_Getopt_Exception $e) {
print $e->getMessage() .PHP_EOL;
AirtimeInstall::printUsage($opts);
return NULL;
}
return $opts;
}
public static function checkPHPVersion()
{
if (PHP_VERSION_ID < 50300)
{
echo "Error: Airtime requires PHP 5.3 or greater.";
return false;
}
return true;
}
}

View File

@ -0,0 +1,136 @@
<?php
class TestHelper
{
public static function loginUser()
{
$authAdapter = Application_Model_Auth::getAuthAdapter();
//pass to the adapter the submitted username and password
$authAdapter->setIdentity('admin')
->setCredential('admin');
$auth = Zend_Auth::getInstance();
$result = $auth->authenticate($authAdapter);
if ($result->isValid()) {
//all info about this user from the login table omit only the password
$userInfo = $authAdapter->getResultRowObject(null, 'password');
//the default storage is a session with namespace Zend_Auth
$authStorage = $auth->getStorage();
$authStorage->write($userInfo);
}
}
public static function getDbZendConfig()
{
$config = Config::getConfig();
return new Zend_Config(
array(
'host' => $config['dsn']['hostspec'],
'dbname' => $config['dsn']['database'],
'username' => $config['dsn']['username'],
'password' => $config['dsn']['password']
)
);
}
public static function installTestDatabase()
{
//We need to load the config before our app bootstrap runs. The config
//is normally
$CC_CONFIG = Config::getConfig();
$dbuser = $CC_CONFIG['dsn']['username'];
$dbpasswd = $CC_CONFIG['dsn']['password'];
$dbname = $CC_CONFIG['dsn']['database'];
$dbhost = $CC_CONFIG['dsn']['hostspec'];
$databaseAlreadyExists = AirtimeInstall::createDatabase();
if ($databaseAlreadyExists)
{
//Truncate all the tables
$con = Propel::getConnection();
$sql = "select * from pg_tables where tableowner = '${dbuser}'";
try {
$rows = $con->query($sql)->fetchAll();
} catch (Exception $e) {
$rows = array();
}
//Add any tables that shouldn't be cleared here.
// cc_subjs - Most of Airtime requires an admin account to work, which has id=1,
// so don't clear it.
// cc_music_dirs - Has foreign key constraints against cc_files, so we clear cc_files
// first and clear cc_music_dirs after
$tablesToNotClear = array("cc_subjs", "cc_music_dirs");
$con->beginTransaction();
foreach ($rows as $row) {
$tablename = $row["tablename"];
if (in_array($tablename, $tablesToNotClear))
{
continue;
}
//echo " * Clearing database table $tablename...";
//TRUNCATE is actually slower than DELETE in many cases:
//http://stackoverflow.com/questions/11419536/postgresql-truncation-speed
//$sql = "TRUNCATE TABLE $tablename CASCADE";
$sql = "DELETE FROM $tablename";
AirtimeInstall::InstallQuery($sql, false);
}
//Now that cc_files is empty, clearing cc_music_dirs should work
$sql = "DELETE FROM cc_music_dirs";
AirtimeInstall::InstallQuery($sql, false);
// Because files are stored relative to their watch directory,
// we need to set the "stor" path before we can successfully
// create a fake file in the database.
//Copy paste from airtime-db-install.php:
$stor_dir = "/tmp";
$con = Propel::getConnection();
$sql = "INSERT INTO cc_music_dirs (directory, type) VALUES ('$stor_dir', 'stor')";
try {
$con->exec($sql);
} catch (Exception $e) {
echo " * Failed inserting {$stor_dir} in cc_music_dirs".PHP_EOL;
echo " * Message {$e->getMessage()}".PHP_EOL;
return false;
}
$con->commit();
//Because we're DELETEing all the rows instead of using TRUNCATE (for speed),
//we have to reset the sequences so the auto-increment columns (like primary keys)
//all start at 1 again. This is hacky but it still lets all of this execute fast.
$sql = "SELECT c.relname FROM pg_class c WHERE c.relkind = 'S'";
try {
$rows = $con->query($sql)->fetchAll();
} catch (Exception $e) {
$rows = array();
}
$con->beginTransaction();
foreach ($rows as $row) {
$seqrelname= $row["relname"];
$sql = "ALTER SEQUENCE ${seqrelname} RESTART WITH 1";
AirtimeInstall::InstallQuery($sql, false);
}
$con->commit();
}
else
{
//Create all the database tables
AirtimeInstall::CreateDatabaseTables($dbuser, $dbpasswd, $dbname, $dbhost);
AirtimeInstall::UpdateDatabaseTables();
}
}
public static function setupZendBootstrap()
{
$application = new Zend_Application(APPLICATION_ENV, CONFIG_PATH . 'application.ini');
$application->bootstrap();
return $application;
}
}

View File

@ -0,0 +1,95 @@
<?php
//require_once "../application/configs/conf.php";
class BlockDbTest extends Zend_Test_PHPUnit_DatabaseTestCase //PHPUnit_Framework_TestCase
{
private $_connectionMock;
public function setUp()
{
TestHelper::installTestDatabase();
TestHelper::setupZendBootstrap();
parent::setUp();
}
public function getConnection()
{
if ($this->_connectionMock == null) {
$config = TestHelper::getDbZendConfig();
$connection = Zend_Db::factory('pdo_pgsql', $config);
$this->_connectionMock = $this->createZendDbConnection(
$connection,
'airtimeunittests'
);
Zend_Db_Table_Abstract::setDefaultAdapter($connection);
}
return $this->_connectionMock;
}
/**
* Load a dataset into the database for the block database tests
*
* Defines how the initial state of the database should look before each test is executed
* Called once during setUp() and gets recreated for each new test
*/
public function getDataSet()
{
$dataset = new PHPUnit_Extensions_Database_DataSet_YamlDataSet(__DIR__ . '/datasets/seed_files.yml' );
return $dataset;
}
/**
* Test if the single newest file is added to the Database
*
*/
public function testGetListofFilesMeetCriteriaSingleMatch() {
TestHelper::loginUser();
$CC_CONFIG = Config::getConfig();
$testqry = CcFilesQuery::create();
$testout = $testqry->find();
$vd = $testout->getData();
$ds = new Zend_Test_PHPUnit_Db_DataSet_QueryDataSet(
$this->getConnection()
);
$testCriteria = BlockModelData::getCriteriaSingleNewestLabelNada();
$bltest = new Application_Model_Block();
$bltest->saveSmartBlockCriteria($testCriteria);
$tracks = $bltest->getListOfFilesUnderLimit();
//$tracks = $bltest->getLength();
$this->assertNotEmpty($tracks);
// need to load a example criteria into the database
}
/**
* Test if the single newest file is added to the Database
*
*/
public function testMultiTrackandAlbumsGetLoaded() {
TestHelper::loginUser();
$CC_CONFIG = Config::getConfig();
$testqry = CcFilesQuery::create();
$testout = $testqry->find();
$vd = $testout->getData();
$ds = new Zend_Test_PHPUnit_Db_DataSet_QueryDataSet(
$this->getConnection()
);
$testCriteria = BlockModelData::getCriteriaMultiTrackAndAlbum1Hour();
$bltest = new Application_Model_Block();
$bltest->saveSmartBlockCriteria($testCriteria);
$tracks = $bltest->getListOfFilesUnderLimit();
//$tracks = $bltest->getLength();
$this->assertNotEmpty($tracks);
// add assertion that the length is less than 1 hour...
// need to load a example criteria into the database
}
}

View File

@ -0,0 +1,138 @@
<?php
require_once "../application/configs/conf.php";
class ScheduleDbTest extends Zend_Test_PHPUnit_DatabaseTestCase
{
private $_connectionMock;
public function setUp()
{
TestHelper::installTestDatabase();
$this->appBootstrap();
parent::setUp();
}
public function appBootstrap()
{
$this->application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH .'/configs/application.ini');
$this->application->bootstrap();
}
public function getConnection()
{
if ($this->_connectionMock == null) {
$config = TestHelper::getDbZendConfig();
$connection = Zend_Db::factory('pdo_pgsql', $config);
$this->_connectionMock = $this->createZendDbConnection(
$connection,
'airtimeunittests'
);
Zend_Db_Table_Abstract::setDefaultAdapter($connection);
}
return $this->_connectionMock;
}
/* Defines how the initial state of the database should look before each test is executed
* Called once during setUp() and gets recreated for each new test
*/
public function getDataSet()
{
return new PHPUnit_Extensions_Database_DataSet_YamlDataSet(
__DIR__ . '/datasets/seed_schedule.yml'
);
}
public function testCheckOverlappingShows()
{
TestHelper::loginUser();
$data = ShowServiceData::getOverlappingShowCheckTestData();
$showService = new Application_Service_ShowService(null, $data);
/** Create shows to test against **/
$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 order by id');
$ds->addTable('cc_show_instances', 'select id, starts, ends, show_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');
/** Make sure shows were created correctly **/
$this->assertDataSetsEqual(
new PHPUnit_Extensions_Database_DataSet_YamlDataSet(__DIR__ . "/datasets/test_checkOverlappingShows.yml"),
$ds
);
$utcTimezone = new DateTimeZone("UTC");
/** Test that overlapping check works when creating a new show **/
$overlapping = Application_Model_Schedule::checkOverlappingShows(
new DateTime("2014-02-01 00:00:00", $utcTimezone),
new DateTime("2014-02-01 01:00:00", $utcTimezone)
);
$this->assertEquals($overlapping, false);
$overlapping = Application_Model_Schedule::checkOverlappingShows(
new DateTime("2014-01-05 00:00:00", $utcTimezone),
new DateTime("2014-01-05 02:00:00", $utcTimezone)
);
$this->assertEquals($overlapping, true);
$overlapping = Application_Model_Schedule::checkOverlappingShows(
new DateTime("2014-01-05 01:00:00", $utcTimezone),
new DateTime("2014-01-05 02:00:00", $utcTimezone)
);
$this->assertEquals($overlapping, false);
$overlapping = Application_Model_Schedule::checkOverlappingShows(
new DateTime("2014-01-31 00:30:00", $utcTimezone),
new DateTime("2014-01-31 01:30:00", $utcTimezone)
);
$this->assertEquals($overlapping, true);
$overlapping = Application_Model_Schedule::checkOverlappingShows(
new DateTime("2014-01-20 23:55:00", $utcTimezone),
new DateTime("2014-01-21 00:00:05", $utcTimezone)
);
$this->assertEquals($overlapping, true);
/** Test overlapping check works when editing an entire show **/
$overlapping = Application_Model_Schedule::checkOverlappingShows(
new DateTime("2014-01-05 00:00:00", $utcTimezone),
new DateTime("2014-01-05 02:00:00", $utcTimezone),
true,
null,
1
);
$this->assertEquals($overlapping, false);
/** Delete a repeating instance, create a new show in it's place and
* test if we can modify the repeating show after **/
$ccShowInstance = CcShowInstancesQuery::create()->findPk(1);
$ccShowInstance->setDbModifiedInstance(true)->save();
$newShowData = ShowServiceData::getNoRepeatNoRRData();
$newShowData["add_show_start_date"] = "2014-01-05";
$newShowData["add_show_end_date_no_repeat"] = "2014-01-05";
$newShowData["add_show_end_date"] = "2014-01-05";
$showService->addUpdateShow($newShowData);
$overlapping = Application_Model_Schedule::checkOverlappingShows(
new DateTime("2014-01-06 00:00:00", $utcTimezone),
new DateTime("2014-01-06 00:30:00", $utcTimezone),
true,
null,
1
);
$this->assertEquals($overlapping, false);
}
}

View File

@ -0,0 +1,177 @@
cc_music_dirs:
-
id: '1'
directory: '/tmp/libretime-test'
type: 'stor'
exists: 't'
watched: 't'
cc_files:
-
id: '1'
mime: 'audio/mp3'
ftype: 'audioclip'
directory: '1'
filepath: 'imported/1/oneminute.mp3'
mtime: '2017-08-06 04:27:36'
utime: '2017-08-06 04:26:47'
track_title: 'oneminute.mp3'
bit_rate: '320000'
sample_rate: '44100'
length: '00:01:00'
channels: '2'
genre: 'test'
label: 'nada'
owner_id: '1'
file_exists: 't'
hidden: 'f'
silan_check: 'f'
is_scheduled: 'f'
is_playlist: 'f'
filesize: '2586748'
-
id: '2'
mime: 'audio/mp3'
ftype: 'audioclip'
directory: '1'
filepath: 'imported/1/fiveminute.mp3'
mtime: '2017-08-06 04:28:36'
utime: '2017-08-06 04:27:47'
track_title: 'fiveminute.mp3'
bit_rate: '320000'
sample_rate: '44100'
length: '00:05:00'
channels: '2'
genre: 'test'
label: 'nada'
owner_id: '1'
file_exists: 't'
hidden: 'f'
silan_check: 'f'
is_scheduled: 'f'
is_playlist: 'f'
filesize: '5126748'
-
id: '3'
mime: 'audio/mp3'
ftype: 'audioclip'
directory: '1'
filepath: 'imported/1/track1.mp3'
mtime: '2017-08-06 04:28:36'
utime: '2017-08-06 04:27:47'
track_title: 'track1'
album_title: 'album1'
bit_rate: '320000'
sample_rate: '44100'
length: '00:01:30'
channels: '2'
genre: 'test'
label: 'nada'
owner_id: '1'
file_exists: 't'
hidden: 'f'
silan_check: 'f'
is_scheduled: 'f'
is_playlist: 'f'
filesize: '5126748'
id: '4'
mime: 'audio/mp3'
ftype: 'audioclip'
directory: '1'
filepath: 'imported/1/track2.mp3'
mtime: '2017-08-06 04:28:36'
utime: '2017-08-06 04:27:47'
track_title: 'track2'
album_title: 'album1'
bit_rate: '320000'
sample_rate: '44100'
length: '00:01:30'
channels: '2'
genre: 'test'
label: 'nada'
owner_id: '1'
file_exists: 't'
hidden: 'f'
silan_check: 'f'
is_scheduled: 'f'
is_playlist: 'f'
filesize: '5126748'
id: '5'
mime: 'audio/mp3'
ftype: 'audioclip'
directory: '1'
filepath: 'imported/1/track3.mp3'
mtime: '2017-08-06 04:28:36'
utime: '2017-08-06 04:27:47'
track_title: 'track3'
album_title: 'album1'
bit_rate: '320000'
sample_rate: '44100'
length: '00:01:30'
channels: '2'
genre: 'test'
label: 'nada'
owner_id: '1'
file_exists: 't'
hidden: 'f'
silan_check: 'f'
is_scheduled: 'f'
is_playlist: 'f'
filesize: '5126748'
id: '6'
mime: 'audio/mp3'
ftype: 'audioclip'
directory: '1'
filepath: 'imported/1/track1-2.mp3'
mtime: '2017-08-06 05:28:36'
utime: '2017-08-16 04:27:47'
track_title: 'track1'
album_title: 'album2'
bit_rate: '320000'
sample_rate: '44100'
length: '00:01:30'
channels: '2'
genre: 'test'
label: 'nada'
owner_id: '1'
file_exists: 't'
hidden: 'f'
silan_check: 'f'
is_scheduled: 'f'
is_playlist: 'f'
filesize: '5126748'
id: '7'
mime: 'audio/mp3'
ftype: 'audioclip'
directory: '1'
filepath: 'imported/1/track2-2.mp3'
mtime: '2017-08-06 04:28:36'
utime: '2017-08-06 04:27:47'
track_title: 'track2'
album_title: 'album2'
bit_rate: '320000'
sample_rate: '44100'
length: '00:01:30'
channels: '2'
genre: 'test'
label: 'nada'
owner_id: '1'
file_exists: 't'
hidden: 'f'
silan_check: 'f'
is_scheduled: 'f'
is_playlist: 'f'
filesize: '5126748'

View File

@ -0,0 +1,11 @@
cc_pref:
-
id: '1'
subjid: null
keystr: shows_populated_until
valstr: '2014-02-01 00:00:00'
-
id: '2'
subjid: null
keystr: timezone
valstr: UTC

View File

@ -0,0 +1,270 @@
cc_show:
-
id: '1'
name: 'test show'
url: null
genre: null
description: null
color: ffffff
background_color: '364492'
live_stream_using_airtime_auth: false
live_stream_using_custom_auth: false
live_stream_user: null
live_stream_pass: null
linked: false
is_linkable: true
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'
first_show: '2014-01-05'
last_show: null
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '0'
repeat_type: '0'
next_pop_date: '2014-02-02'
show_id: '1'
record: '0'
-
id: '2'
first_show: '2014-01-06'
last_show: null
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '1'
repeat_type: '0'
next_pop_date: '2014-02-03'
show_id: '1'
record: '0'
-
id: '3'
first_show: '2014-01-07'
last_show: null
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '2'
repeat_type: '0'
next_pop_date: '2014-02-04'
show_id: '1'
record: '0'
-
id: '4'
first_show: '2014-01-08'
last_show: null
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '3'
repeat_type: '0'
next_pop_date: '2014-02-05'
show_id: '1'
record: '0'
-
id: '5'
first_show: '2014-01-09'
last_show: null
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '4'
repeat_type: '0'
next_pop_date: '2014-02-06'
show_id: '1'
record: '0'
-
id: '6'
first_show: '2014-01-10'
last_show: null
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '5'
repeat_type: '0'
next_pop_date: '2014-02-07'
show_id: '1'
record: '0'
-
id: '7'
first_show: '2014-01-11'
last_show: null
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '6'
repeat_type: '0'
next_pop_date: '2014-02-01'
show_id: '1'
record: '0'
cc_show_instances:
-
id: '1'
starts: '2014-01-05 00:00:00'
ends: '2014-01-05 01:00:00'
show_id: '1'
modified_instance: false
-
id: '2'
starts: '2014-01-12 00:00:00'
ends: '2014-01-12 01:00:00'
show_id: '1'
modified_instance: false
-
id: '3'
starts: '2014-01-19 00:00:00'
ends: '2014-01-19 01:00:00'
show_id: '1'
modified_instance: false
-
id: '4'
starts: '2014-01-26 00:00:00'
ends: '2014-01-26 01:00:00'
show_id: '1'
modified_instance: false
-
id: '5'
starts: '2014-01-06 00:00:00'
ends: '2014-01-06 01:00:00'
show_id: '1'
modified_instance: false
-
id: '6'
starts: '2014-01-13 00:00:00'
ends: '2014-01-13 01:00:00'
show_id: '1'
modified_instance: false
-
id: '7'
starts: '2014-01-20 00:00:00'
ends: '2014-01-20 01:00:00'
show_id: '1'
modified_instance: false
-
id: '8'
starts: '2014-01-27 00:00:00'
ends: '2014-01-27 01:00:00'
show_id: '1'
modified_instance: false
-
id: '9'
starts: '2014-01-07 00:00:00'
ends: '2014-01-07 01:00:00'
show_id: '1'
modified_instance: false
-
id: '10'
starts: '2014-01-14 00:00:00'
ends: '2014-01-14 01:00:00'
show_id: '1'
modified_instance: false
-
id: '11'
starts: '2014-01-21 00:00:00'
ends: '2014-01-21 01:00:00'
show_id: '1'
modified_instance: false
-
id: '12'
starts: '2014-01-28 00:00:00'
ends: '2014-01-28 01:00:00'
show_id: '1'
modified_instance: false
-
id: '13'
starts: '2014-01-08 00:00:00'
ends: '2014-01-08 01:00:00'
show_id: '1'
modified_instance: false
-
id: '14'
starts: '2014-01-15 00:00:00'
ends: '2014-01-15 01:00:00'
show_id: '1'
modified_instance: false
-
id: '15'
starts: '2014-01-22 00:00:00'
ends: '2014-01-22 01:00:00'
show_id: '1'
modified_instance: false
-
id: '16'
starts: '2014-01-29 00:00:00'
ends: '2014-01-29 01:00:00'
show_id: '1'
modified_instance: false
-
id: '17'
starts: '2014-01-09 00:00:00'
ends: '2014-01-09 01:00:00'
show_id: '1'
modified_instance: false
-
id: '18'
starts: '2014-01-16 00:00:00'
ends: '2014-01-16 01:00:00'
show_id: '1'
modified_instance: false
-
id: '19'
starts: '2014-01-23 00:00:00'
ends: '2014-01-23 01:00:00'
show_id: '1'
modified_instance: false
-
id: '20'
starts: '2014-01-30 00:00:00'
ends: '2014-01-30 01:00:00'
show_id: '1'
modified_instance: false
-
id: '21'
starts: '2014-01-10 00:00:00'
ends: '2014-01-10 01:00:00'
show_id: '1'
modified_instance: false
-
id: '22'
starts: '2014-01-17 00:00:00'
ends: '2014-01-17 01:00:00'
show_id: '1'
modified_instance: false
-
id: '23'
starts: '2014-01-24 00:00:00'
ends: '2014-01-24 01:00:00'
show_id: '1'
modified_instance: false
-
id: '24'
starts: '2014-01-31 00:00:00'
ends: '2014-01-31 01:00:00'
show_id: '1'
modified_instance: false
-
id: '25'
starts: '2014-01-11 00:00:00'
ends: '2014-01-11 01:00:00'
show_id: '1'
modified_instance: false
-
id: '26'
starts: '2014-01-18 00:00:00'
ends: '2014-01-18 01:00:00'
show_id: '1'
modified_instance: false
-
id: '27'
starts: '2014-01-25 00:00:00'
ends: '2014-01-25 01:00:00'
show_id: '1'
modified_instance: false
cc_show_rebroadcast:
cc_show_hosts:

View File

@ -0,0 +1,21 @@
<?php
require_once "../application/configs/conf.php";
class PreferenceUnitTest extends PHPUnit_Framework_TestCase
{
public function setUp()
{
TestHelper::installTestDatabase();
TestHelper::setupZendBootstrap();
parent::setUp();
}
public function testSetShowsPopulatedUntil()
{
$date = new DateTime();
Application_Model_Preference::SetShowsPopulatedUntil($date);
$this->assertEquals(Application_Model_Preference::GetShowsPopulatedUntil(), $date);
}
}

View File

@ -0,0 +1,78 @@
<?php
//require_once "../application/configs/conf.php";
class ScheduleUnitTest extends Zend_Test_PHPUnit_ControllerTestCase //PHPUnit_Framework_TestCase
{
public function setUp()
{
TestHelper::installTestDatabase();
TestHelper::setupZendBootstrap();
parent::setUp();
}
public function testCheckOverlappingShows()
{
}
public function testIsFileScheduledInTheFuture()
{
TestHelper::loginUser();
$CC_CONFIG = Config::getConfig();
$testShowData = ShowServiceData::getNoRepeatNoRRData();
$showService = new Application_Service_ShowService();
$futureDate = new DateTime();
$futureDate->add(new DateInterval('P1Y')); //1 year into the future
$futureDateString = $futureDate->format('Y-m-d');
$testShowData["add_show_start_date"] = $futureDateString;
$testShowData["add_show_end_date"] = $futureDateString;
$testShowData["add_show_end_date_no_repeat"] = $futureDateString;
//Fudge the "populated until" date to workaround and issue where the default
//value will prevent anything from actually being scheduled. Normally this isn't
//a problem because as soon as you view the calendar for the first time, this is
//set to a week ahead in the future.
$populateUntil = new DateTime("now", new DateTimeZone('UTC'));
$populateUntil = $populateUntil->add(new DateInterval("P2Y")); //2 years ahead in the future.
Application_Model_Preference::SetShowsPopulatedUntil($populateUntil);
//$showService->setCcShow($testShowData); //Denise says this is not needed.
$showService->addUpdateShow($testShowData); //Create show instances
// Moved creation of stor directory to TestHelper for setup
// Insert a fake file into the database
$request = $this->getRequest();
$params = $request->getParams();
$params['action'] = '';
$params['api_key'] = $CC_CONFIG["apiKey"][0];
$request->setParams($params);
$metadata = array("MDATA_KEY_FILEPATH" => "/tmp/foobar.mp3",
"MDATA_KEY_DURATION" => "00:01:00",
"is_record" => false);
//Create the file in the database via the HTTP API.
$apiController = new ApiController($this->request, $this->getResponse());
$results = $apiController->dispatchMetadata($metadata, "create");
$fileId = $results["fileid"];
$this->assertNotEquals($fileId, -1);
$this->assertEquals($fileId, 1);
//The file should not be scheduled in the future (or at all) at this point
$scheduleModel = new Application_Model_Schedule();
$scheduleModel->IsFileScheduledInTheFuture($fileId);
$this->assertEquals($scheduleModel->IsFileScheduledInTheFuture($fileId), false);
//Schedule the fake file in the test show, which should be in the future.
$showInstance = new Application_Model_ShowInstance(1);
$showInstance->addFileToShow($fileId);
//Test the function we actually want to test. :-)
$this->assertEquals($scheduleModel->IsFileScheduledInTheFuture($fileId), true);
}
}

View File

@ -0,0 +1,698 @@
<?php
require_once "../application/configs/conf.php";
/*
* All dates in the xml files are hard coded and in the year 2044
* It would have been nice to use 'PHPUnit/Extensions/Database/DataSet/ReplacementDataSet.php'
* to be able to use variables in the xml dataset files so dates can be relative. This proved
* not practical for Airtime; For repeating shows, the start times are always varying and would
* require functions that calculate the start and end dates, and the next populate date. The
* tests would be performing the same work as the application and require tests themselves.
*/
class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase
{
private $_connectionMock;
//private $_nowDT;
public function setUp()
{
TestHelper::installTestDatabase();
TestHelper::setupZendBootstrap();
//$this->_nowDT = new DateTime("now", new DateTimeZone("UTC"));
parent::setUp();
}
public function getConnection()
{
if ($this->_connectionMock == null) {
$config = TestHelper::getDbZendConfig();
$connection = Zend_Db::factory('pdo_pgsql', $config);
$this->_connectionMock = $this->createZendDbConnection(
$connection,
'airtimeunittests'
);
Zend_Db_Table_Abstract::setDefaultAdapter($connection);
}
return $this->_connectionMock;
}
/* Defines how the initial state of the database should look before each test is executed
* Called once during setUp() and gets recreated for each new test
*/
public function getDataSet()
{
return new PHPUnit_Extensions_Database_DataSet_YamlDataSet(
__DIR__ . '/datasets/seed_show_service.yml'
);
}
public function testCcShowInsertedIntoDatabase()
{
$showService = new Application_Service_ShowService();
$data = array(
"add_show_id" => -1,
"add_show_name" => "test show",
"add_show_description" => null,
"add_show_url" => null,
"add_show_genre" => null,
"add_show_color" => "ffffff",
"add_show_background_color" => "364492",
"cb_airtime_auth" => false,
"cb_custom_auth" => false,
"custom_username" => null,
"custom_password" => null,
"add_show_linked" => false,
"add_show_has_autoplaylist" => 0,
"add_show_autoplaylist_id" => null,
"add_show_autoplaylist_repeat" => 0
);
$showService->setCcShow($data);
$ds = new Zend_Test_PHPUnit_Db_DataSet_QueryDataSet(
$this->getConnection()
);
$ds->addTable('cc_show', 'select * from cc_show');
$this->assertDataSetsEqual(
new PHPUnit_Extensions_Database_DataSet_YamlDataSet(__DIR__ . "/datasets/test_ccShowInsertedIntoDatabase.yml"),
$ds
);
}
/* Tests that a non-repeating, non-record, and non-rebroadcast show
* gets created properly
*/
public function testCreateNoRepeatNoRRShow()
{
TestHelper::loginUser();
$data = ShowServiceData::getNoRepeatNoRRData();
$showService = new Application_Service_ShowService(null, $data);
$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(
new PHPUnit_Extensions_Database_DataSet_YamlDataSet(__DIR__ . '/datasets/test_createNoRepeatNoRRShow.yml'),
$ds
);
}
/* Tests that a weekly repeating, non-record, non-rebroadcast show
* with no end date gets created correctly
*/
public function testCreateWeeklyRepeatNoEndNoRRShow()
{
TestHelper::loginUser();
$data = ShowServiceData::getWeeklyRepeatNoEndNoRRData();
$showService = new Application_Service_ShowService(null, $data);
$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(
new PHPUnit_Extensions_Database_DataSet_YamlDataSet(__DIR__ . '/datasets/test_createWeeklyRepeatNoEndNoRRShow.yml'),
$ds
);
}
public function testCreateBiWeeklyRepeatNoEndNoRRShow()
{
TestHelper::loginUser();
$data = ShowServiceData::getWeeklyRepeatNoEndNoRRData();
$data["add_show_repeat_type"] = "1";
$showService = new Application_Service_ShowService(null, $data);
$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(
new PHPUnit_Extensions_Database_DataSet_YamlDataSet(__DIR__ . '/datasets/test_createBiWeeklyRepeatNoEndNoRRShow.yml'),
$ds
);
}
public function testCreateTriWeeklyRepeatNoEndNoRRShow()
{
TestHelper::loginUser();
$data = ShowServiceData::getWeeklyRepeatNoEndNoRRData();
$data["add_show_repeat_type"] = "4";
$showService = new Application_Service_ShowService(null, $data);
$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(
new PHPUnit_Extensions_Database_DataSet_YamlDataSet(__DIR__ . '/datasets/test_createTriWeeklyRepeatNoEndNoRRShow.yml'),
$ds
);
}
public function testCreateQuadWeeklyRepeatNoEndNoRRShow()
{
TestHelper::loginUser();
$data = ShowServiceData::getWeeklyRepeatNoEndNoRRData();
$data["add_show_repeat_type"] = "5";
$showService = new Application_Service_ShowService(null, $data);
$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(
new PHPUnit_Extensions_Database_DataSet_YamlDataSet(__DIR__ . "/datasets/test_createQuadWeeklyRepeatNoEndNoRRShow.yml"),
$ds
);
}
public function testCreateMonthlyMonthlyRepeatNoEndNoRRShow()
{
TestHelper::loginUser();
$data = ShowServiceData::getWeeklyRepeatNoEndNoRRData();
$data["add_show_repeat_type"] = "2";
$showService = new Application_Service_ShowService(null, $data);
$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(
new PHPUnit_Extensions_Database_DataSet_YamlDataSet(__DIR__ . "/datasets/test_createMonthlyMonthlyRepeatNoEndNoRRShow.yml"),
$ds
);
}
public function testCreateMonthlyWeeklyRepeatNoEndNoRRShow()
{
TestHelper::loginUser();
$data = ShowServiceData::getWeeklyRepeatNoEndNoRRData();
$data["add_show_repeat_type"] = "3";
$showService = new Application_Service_ShowService(null, $data);
$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(
new PHPUnit_Extensions_Database_DataSet_YamlDataSet(__DIR__ . "/datasets/test_createMonthlyWeeklyRepeatNoEndNoRRShow.yml"),
$ds
);
}
/* Tests that a show instance gets deleted from it's repeating sequence properly
*/
public function testDeleteShowInstance()
{
TestHelper::loginUser();
$data = ShowServiceData::getWeeklyRepeatNoEndNoRRData();
$service_show = new Application_Service_ShowService(null, $data);
$service_show->addUpdateShow($data);
$service_show->deleteShow(3, 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 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(
new PHPUnit_Extensions_Database_DataSet_YamlDataSet(__DIR__ . "/datasets/test_deleteShowInstance.yml"),
$ds
);
}
/* Tests that when a user selects 'Delete this instance and all following
* on the calendar the database gets updated correctly
*/
public function testDeleteShowInstanceAndAllFollowing()
{
TestHelper::loginUser();
$data = ShowServiceData::getWeeklyRepeatNoEndNoRRData();
$data["add_show_day_check"] = array(5,1,2);
$service_show = new Application_Service_ShowService(null, $data);
$service_show->addUpdateShow($data);
//delete some single instances first
$service_show->deleteShow(1, true);
$service_show->deleteShow(6, true);
$service_show->deleteShow(8, true);
//delete all instances including and after where id=4
$service_show->deleteShow(4);
$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 order by first_show');
$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(
new PHPUnit_Extensions_Database_DataSet_YamlDataSet(__DIR__ . "/datasets/test_deleteShowInstanceAndAllFollowing.yml"),
$ds
);
}
public function testEditRepeatingShowInstance()
{
TestHelper::loginUser();
$data = ShowServiceData::getWeeklyRepeatNoEndNoRRData();
$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
$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(
new PHPUnit_Extensions_Database_DataSet_YamlDataSet(__DIR__ . "/datasets/test_editRepeatingShowInstance.yml"),
$ds
);
}
/* Tests the entire show gets deleted when the user selects 'Delete this
* instance and all following' from the context menu on the calendar
*/
public function testDeleteRepeatingShow()
{
TestHelper::loginUser();
$data = ShowServiceData::getWeeklyRepeatNoEndNoRRData();
$showService = new Application_Service_ShowService(null, $data);
$showService->addUpdateShow($data);
$showService->deleteShow(1);
$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(
new PHPUnit_Extensions_Database_DataSet_YamlDataSet(__DIR__ . "/datasets/test_deleteRepeatingShow.yml"),
$ds
);
}
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("2044-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(
new PHPUnit_Extensions_Database_DataSet_YamlDataSet(__DIR__ . "/datasets/test_repeatShowCreationWhenUserMovesForwardInCalendar.yml"),
$ds
);
}
public function testLinkedShow()
{
TestHelper::loginUser();
/** Test creating a linked show **/
$data = ShowServiceData::getWeeklyRepeatNoEndNoRRData();
$data["add_show_linked"] = 1;
$showService = new Application_Service_ShowService(null, $data);
$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(
new PHPUnit_Extensions_Database_DataSet_YamlDataSet(__DIR__ . "/datasets/test_createLinkedShow.yml"),
$ds
);
}
/** Test the creation of a single record and rebroadcast(RR) show **/
public function testCreateNoRepeatRRShow()
{
TestHelper::loginUser();
$data = ShowServiceData::getNoRepeatRRData();
$showService = new Application_Service_ShowService(null, $data);
$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(
new PHPUnit_Extensions_Database_DataSet_YamlDataSet(__DIR__ . "/datasets/test_createNoRepeatRRShow.yml"),
$ds
);
}
/** Test the creation of a weekly repeating, record and rebroadcast(RR) show **/
public function testCreateWeeklyRepeatRRShow()
{
TestHelper::loginUser();
$data = ShowServiceData::getWeeklyRepeatRRData();
$showService = new Application_Service_ShowService(null, $data);
$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(
new PHPUnit_Extensions_Database_DataSet_YamlDataSet(__DIR__ . "/datasets/test_createWeeklyRepeatRRShow.yml"),
$ds
);
}
public function testEditRepeatingShowChangeNoEndOption()
{
TestHelper::loginUser();
/** Test changing the no end option on a weekly repeating show **/
$data = ShowServiceData::getWeeklyRepeatNoEndNoRRData();
$showService = new Application_Service_ShowService(null, $data);
$showService->addUpdateShow($data);
$data["add_show_end_date"] = '2044-01-09';
$data["add_show_no_end"] = 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(
new PHPUnit_Extensions_Database_DataSet_YamlDataSet(__DIR__ . "/datasets/test_editRepeatingShowChangeNoEndOption.yml"),
$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_start_date"] = "2044-01-29";
$data["add_show_day_check"] = array(5,6);
$data["add_show_linked"] = 1;
$showService = new Application_Service_ShowService(null, $data);
$showService->addUpdateShow($data);
//insert some fake tracks into cc_schedule table
$ccFiles = new CcFiles();
$ccFiles
->setDbCueIn("00:00:00")
->setDbCueOut("00:04:32")
->save();
$scheduleItems = array(
0 => array(
"id" => 0,
"instance" => 1,
"timestamp" => time()
)
);
$mediaItems = array(
0 => array(
"id" => 1,
"type" => "audioclip"
)
);
$scheduler = new Application_Model_Scheduler();
$scheduler->scheduleAfter($scheduleItems, $mediaItems);
//delete the first repeat day
$data["add_show_day_check"] = array(6);
$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');
$ds->addTable('cc_schedule', 'select id, starts, ends, file_id, clip_length, fade_in, fade_out, cue_in, cue_out, instance_id, playout_status from cc_schedule');
$this->assertDataSetsEqual(
new PHPUnit_Extensions_Database_DataSet_YamlDataSet(__DIR__ . "/datasets/test_removeFirstRepeatShowDayUpdatesScheduleCorrectly.yml"),
$ds
);
}
public function testChangeRepeatDayUpdatesScheduleCorrectly()
{
TestHelper::loginUser();
$data = ShowServiceData::getWeeklyRepeatNoEndNoRRData();
$data["add_show_start_date"] = "2044-01-29";
$data["add_show_day_check"] = array(5, 6);
$data["add_show_linked"] = 1;
$showService = new Application_Service_ShowService(null, $data);
$showService->addUpdateShow($data);
//insert some fake tracks into cc_schedule table
$ccFiles = new CcFiles();
$ccFiles
->setDbCueIn("00:00:00")
->setDbCueOut("00:04:32")
->save();
$scheduleItems = array(
0 => array(
"id" => 0,
"instance" => 1,
"timestamp" => time()
)
);
$mediaItems = array(
0 => array(
"id" => 1,
"type" => "audioclip"
)
);
$scheduler = new Application_Model_Scheduler();
$scheduler->scheduleAfter($scheduleItems, $mediaItems);
//delete the first repeat day
$data["add_show_day_check"] = array(6);
$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');
$ds->addTable('cc_schedule', 'select id, starts, ends, file_id, clip_length, fade_in, fade_out, cue_in, cue_out, instance_id, playout_status from cc_schedule');
$this->assertDataSetsEqual(
new PHPUnit_Extensions_Database_DataSet_YamlDataSet(__DIR__ . "/datasets/test_changeRepeatDayUpdatesScheduleCorrectly.yml"),
$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(
new PHPUnit_Extensions_Database_DataSet_YamlDataSet(__DIR__ . "/datasets/test_weeklyToNoRepeat.yml"),
$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(
new PHPUnit_Extensions_Database_DataSet_YamlDataSet(__DIR__ . "/datasets/test_weeklyToBiWeekly.yml"),
$ds
);
}
}

View File

@ -0,0 +1,11 @@
cc_pref:
-
id: '1'
subjid: null
keystr: shows_populated_until
valstr: '2044-02-07 00:00:00'
-
id: '2'
subjid: null
keystr: timezone
valstr: UTC

View File

@ -0,0 +1,19 @@
cc_show:
-
id: '1'
name: 'test show'
url: null
genre: null
description: null
color: ffffff
background_color: '364492'
live_stream_using_airtime_auth: false
live_stream_using_custom_auth: false
live_stream_user: null
live_stream_pass: null
linked: false
is_linkable: true
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false

View File

@ -0,0 +1,79 @@
cc_show:
-
id: '1'
name: 'test show'
url: null
genre: null
description: null
color: ffffff
background_color: '364492'
live_stream_using_airtime_auth: false
live_stream_using_custom_auth: false
live_stream_user: null
live_stream_pass: null
linked: true
is_linkable: true
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '2'
first_show: '2044-01-30'
last_show: null
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '6'
repeat_type: '0'
next_pop_date: '2044-02-13'
show_id: '1'
record: '0'
cc_show_instances:
-
id: '3'
starts: '2044-01-30 00:00:00'
ends: '2044-01-30 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '4'
starts: '2044-02-06 00:00:00'
ends: '2044-02-06 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
cc_schedule:
-
id: '3'
starts: '2044-01-30 00:00:00'
ends: '2044-01-30 00:04:32'
file_id: '1'
clip_length: '00:04:32'
fade_in: '00:00:00.5'
fade_out: '00:00:00.5'
cue_in: '00:00:00'
cue_out: '00:04:32'
instance_id: '3'
playout_status: '1'
-
id: '4'
starts: '2044-02-06 00:00:00'
ends: '2044-02-06 00:04:32'
file_id: '1'
clip_length: '00:04:32'
fade_in: '00:00:00.5'
fade_out: '00:00:00.5'
cue_in: '00:00:00'
cue_out: '00:04:32'
instance_id: '4'
playout_status: '1'
cc_show_rebroadcast:
cc_show_hosts:

View File

@ -0,0 +1,63 @@
cc_show:
-
id: '1'
name: 'test show'
url: null
genre: null
description: null
color: ffffff
background_color: '364492'
live_stream_using_airtime_auth: false
live_stream_using_custom_auth: false
live_stream_user: null
live_stream_pass: null
linked: false
is_linkable: true
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'
first_show: '2044-01-01'
last_show: null
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '5'
repeat_type: '1'
next_pop_date: '2044-02-12'
show_id: '1'
record: '0'
cc_show_instances:
-
id: '1'
starts: '2044-01-01 00:00:00'
ends: '2044-01-01 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '2'
starts: '2044-01-15 00:00:00'
ends: '2044-01-15 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '3'
starts: '2044-01-29 00:00:00'
ends: '2044-01-29 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
cc_show_rebroadcast:
cc_show_hosts:

View File

@ -0,0 +1,90 @@
cc_show:
-
id: '1'
name: 'test show'
url: null
genre: null
description: null
color: ffffff
background_color: '364492'
live_stream_using_airtime_auth: false
live_stream_using_custom_auth: false
live_stream_user: null
live_stream_pass: null
linked: true
is_linkable: true
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'
first_show: '2044-01-01'
last_show: null
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '5'
repeat_type: '0'
next_pop_date: '2044-02-12'
show_id: '1'
record: '0'
cc_show_instances:
-
id: '1'
starts: '2044-01-01 00:00:00'
ends: '2044-01-01 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '2'
starts: '2044-01-08 00:00:00'
ends: '2044-01-08 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '3'
starts: '2044-01-15 00:00:00'
ends: '2044-01-15 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '4'
starts: '2044-01-22 00:00:00'
ends: '2044-01-22 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '5'
starts: '2044-01-29 00:00:00'
ends: '2044-01-29 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '6'
starts: '2044-02-05 00:00:00'
ends: '2044-02-05 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
cc_show_rebroadcast:
cc_show_hosts:

View File

@ -0,0 +1,54 @@
cc_show:
-
id: '1'
name: 'test show'
url: null
genre: null
description: null
color: ffffff
background_color: '364492'
live_stream_using_airtime_auth: false
live_stream_using_custom_auth: false
live_stream_user: null
live_stream_pass: null
linked: false
is_linkable: true
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'
first_show: '2044-01-01'
last_show: null
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: null
repeat_type: '2'
next_pop_date: '2044-03-01'
show_id: '1'
record: '0'
cc_show_instances:
-
id: '1'
starts: '2044-01-01 00:00:00'
ends: '2044-01-01 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '2'
starts: '2044-02-01 00:00:00'
ends: '2044-02-01 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
cc_show_rebroadcast:
cc_show_hosts:

View File

@ -0,0 +1,54 @@
cc_show:
-
id: '1'
name: 'test show'
url: null
genre: null
description: null
color: ffffff
background_color: '364492'
live_stream_using_airtime_auth: false
live_stream_using_custom_auth: false
live_stream_user: null
live_stream_pass: null
linked: false
is_linkable: true
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'
first_show: '2044-01-01'
last_show: null
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '5'
repeat_type: '3'
next_pop_date: '2044-03-04'
show_id: '1'
record: '0'
cc_show_instances:
-
id: '1'
starts: '2044-01-01 00:00:00'
ends: '2044-01-01 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '2'
starts: '2044-02-05 00:00:00'
ends: '2044-02-05 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
cc_show_rebroadcast:
cc_show_hosts:

View File

@ -0,0 +1,45 @@
cc_show:
-
id: '1'
name: 'test show'
url: null
genre: null
description: null
color: ffffff
background_color: '364492'
live_stream_using_airtime_auth: false
live_stream_using_custom_auth: false
live_stream_user: null
live_stream_pass: null
linked: false
is_linkable: true
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'
first_show: '2044-01-01'
last_show: null
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '5'
repeat_type: '-1'
next_pop_date: '2044-01-01'
show_id: '1'
record: '0'
cc_show_instances:
-
id: '1'
starts: '2044-01-01 00:00:00'
ends: '2044-01-01 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
cc_show_rebroadcast:
cc_show_hosts:

View File

@ -0,0 +1,185 @@
cc_show:
-
id: '1'
name: 'test show'
url: null
genre: null
description: null
color: ffffff
background_color: '364492'
live_stream_using_airtime_auth: false
live_stream_using_custom_auth: false
live_stream_user: null
live_stream_pass: null
linked: false
is_linkable: true
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'
first_show: '2044-01-01'
last_show: null
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '5'
repeat_type: '-1'
next_pop_date: '2044-01-01'
show_id: '1'
record: '1'
cc_show_instances:
-
id: '1'
starts: '2044-01-01 00:00:00'
ends: '2044-01-01 01:00:00'
show_id: '1'
record: '1'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '2'
starts: '2044-01-02 00:00:00'
ends: '2044-01-02 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '1'
instance_id: '1'
modified_instance: false
-
id: '3'
starts: '2044-01-03 00:00:00'
ends: '2044-01-03 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '1'
instance_id: '1'
modified_instance: false
-
id: '4'
starts: '2044-01-04 00:00:00'
ends: '2044-01-04 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '1'
instance_id: '1'
modified_instance: false
-
id: '5'
starts: '2044-01-05 00:00:00'
ends: '2044-01-05 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '1'
instance_id: '1'
modified_instance: false
-
id: '6'
starts: '2044-01-06 00:00:00'
ends: '2044-01-06 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '1'
instance_id: '1'
modified_instance: false
-
id: '7'
starts: '2044-01-07 00:00:00'
ends: '2044-01-07 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '1'
instance_id: '1'
modified_instance: false
-
id: '8'
starts: '2044-01-08 00:00:00'
ends: '2044-01-08 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '1'
instance_id: '1'
modified_instance: false
-
id: '9'
starts: '2044-01-09 00:00:00'
ends: '2044-01-09 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '1'
instance_id: '1'
modified_instance: false
-
id: '10'
starts: '2044-01-10 00:00:00'
ends: '2044-01-10 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '1'
instance_id: '1'
modified_instance: false
-
id: '11'
starts: '2044-01-11 00:00:00'
ends: '2044-01-11 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '1'
instance_id: '1'
modified_instance: false
cc_show_rebroadcast:
-
id: '1'
day_offset: '1 days'
start_time: '00:00:00'
show_id: '1'
-
id: '2'
day_offset: '2 days'
start_time: '00:00:00'
show_id: '1'
-
id: '3'
day_offset: '3 days'
start_time: '00:00:00'
show_id: '1'
-
id: '4'
day_offset: '4 days'
start_time: '00:00:00'
show_id: '1'
-
id: '5'
day_offset: '5 days'
start_time: '00:00:00'
show_id: '1'
-
id: '6'
day_offset: '6 days'
start_time: '00:00:00'
show_id: '1'
-
id: '7'
day_offset: '7 days'
start_time: '00:00:00'
show_id: '1'
-
id: '8'
day_offset: '8 days'
start_time: '00:00:00'
show_id: '1'
-
id: '9'
day_offset: '9 days'
start_time: '00:00:00'
show_id: '1'
-
id: '10'
day_offset: '10 days'
start_time: '00:00:00'
show_id: '1'
cc_show_hosts:

View File

@ -0,0 +1,54 @@
cc_show:
-
id: '1'
name: 'test show'
url: null
genre: null
description: null
color: ffffff
background_color: '364492'
live_stream_using_airtime_auth: false
live_stream_using_custom_auth: false
live_stream_user: null
live_stream_pass: null
linked: false
is_linkable: true
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'
first_show: '2044-01-01'
last_show: null
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '5'
repeat_type: '5'
next_pop_date: '2044-02-26'
show_id: '1'
record: '0'
cc_show_instances:
-
id: '1'
starts: '2044-01-01 00:00:00'
ends: '2044-01-01 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '2'
starts: '2044-01-29 00:00:00'
ends: '2044-01-29 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
cc_show_rebroadcast:
cc_show_hosts:

View File

@ -0,0 +1,54 @@
cc_show:
-
id: '1'
name: 'test show'
url: null
genre: null
description: null
color: ffffff
background_color: '364492'
live_stream_using_airtime_auth: false
live_stream_using_custom_auth: false
live_stream_user: null
live_stream_pass: null
linked: false
is_linkable: true
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'
first_show: '2044-01-01'
last_show: null
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '5'
repeat_type: '4'
next_pop_date: '2044-02-12'
show_id: '1'
record: '0'
cc_show_instances:
-
id: '1'
starts: '2044-01-01 00:00:00'
ends: '2044-01-01 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '2'
starts: '2044-01-22 00:00:00'
ends: '2044-01-22 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
cc_show_rebroadcast:
cc_show_hosts:

View File

@ -0,0 +1,90 @@
cc_show:
-
id: '1'
name: 'test show'
url: null
genre: null
description: null
color: ffffff
background_color: '364492'
live_stream_using_airtime_auth: false
live_stream_using_custom_auth: false
live_stream_user: null
live_stream_pass: null
linked: false
is_linkable: true
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'
first_show: '2044-01-01'
last_show: null
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '5'
repeat_type: '0'
next_pop_date: '2044-02-12'
show_id: '1'
record: '0'
cc_show_instances:
-
id: '1'
starts: '2044-01-01 00:00:00'
ends: '2044-01-01 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '2'
starts: '2044-01-08 00:00:00'
ends: '2044-01-08 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '3'
starts: '2044-01-15 00:00:00'
ends: '2044-01-15 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '4'
starts: '2044-01-22 00:00:00'
ends: '2044-01-22 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '5'
starts: '2044-01-29 00:00:00'
ends: '2044-01-29 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '6'
starts: '2044-02-05 00:00:00'
ends: '2044-02-05 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
cc_show_rebroadcast:
cc_show_hosts:

View File

@ -0,0 +1,208 @@
cc_show:
-
id: '1'
name: 'test show'
url: null
genre: null
description: null
color: ffffff
background_color: '364492'
live_stream_using_airtime_auth: false
live_stream_using_custom_auth: false
live_stream_user: null
live_stream_pass: null
linked: false
is_linkable: true
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'
first_show: '2044-01-01'
last_show: null
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '5'
repeat_type: '0'
next_pop_date: '2044-02-12'
show_id: '1'
record: '1'
cc_show_instances:
-
id: '1'
starts: '2044-01-01 00:00:00'
ends: '2044-01-01 01:00:00'
show_id: '1'
record: '1'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '2'
starts: '2044-01-02 00:00:00'
ends: '2044-01-02 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '1'
instance_id: '1'
modified_instance: false
-
id: '3'
starts: '2044-01-03 12:00:00'
ends: '2044-01-03 13:00:00'
show_id: '1'
record: '0'
rebroadcast: '1'
instance_id: '1'
modified_instance: false
-
id: '4'
starts: '2044-01-08 00:00:00'
ends: '2044-01-08 01:00:00'
show_id: '1'
record: '1'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '5'
starts: '2044-01-09 00:00:00'
ends: '2044-01-09 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '1'
instance_id: '4'
modified_instance: false
-
id: '6'
starts: '2044-01-10 12:00:00'
ends: '2044-01-10 13:00:00'
show_id: '1'
record: '0'
rebroadcast: '1'
instance_id: '4'
modified_instance: false
-
id: '7'
starts: '2044-01-15 00:00:00'
ends: '2044-01-15 01:00:00'
show_id: '1'
record: '1'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '8'
starts: '2044-01-16 00:00:00'
ends: '2044-01-16 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '1'
instance_id: '7'
modified_instance: false
-
id: '9'
starts: '2044-01-17 12:00:00'
ends: '2044-01-17 13:00:00'
show_id: '1'
record: '0'
rebroadcast: '1'
instance_id: '7'
modified_instance: false
-
id: '10'
starts: '2044-01-22 00:00:00'
ends: '2044-01-22 01:00:00'
show_id: '1'
record: '1'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '11'
starts: '2044-01-23 00:00:00'
ends: '2044-01-23 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '1'
instance_id: '10'
modified_instance: false
-
id: '12'
starts: '2044-01-24 12:00:00'
ends: '2044-01-24 13:00:00'
show_id: '1'
record: '0'
rebroadcast: '1'
instance_id: '10'
modified_instance: false
-
id: '13'
starts: '2044-01-29 00:00:00'
ends: '2044-01-29 01:00:00'
show_id: '1'
record: '1'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '14'
starts: '2044-01-30 00:00:00'
ends: '2044-01-30 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '1'
instance_id: '13'
modified_instance: false
-
id: '15'
starts: '2044-01-31 12:00:00'
ends: '2044-01-31 13:00:00'
show_id: '1'
record: '0'
rebroadcast: '1'
instance_id: '13'
modified_instance: false
-
id: '16'
starts: '2044-02-05 00:00:00'
ends: '2044-02-05 01:00:00'
show_id: '1'
record: '1'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '17'
starts: '2044-02-06 00:00:00'
ends: '2044-02-06 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '1'
instance_id: '16'
modified_instance: false
-
id: '18'
starts: '2044-02-07 12:00:00'
ends: '2044-02-07 13:00:00'
show_id: '1'
record: '0'
rebroadcast: '1'
instance_id: '16'
modified_instance: false
cc_show_rebroadcast:
-
id: '1'
day_offset: '1 days'
start_time: '00:00:00'
show_id: '1'
-
id: '2'
day_offset: '2 days'
start_time: '12:00:00'
show_id: '1'
cc_show_hosts:

View File

@ -0,0 +1,6 @@
cc_show:
cc_show_days:
cc_show_instances:
cc_show_rebroadcast:
cc_show_hosts:

View File

@ -0,0 +1,90 @@
cc_show:
-
id: '1'
name: 'test show'
url: null
genre: null
description: null
color: ffffff
background_color: '364492'
live_stream_using_airtime_auth: false
live_stream_using_custom_auth: false
live_stream_user: null
live_stream_pass: null
linked: false
is_linkable: true
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'
first_show: '2044-01-01'
last_show: null
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '5'
repeat_type: '0'
next_pop_date: '2044-02-12'
show_id: '1'
record: '0'
cc_show_instances:
-
id: '1'
starts: '2044-01-01 00:00:00'
ends: '2044-01-01 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '2'
starts: '2044-01-08 00:00:00'
ends: '2044-01-08 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '3'
starts: '2044-01-15 00:00:00'
ends: '2044-01-15 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: true
-
id: '4'
starts: '2044-01-22 00:00:00'
ends: '2044-01-22 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '5'
starts: '2044-01-29 00:00:00'
ends: '2044-01-29 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '6'
starts: '2044-02-05 00:00:00'
ends: '2044-02-05 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
cc_show_rebroadcast:
cc_show_hosts:

View File

@ -0,0 +1,204 @@
cc_show:
-
id: '1'
name: 'test show'
url: null
genre: null
description: null
color: ffffff
background_color: '364492'
live_stream_using_airtime_auth: false
live_stream_using_custom_auth: false
live_stream_user: null
live_stream_pass: null
linked: false
is_linkable: true
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'
first_show: '2044-01-01'
last_show: '2044-01-16'
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '5'
repeat_type: '0'
next_pop_date: '2044-02-12'
show_id: '1'
record: '0'
-
id: '2'
first_show: '2044-01-04'
last_show: '2044-01-19'
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '1'
repeat_type: '0'
next_pop_date: '2044-02-08'
show_id: '1'
record: '0'
-
id: '3'
first_show: '2044-01-05'
last_show: '2044-01-20'
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '2'
repeat_type: '0'
next_pop_date: '2044-02-09'
show_id: '1'
record: '0'
cc_show_instances:
-
id: '1'
starts: '2044-01-01 00:00:00'
ends: '2044-01-01 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: true
-
id: '2'
starts: '2044-01-08 00:00:00'
ends: '2044-01-08 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '3'
starts: '2044-01-15 00:00:00'
ends: '2044-01-15 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '4'
starts: '2044-01-22 00:00:00'
ends: '2044-01-22 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: true
-
id: '5'
starts: '2044-01-29 00:00:00'
ends: '2044-01-29 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: true
-
id: '6'
starts: '2044-02-05 00:00:00'
ends: '2044-02-05 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: true
-
id: '7'
starts: '2044-01-04 00:00:00'
ends: '2044-01-04 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '8'
starts: '2044-01-11 00:00:00'
ends: '2044-01-11 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: true
-
id: '9'
starts: '2044-01-18 00:00:00'
ends: '2044-01-18 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '10'
starts: '2044-01-25 00:00:00'
ends: '2044-01-25 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: true
-
id: '11'
starts: '2044-02-01 00:00:00'
ends: '2044-02-01 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: true
-
id: '12'
starts: '2044-01-05 00:00:00'
ends: '2044-01-05 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '13'
starts: '2044-01-12 00:00:00'
ends: '2044-01-12 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '14'
starts: '2044-01-19 00:00:00'
ends: '2044-01-19 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '15'
starts: '2044-01-26 00:00:00'
ends: '2044-01-26 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: true
-
id: '16'
starts: '2044-02-02 00:00:00'
ends: '2044-02-02 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: true
cc_show_rebroadcast:
cc_show_hosts:

View File

@ -0,0 +1,54 @@
cc_show:
-
id: '1'
name: 'test show'
url: null
genre: null
description: null
color: ffffff
background_color: '364492'
live_stream_using_airtime_auth: false
live_stream_using_custom_auth: false
live_stream_user: null
live_stream_pass: null
linked: false
is_linkable: true
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'
first_show: '2044-01-01'
last_show: '2044-01-10'
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '5'
repeat_type: '0'
next_pop_date: '2044-01-15'
show_id: '1'
record: '0'
cc_show_instances:
-
id: '1'
starts: '2044-01-01 00:00:00'
ends: '2044-01-01 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '2'
starts: '2044-01-08 00:00:00'
ends: '2044-01-08 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
cc_show_rebroadcast:
cc_show_hosts:

View File

@ -0,0 +1,111 @@
cc_show:
-
id: '1'
name: 'test show'
url: null
genre: null
description: null
color: ffffff
background_color: '364492'
live_stream_using_airtime_auth: false
live_stream_using_custom_auth: false
live_stream_user: null
live_stream_pass: null
linked: false
is_linkable: true
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'
first_show: '2044-01-01'
last_show: null
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '5'
repeat_type: '0'
next_pop_date: '2044-02-12'
show_id: '1'
record: '0'
-
id: '2'
first_show: '2044-01-08'
last_show: '2044-01-09'
start_time: '01:00:00'
timezone: UTC
duration: '01:00'
day: '5'
repeat_type: '-1'
next_pop_date: '2044-01-08'
show_id: '1'
record: '0'
cc_show_instances:
-
id: '1'
starts: '2044-01-01 00:00:00'
ends: '2044-01-01 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '2'
starts: '2044-01-08 00:00:00'
ends: '2044-01-08 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: true
-
id: '3'
starts: '2044-01-15 00:00:00'
ends: '2044-01-15 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '4'
starts: '2044-01-22 00:00:00'
ends: '2044-01-22 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '5'
starts: '2044-01-29 00:00:00'
ends: '2044-01-29 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '6'
starts: '2044-02-05 00:00:00'
ends: '2044-02-05 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '7'
starts: '2044-01-08 01:00:00'
ends: '2044-01-08 02:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
cc_show_rebroadcast:
cc_show_hosts:

View File

@ -0,0 +1,79 @@
cc_show:
-
id: '1'
name: 'test show'
url: null
genre: null
description: null
color: ffffff
background_color: '364492'
live_stream_using_airtime_auth: false
live_stream_using_custom_auth: false
live_stream_user: null
live_stream_pass: null
linked: true
is_linkable: true
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '2'
first_show: '2044-01-30'
last_show: null
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '6'
repeat_type: '0'
next_pop_date: '2044-02-13'
show_id: '1'
record: '0'
cc_show_instances:
-
id: '3'
starts: '2044-01-30 00:00:00'
ends: '2044-01-30 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '4'
starts: '2044-02-06 00:00:00'
ends: '2044-02-06 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
cc_schedule:
-
id: '3'
starts: '2044-01-30 00:00:00'
ends: '2044-01-30 00:04:32'
file_id: '1'
clip_length: '00:04:32'
fade_in: '00:00:00.5'
fade_out: '00:00:00.5'
cue_in: '00:00:00'
cue_out: '00:04:32'
instance_id: '3'
playout_status: '1'
-
id: '4'
starts: '2044-02-06 00:00:00'
ends: '2044-02-06 00:04:32'
file_id: '1'
clip_length: '00:04:32'
fade_in: '00:00:00.5'
fade_out: '00:00:00.5'
cue_in: '00:00:00'
cue_out: '00:04:32'
instance_id: '4'
playout_status: '1'
cc_show_rebroadcast:
cc_show_hosts:

View File

@ -0,0 +1,90 @@
cc_show:
-
id: '1'
name: 'test show'
url: null
genre: null
description: null
color: ffffff
background_color: '364492'
live_stream_using_airtime_auth: false
live_stream_using_custom_auth: false
live_stream_user: null
live_stream_pass: null
linked: false
is_linkable: true
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'
first_show: '2044-01-01'
last_show: null
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '5'
repeat_type: '1'
next_pop_date: '2044-03-25'
show_id: '1'
record: '0'
cc_show_instances:
-
id: '1'
starts: '2044-01-01 00:00:00'
ends: '2044-01-01 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '2'
starts: '2044-01-15 00:00:00'
ends: '2044-01-15 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '3'
starts: '2044-01-29 00:00:00'
ends: '2044-01-29 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '4'
starts: '2044-02-12 00:00:00'
ends: '2044-02-12 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '5'
starts: '2044-02-26 00:00:00'
ends: '2044-02-26 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '6'
starts: '2044-03-11 00:00:00'
ends: '2044-03-11 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
cc_show_rebroadcast:
cc_show_hosts:

View File

@ -0,0 +1,90 @@
cc_show:
-
id: '1'
name: 'test show'
url: null
genre: null
description: null
color: ffffff
background_color: '364492'
live_stream_using_airtime_auth: false
live_stream_using_custom_auth: false
live_stream_user: null
live_stream_pass: null
linked: false
is_linkable: false
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '1'
first_show: '2044-01-01'
last_show: null
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '5'
repeat_type: '0'
next_pop_date: '2044-02-12'
show_id: '1'
record: '0'
cc_show_instances:
-
id: '1'
starts: '2044-01-01 00:00:00'
ends: '2044-01-01 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '2'
starts: '2044-01-08 00:00:00'
ends: '2044-01-08 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '3'
starts: '2044-01-15 00:00:00'
ends: '2044-01-15 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '4'
starts: '2044-01-22 00:00:00'
ends: '2044-01-22 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '5'
starts: '2044-01-29 00:00:00'
ends: '2044-01-29 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '6'
starts: '2044-02-05 00:00:00'
ends: '2044-02-05 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
cc_show_rebroadcast:
cc_show_hosts:

View File

@ -0,0 +1,63 @@
cc_show:
-
id: '1'
name: 'test show'
url: null
genre: null
description: null
color: ffffff
background_color: '364492'
live_stream_using_airtime_auth: false
live_stream_using_custom_auth: false
live_stream_user: null
live_stream_pass: null
linked: false
is_linkable: true
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '2'
first_show: '2044-01-01'
last_show: null
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '5'
repeat_type: '1'
next_pop_date: '2044-02-12'
show_id: '1'
record: '0'
cc_show_instances:
-
id: '7'
starts: '2044-01-01 00:00:00'
ends: '2044-01-01 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '8'
starts: '2044-01-15 00:00:00'
ends: '2044-01-15 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
-
id: '9'
starts: '2044-01-29 00:00:00'
ends: '2044-01-29 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
cc_show_rebroadcast:
cc_show_hosts:

View File

@ -0,0 +1,45 @@
cc_show:
-
id: '1'
name: 'test show'
url: null
genre: null
description: null
color: ffffff
background_color: '364492'
live_stream_using_airtime_auth: false
live_stream_using_custom_auth: false
live_stream_user: null
live_stream_pass: null
linked: false
is_linkable: true
image_path: ''
has_autoplaylist: false
autoplaylist_id: null
autoplaylist_repeat: false
cc_show_days:
-
id: '2'
first_show: '2044-01-01'
last_show: null
start_time: '00:00:00'
timezone: UTC
duration: '01:00'
day: '5'
repeat_type: '-1'
next_pop_date: '2044-01-01'
show_id: '1'
record: '0'
cc_show_instances:
-
id: '1'
starts: '2044-01-01 00:00:00'
ends: '2044-01-01 01:00:00'
show_id: '1'
record: '0'
rebroadcast: '0'
instance_id: null
modified_instance: false
cc_show_rebroadcast:
cc_show_hosts:

View File

@ -0,0 +1,139 @@
<?php
require_once "../application/configs/conf.php";
class ShowServiceUnitTest extends PHPUnit_Framework_TestCase
{
// needed for accessing private methods
protected $_reflectionOfShowService;
protected $_showService;
public function setUp()
{
$this->_reflectionOfShowService = new ReflectionClass('Application_Service_ShowService');
$this->_showService = new Application_Service_ShowService();
}
public function testFormatShowDuration()
{
$duration = Application_Service_ShowService::formatShowDuration("01h 00m");
$this->assertEquals("01:00", $duration);
$duration = Application_Service_ShowService::formatShowDuration("00h 05m");
$this->assertEquals("00:05", $duration);
$duration = Application_Service_ShowService::formatShowDuration("03h 55m");
$this->assertEquals("03:55", $duration);
}
public function testCalculateEndDate()
{
$method = $this->_reflectionOfShowService->getMethod('calculateEndDate');
$method->setAccessible(true);
$end = $method->invokeArgs($this->_showService, array(ShowServiceData::getNoRepeatNoRRData()));
$this->assertEquals(null, $end);
$end = $method->invokeArgs($this->_showService, array(ShowServiceData::getWeeklyRepeatWithEndNoRRData()));
$this->assertEquals(new DateTime("2044-01-27", new DateTimeZone("UTC")), $end);
$end = $method->invokeArgs($this->_showService, array(ShowServiceData::getWeeklyRepeatNoEndNoRRData()));
$this->assertEquals(null, $end);
}
public function testGetMonthlyWeeklyRepeatInterval()
{
$method = $this->_reflectionOfShowService->getMethod('getMonthlyWeeklyRepeatInterval');
$method->setAccessible(true);
$repeatInterval = $method->invokeArgs($this->_showService, array(new DateTime("2044-01-01"), new DateTimeZone("UTC")));
$this->assertEquals(array("first", "Friday"), $repeatInterval);
$repeatInterval = $method->invokeArgs($this->_showService, array(new DateTime("2044-01-12"), new DateTimeZone("UTC")));
$this->assertEquals(array("second", "Tuesday"), $repeatInterval);
$repeatInterval = $method->invokeArgs($this->_showService, array(new DateTime("2044-01-18"), new DateTimeZone("UTC")));
$this->assertEquals(array("third", "Monday"), $repeatInterval);
$repeatInterval = $method->invokeArgs($this->_showService, array(new DateTime("2044-01-28"), new DateTimeZone("UTC")));
$this->assertEquals(array("fourth", "Thursday"), $repeatInterval);
$repeatInterval = $method->invokeArgs($this->_showService, array(new DateTime("2044-01-30"), new DateTimeZone("UTC")));
$this->assertEquals(array("fifth", "Saturday"), $repeatInterval);
}
public function testGetNextMonthlyMonthlyRepeatDate()
{
$method = $this->_reflectionOfShowService->getMethod('getNextMonthlyMonthlyRepeatDate');
$method->setAccessible(true);
$next = $method->invokeArgs($this->_showService, array(new DateTime("2044-01-01"), "UTC", "00:00"));
$this->assertEquals(new DateTime("2044-02-01", new DateTimeZone("UTC")), $next);
$next = $method->invokeArgs($this->_showService, array(new DateTime("2044-01-30"), "UTC", "00:00"));
$this->assertEquals(new DateTime("2044-03-30", new DateTimeZone("UTC")), $next);
}
public function testGetNextMonthlyWeeklyRepeatDate()
{
$method = $this->_reflectionOfShowService->getMethod('getNextMonthlyWeeklyRepeatDate');
$method->setAccessible(true);
$next = $method->invokeArgs($this->_showService, array(
new DateTime("2044-02-01"), "UTC", "00:00", "first", "Friday"));
$this->assertEquals(new DateTime("2044-02-05", new DateTimeZone("UTC")), $next);
$next = $method->invokeArgs($this->_showService, array(
new DateTime("2044-02-01"), "UTC", "00:00", "fifth", "Saturday"));
$this->assertEquals(new DateTime("2044-04-30", new DateTimeZone("UTC")), $next);
$next = $method->invokeArgs($this->_showService, array(
new DateTime("2044-02-01"), "UTC", "00:00", "fourth", "Monday"));
$this->assertEquals(new DateTime("2044-02-22", new DateTimeZone("UTC")), $next);
}
public function testCreateUTCStartEndDateTime()
{
$method = $this->_reflectionOfShowService->getMethod('createUTCStartEndDateTime');
$method->setAccessible(true);
$utcTimezone = new DateTimeZone("UTC");
//America/Toronto
$localStartDT = new DateTime("2044-01-01 06:30", new DateTimeZone("America/Toronto"));
$localEndDT = new DateTime("2044-01-01 07:30", new DateTimeZone("America/Toronto"));
$dt = $method->invokeArgs($this->_showService, array($localStartDT, "01:00"));
$this->assertEquals(array(
$localStartDT->setTimezone($utcTimezone),$localEndDT->setTimezone($utcTimezone)), $dt);
//America/Toronto with offset for rebroadcast shows
$localStartDT = new DateTime("2044-01-01 06:30", new DateTimeZone("America/Toronto"));
$localEndDT = new DateTime("2044-01-01 07:30", new DateTimeZone("America/Toronto"));
$localRebroadcastStartDT = new DateTime("2044-01-02 06:30", new DateTimeZone("America/Toronto"));
$localRebroadcastEndDT = new DateTime("2044-01-02 07:30", new DateTimeZone("America/Toronto"));
$dt = $method->invokeArgs($this->_showService, array($localStartDT, "01:00",
array("days" => "1", "hours" => "06", "mins" => "30")));
$this->assertEquals(array(
$localRebroadcastStartDT->setTimezone($utcTimezone),$localRebroadcastEndDT->setTimezone($utcTimezone)), $dt);
//Australia/Brisbane
$localStartDT = new DateTime("2044-01-01 06:30", new DateTimeZone("Australia/Brisbane"));
$localEndDT = new DateTime("2044-01-01 07:30", new DateTimeZone("Australia/Brisbane"));
$dt = $method->invokeArgs($this->_showService, array($localStartDT, "01:00"));
$this->assertEquals(array(
$localStartDT->setTimezone($utcTimezone), $localEndDT->setTimezone($utcTimezone)), $dt);
//America/Vancouver
$localStartDT = new DateTime("2044-01-01 06:30", new DateTimeZone("America/Vancouver"));
$localEndDT = new DateTime("2044-01-01 07:30", new DateTimeZone("America/Vancouver"));
$dt = $method->invokeArgs($this->_showService, array($localStartDT, "01:00"));
$this->assertEquals(array(
$localStartDT->setTimezone($utcTimezone), $localEndDT->setTimezone($utcTimezone)), $dt);
}
}

View File

@ -0,0 +1,51 @@
<?php
Class BlockModelData
{
public static function getCriteriaSingleNewestLabelNada() {
return array(
Array("name" => "sp_type", "value" => 0),
Array("name" => "sp_type", "value" => 0),
Array("name" => "sp_repeat_tracks", "value" => 0),
Array("name" => "sp_sort_options", "value" => "newest"),
Array("name" => "sp_limit_value", "value" => 1),
Array("name" => "sp_limit_options", "value" => "items"),
Array("name" => "sp_criteria_field_0_0", "value" => "label"),
Array("name" => "sp_criteria_modifier_0_0", "value" => "contains"),
Array("name" => "sp_criteria_value_0_0", "value" => "nada"),
Array("name" => "sp_overflow_tracks", "value" => 0),
);
}
public static function getCriteriaMultiTrackAndAlbum1Hour()
{
return array (
Array("name" => "sp_type" , "value" => 1),
Array("name" => "sp_repeat_tracks", "value" => 0),
Array("name" => "sp_sort_options", "value" => "random"),
Array("name" => "sp_limit_value", "value" => 1),
Array("name" => "sp_limit_options", "value" => "hours"),
Array("name" => "sp_overflow_tracks", "value" => 0),
Array("name" => "sp_criteria_field_0_0", "value" => "album_title"),
Array("name" => "sp_criteria_modifier_0_0", "value" => "is"),
Array("name" => "sp_criteria_value_0_0", "value" => "album1"),
Array("name" => "sp_criteria_field_0_1", "value" => "album_title"),
Array("name" => "sp_criteria_modifier_0_1", "value" => "is"),
Array("name" => "sp_criteria_value_0_1", "value" => "album2"),
Array("name" => "sp_criteria_field_1_0", "value" => "track_title"),
Array("name" => "sp_criteria_modifier_1_0", "value" => "is"),
Array("name" => "sp_criteria_value_1_0", "value" => "track1"),
Array("name" => "sp_criteria_field_1_1", "value" => "track_title"),
Array("name" => "sp_criteria_modifier_1_1", "value" => "is"),
Array("name" => "sp_criteria_value_1_1", "value" => "track2"),
Array("name" => "sp_criteria_field_1_2", "value" => "track_title"),
Array("name" => "sp_criteria_modifier_1_2", "value" => "is"),
Array("name" => "sp_criteria_value_1_2", "value" => "track3"),
Array("name" => "sp_criteria_field_2_0", "value" => "length"),
Array("name" => "sp_criteria_modifier_2_0", "value" => "is greater than"),
Array("name" => "sp_criteria_value_2_0", "value" => "00:01:00"),
);
}
}

View File

@ -0,0 +1,513 @@
<?php
Class ShowServiceData
{
//Just a regular show - Non repeating, and not a recording & rebroadcast show.
public static function getNoRepeatNoRRData()
{
return array(
"add_show_id" => -1,
"add_show_instance_id" => -1,
"add_show_name" => "test show",
"add_show_url" => null,
"add_show_genre" => null,
"add_show_description" => null,
"add_show_start_date" => "2044-01-01",
"add_show_start_time" => "00:00",
"add_show_end_date_no_repeat" => "2044-01-01",
"add_show_end_time" => "01:00",
"add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false,
"add_show_autoplaylist_repeat" => false,
"add_show_autoplaylist_id" => null,
"add_show_repeats" => 0,
"add_show_linked" => 0,
"add_show_repeat_type" => 0,
"add_show_monthly_repeat_type" => 2,
"add_show_end_date" => "2044-01-01",
"add_show_no_end" => 1,
"cb_airtime_auth" => 0,
"cb_custom_auth" => 0,
"custom_username" => null,
"custom_password" => null,
"add_show_record" => 0,
"add_show_rebroadcast" => 0,
"add_show_rebroadcast_date_absolute_1" => null,
"add_show_rebroadcast_time_absolute_1" => null,
"add_show_rebroadcast_date_absolute_2" => null,
"add_show_rebroadcast_time_absolute_2" => null,
"add_show_rebroadcast_date_absolute_3" => null,
"add_show_rebroadcast_time_absolute_3" => null,
"add_show_rebroadcast_date_absolute_4" => null,
"add_show_rebroadcast_time_absolute_4" => null,
"add_show_rebroadcast_date_absolute_5" => null,
"add_show_rebroadcast_time_absolute_5" => null,
"add_show_rebroadcast_date_absolute_6" => null,
"add_show_rebroadcast_time_absolute_6" => null,
"add_show_rebroadcast_date_absolute_7" => null,
"add_show_rebroadcast_time_absolute_7" => null,
"add_show_rebroadcast_date_absolute_8" => null,
"add_show_rebroadcast_time_absolute_8" => null,
"add_show_rebroadcast_date_absolute_9" => null,
"add_show_rebroadcast_time_absolute_9" => null,
"add_show_rebroadcast_date_absolute_10" => null,
"add_show_rebroadcast_time_absolute_10" => null,
"add_show_rebroadcast_date_1" => null,
"add_show_rebroadcast_time_1" => null,
"add_show_rebroadcast_date_2" => null,
"add_show_rebroadcast_time_2" => null,
"add_show_rebroadcast_date_3" => null,
"add_show_rebroadcast_time_3" => null,
"add_show_rebroadcast_date_4" => null,
"add_show_rebroadcast_time_4" => null,
"add_show_rebroadcast_date_5" => null,
"add_show_rebroadcast_time_5" => null,
"add_show_rebroadcast_date_6" => null,
"add_show_rebroadcast_time_6" => null,
"add_show_rebroadcast_date_7" => null,
"add_show_rebroadcast_time_7" => null,
"add_show_rebroadcast_date_8" => null,
"add_show_rebroadcast_time_8" => null,
"add_show_rebroadcast_date_9" => null,
"add_show_rebroadcast_time_9" => null,
"add_show_rebroadcast_date_10" => null,
"add_show_rebroadcast_time_10" => null,
"add_show_hosts_autocomplete" => null,
"add_show_background_color" => "364492",
"add_show_color" => "ffffff",
"add_show_hosts" => null,
"add_show_day_check" => null
);
}
public static function getWeeklyRepeatNoEndNoRRData()
{
return array(
"add_show_id" => -1,
"add_show_instance_id" => -1,
"add_show_name" => "test show",
"add_show_url" => null,
"add_show_genre" => null,
"add_show_description" => null,
"add_show_start_date" => "2044-01-01",
"add_show_start_time" => "00:00",
"add_show_end_date_no_repeat" => "2044-01-01",
"add_show_end_time" => "01:00",
"add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false,
"add_show_autoplaylist_repeat" => false,
"add_show_autoplaylist_id" => null,
"add_show_repeats" => 1,
"add_show_linked" => 0,
"add_show_repeat_type" => 0,
"add_show_monthly_repeat_type" => 2,
"add_show_end_date" => "2044-01-01",
"add_show_no_end" => 1,
"cb_airtime_auth" => 0,
"cb_custom_auth" => 0,
"custom_username" => null,
"custom_password" => null,
"add_show_record" => 0,
"add_show_rebroadcast" => 0,
"add_show_rebroadcast_date_absolute_1" => null,
"add_show_rebroadcast_time_absolute_1" => null,
"add_show_rebroadcast_date_absolute_2" => null,
"add_show_rebroadcast_time_absolute_2" => null,
"add_show_rebroadcast_date_absolute_3" => null,
"add_show_rebroadcast_time_absolute_3" => null,
"add_show_rebroadcast_date_absolute_4" => null,
"add_show_rebroadcast_time_absolute_4" => null,
"add_show_rebroadcast_date_absolute_5" => null,
"add_show_rebroadcast_time_absolute_5" => null,
"add_show_rebroadcast_date_absolute_6" => null,
"add_show_rebroadcast_time_absolute_6" => null,
"add_show_rebroadcast_date_absolute_7" => null,
"add_show_rebroadcast_time_absolute_7" => null,
"add_show_rebroadcast_date_absolute_8" => null,
"add_show_rebroadcast_time_absolute_8" => null,
"add_show_rebroadcast_date_absolute_9" => null,
"add_show_rebroadcast_time_absolute_9" => null,
"add_show_rebroadcast_date_absolute_10" => null,
"add_show_rebroadcast_time_absolute_10" => null,
"add_show_rebroadcast_date_1" => null,
"add_show_rebroadcast_time_1" => null,
"add_show_rebroadcast_date_2" => null,
"add_show_rebroadcast_time_2" => null,
"add_show_rebroadcast_date_3" => null,
"add_show_rebroadcast_time_3" => null,
"add_show_rebroadcast_date_4" => null,
"add_show_rebroadcast_time_4" => null,
"add_show_rebroadcast_date_5" => null,
"add_show_rebroadcast_time_5" => null,
"add_show_rebroadcast_date_6" => null,
"add_show_rebroadcast_time_6" => null,
"add_show_rebroadcast_date_7" => null,
"add_show_rebroadcast_time_7" => null,
"add_show_rebroadcast_date_8" => null,
"add_show_rebroadcast_time_8" => null,
"add_show_rebroadcast_date_9" => null,
"add_show_rebroadcast_time_9" => null,
"add_show_rebroadcast_date_10" => null,
"add_show_rebroadcast_time_10" => null,
"add_show_hosts_autocomplete" => null,
"add_show_background_color" => "364492",
"add_show_color" => "ffffff",
"add_show_hosts" => null,
"add_show_day_check" => array(5)
);
}
public static function getWeeklyRepeatWithEndNoRRData()
{
return array(
"add_show_id" => -1,
"add_show_instance_id" => -1,
"add_show_name" => "test show",
"add_show_url" => null,
"add_show_genre" => null,
"add_show_description" => null,
"add_show_start_date" => "2044-01-01",
"add_show_start_time" => "00:00",
"add_show_end_date_no_repeat" => "2044-01-01",
"add_show_end_time" => "01:00",
"add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false,
"add_show_autoplaylist_repeat" => false,
"add_show_autoplaylist_id" => null,
"add_show_repeats" => 1,
"add_show_linked" => 0,
"add_show_repeat_type" => 0,
"add_show_monthly_repeat_type" => 2,
"add_show_end_date" => "2044-01-26",
"add_show_no_end" => 0,
"cb_airtime_auth" => 0,
"cb_custom_auth" => 0,
"custom_username" => null,
"custom_password" => null,
"add_show_record" => 0,
"add_show_rebroadcast" => 0,
"add_show_rebroadcast_date_absolute_1" => null,
"add_show_rebroadcast_time_absolute_1" => null,
"add_show_rebroadcast_date_absolute_2" => null,
"add_show_rebroadcast_time_absolute_2" => null,
"add_show_rebroadcast_date_absolute_3" => null,
"add_show_rebroadcast_time_absolute_3" => null,
"add_show_rebroadcast_date_absolute_4" => null,
"add_show_rebroadcast_time_absolute_4" => null,
"add_show_rebroadcast_date_absolute_5" => null,
"add_show_rebroadcast_time_absolute_5" => null,
"add_show_rebroadcast_date_absolute_6" => null,
"add_show_rebroadcast_time_absolute_6" => null,
"add_show_rebroadcast_date_absolute_7" => null,
"add_show_rebroadcast_time_absolute_7" => null,
"add_show_rebroadcast_date_absolute_8" => null,
"add_show_rebroadcast_time_absolute_8" => null,
"add_show_rebroadcast_date_absolute_9" => null,
"add_show_rebroadcast_time_absolute_9" => null,
"add_show_rebroadcast_date_absolute_10" => null,
"add_show_rebroadcast_time_absolute_10" => null,
"add_show_rebroadcast_date_1" => null,
"add_show_rebroadcast_time_1" => null,
"add_show_rebroadcast_date_2" => null,
"add_show_rebroadcast_time_2" => null,
"add_show_rebroadcast_date_3" => null,
"add_show_rebroadcast_time_3" => null,
"add_show_rebroadcast_date_4" => null,
"add_show_rebroadcast_time_4" => null,
"add_show_rebroadcast_date_5" => null,
"add_show_rebroadcast_time_5" => null,
"add_show_rebroadcast_date_6" => null,
"add_show_rebroadcast_time_6" => null,
"add_show_rebroadcast_date_7" => null,
"add_show_rebroadcast_time_7" => null,
"add_show_rebroadcast_date_8" => null,
"add_show_rebroadcast_time_8" => null,
"add_show_rebroadcast_date_9" => null,
"add_show_rebroadcast_time_9" => null,
"add_show_rebroadcast_date_10" => null,
"add_show_rebroadcast_time_10" => null,
"add_show_hosts_autocomplete" => null,
"add_show_background_color" => "364492",
"add_show_color" => "ffffff",
"add_show_hosts" => null,
"add_show_day_check" => array(5)
);
}
public static function getWeeklyRepeatDays()
{
return array(1,2,3,4,5);
}
public static function getDailyRepeatDays()
{
return array(0,1,2,3,4,5,6);
}
public static function getEditRepeatInstanceData()
{
return array(
"add_show_id" => 1,
"add_show_instance_id" => 2,
"add_show_name" => "test show",
"add_show_instance_description" => "",
"add_show_url" => null,
"add_show_genre" => null,
"add_show_description" => null,
"add_show_start_date" => "2044-01-08",
"add_show_start_time" => "01:00",
"add_show_end_date_no_repeat" => "2044-01-08",
"add_show_end_time" => "02:00",
"add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false,
"add_show_autoplaylist_repeat" => false,
"add_show_autoplaylist_id" => null,
"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
);
}
public static function getOverlappingShowCheckTestData()
{
return array(
"add_show_id" => -1,
"add_show_instance_id" => -1,
"add_show_name" => "test show",
"add_show_url" => null,
"add_show_genre" => null,
"add_show_description" => null,
"add_show_start_date" => "2014-01-05",
"add_show_start_time" => "00:00",
"add_show_end_date_no_repeat" => "2014-01-05",
"add_show_end_time" => "01:00",
"add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false,
"add_show_autoplaylist_repeat" => false,
"add_show_autoplaylist_id" => null,
"add_show_repeats" => 1,
"add_show_linked" => 0,
"add_show_repeat_type" => 0,
"add_show_monthly_repeat_type" => 2,
"add_show_end_date" => "2014-01-05",
"add_show_no_end" => 1,
"cb_airtime_auth" => 0,
"cb_custom_auth" => 0,
"custom_username" => null,
"custom_password" => null,
"add_show_record" => 0,
"add_show_rebroadcast" => 0,
"add_show_rebroadcast_date_absolute_1" => null,
"add_show_rebroadcast_time_absolute_1" => null,
"add_show_rebroadcast_date_absolute_2" => null,
"add_show_rebroadcast_time_absolute_2" => null,
"add_show_rebroadcast_date_absolute_3" => null,
"add_show_rebroadcast_time_absolute_3" => null,
"add_show_rebroadcast_date_absolute_4" => null,
"add_show_rebroadcast_time_absolute_4" => null,
"add_show_rebroadcast_date_absolute_5" => null,
"add_show_rebroadcast_time_absolute_5" => null,
"add_show_rebroadcast_date_absolute_6" => null,
"add_show_rebroadcast_time_absolute_6" => null,
"add_show_rebroadcast_date_absolute_7" => null,
"add_show_rebroadcast_time_absolute_7" => null,
"add_show_rebroadcast_date_absolute_8" => null,
"add_show_rebroadcast_time_absolute_8" => null,
"add_show_rebroadcast_date_absolute_9" => null,
"add_show_rebroadcast_time_absolute_9" => null,
"add_show_rebroadcast_date_absolute_10" => null,
"add_show_rebroadcast_time_absolute_10" => null,
"add_show_rebroadcast_date_1" => null,
"add_show_rebroadcast_time_1" => null,
"add_show_rebroadcast_date_2" => null,
"add_show_rebroadcast_time_2" => null,
"add_show_rebroadcast_date_3" => null,
"add_show_rebroadcast_time_3" => null,
"add_show_rebroadcast_date_4" => null,
"add_show_rebroadcast_time_4" => null,
"add_show_rebroadcast_date_5" => null,
"add_show_rebroadcast_time_5" => null,
"add_show_rebroadcast_date_6" => null,
"add_show_rebroadcast_time_6" => null,
"add_show_rebroadcast_date_7" => null,
"add_show_rebroadcast_time_7" => null,
"add_show_rebroadcast_date_8" => null,
"add_show_rebroadcast_time_8" => null,
"add_show_rebroadcast_date_9" => null,
"add_show_rebroadcast_time_9" => null,
"add_show_rebroadcast_date_10" => null,
"add_show_rebroadcast_time_10" => null,
"add_show_hosts_autocomplete" => null,
"add_show_background_color" => "364492",
"add_show_color" => "ffffff",
"add_show_hosts" => null,
"add_show_day_check" => array(0,1,2,3,4,5,6)
);
}
/** Returns form data for a non-repeating, record and rebroadcast(RR) show **/
public static function getNoRepeatRRData()
{
return array(
"add_show_id" => -1,
"add_show_instance_id" => -1,
"add_show_name" => "test show",
"add_show_url" => null,
"add_show_genre" => null,
"add_show_description" => null,
"add_show_start_date" => "2044-01-01",
"add_show_start_time" => "00:00",
"add_show_end_date_no_repeat" => "2044-01-01",
"add_show_end_time" => "01:00",
"add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false,
"add_show_autoplaylist_repeat" => false,
"add_show_autoplaylist_id" => null,
"add_show_repeats" => 0,
"add_show_linked" => 0,
"add_show_repeat_type" => 0,
"add_show_monthly_repeat_type" => 2,
"add_show_end_date" => "2044-01-01",
"add_show_no_end" => 1,
"cb_airtime_auth" => 0,
"cb_custom_auth" => 0,
"custom_username" => null,
"custom_password" => null,
"add_show_record" => 1,
"add_show_rebroadcast" => 1,
"add_show_rebroadcast_date_absolute_1" => "2044-01-02",
"add_show_rebroadcast_time_absolute_1" => "00:00",
"add_show_rebroadcast_date_absolute_2" => "2044-01-03",
"add_show_rebroadcast_time_absolute_2" => "00:00",
"add_show_rebroadcast_date_absolute_3" => "2044-01-04",
"add_show_rebroadcast_time_absolute_3" => "00:00",
"add_show_rebroadcast_date_absolute_4" => "2044-01-05",
"add_show_rebroadcast_time_absolute_4" => "00:00",
"add_show_rebroadcast_date_absolute_5" => "2044-01-06",
"add_show_rebroadcast_time_absolute_5" => "00:00",
"add_show_rebroadcast_date_absolute_6" => "2044-01-07",
"add_show_rebroadcast_time_absolute_6" => "00:00",
"add_show_rebroadcast_date_absolute_7" => "2044-01-08",
"add_show_rebroadcast_time_absolute_7" => "00:00",
"add_show_rebroadcast_date_absolute_8" => "2044-01-09",
"add_show_rebroadcast_time_absolute_8" => "00:00",
"add_show_rebroadcast_date_absolute_9" => "2044-01-10",
"add_show_rebroadcast_time_absolute_9" => "00:00",
"add_show_rebroadcast_date_absolute_10" => "2044-01-11",
"add_show_rebroadcast_time_absolute_10" => "00:00",
"add_show_rebroadcast_date_1" => null,
"add_show_rebroadcast_time_1" => null,
"add_show_rebroadcast_date_2" => null,
"add_show_rebroadcast_time_2" => null,
"add_show_rebroadcast_date_3" => null,
"add_show_rebroadcast_time_3" => null,
"add_show_rebroadcast_date_4" => null,
"add_show_rebroadcast_time_4" => null,
"add_show_rebroadcast_date_5" => null,
"add_show_rebroadcast_time_5" => null,
"add_show_rebroadcast_date_6" => null,
"add_show_rebroadcast_time_6" => null,
"add_show_rebroadcast_date_7" => null,
"add_show_rebroadcast_time_7" => null,
"add_show_rebroadcast_date_8" => null,
"add_show_rebroadcast_time_8" => null,
"add_show_rebroadcast_date_9" => null,
"add_show_rebroadcast_time_9" => null,
"add_show_rebroadcast_date_10" => null,
"add_show_rebroadcast_time_10" => null,
"add_show_hosts_autocomplete" => null,
"add_show_background_color" => "364492",
"add_show_color" => "ffffff",
"add_show_hosts" => null,
"add_show_day_check" => null
);
}
public static function getWeeklyRepeatRRData()
{
return array(
"add_show_id" => -1,
"add_show_instance_id" => -1,
"add_show_name" => "test show",
"add_show_url" => null,
"add_show_genre" => null,
"add_show_description" => null,
"add_show_start_date" => "2044-01-01",
"add_show_start_time" => "00:00",
"add_show_end_date_no_repeat" => "2044-01-01",
"add_show_end_time" => "01:00",
"add_show_duration" => "01h 00m",
"add_show_timezone" => "UTC",
"add_show_has_autoplaylist" => false,
"add_show_autoplaylist_repeat" => false,
"add_show_autoplaylist_id" => null,
"add_show_repeats" => 1,
"add_show_linked" => 0,
"add_show_repeat_type" => 0,
"add_show_monthly_repeat_type" => 2,
"add_show_end_date" => "2044-01-01",
"add_show_no_end" => 1,
"cb_airtime_auth" => 0,
"cb_custom_auth" => 0,
"custom_username" => null,
"custom_password" => null,
"add_show_record" => 1,
"add_show_rebroadcast" => 1,
"add_show_rebroadcast_date_absolute_1" => null,
"add_show_rebroadcast_time_absolute_1" => null,
"add_show_rebroadcast_date_absolute_2" => null,
"add_show_rebroadcast_time_absolute_2" => null,
"add_show_rebroadcast_date_absolute_3" => null,
"add_show_rebroadcast_time_absolute_3" => null,
"add_show_rebroadcast_date_absolute_4" => null,
"add_show_rebroadcast_time_absolute_4" => null,
"add_show_rebroadcast_date_absolute_5" => null,
"add_show_rebroadcast_time_absolute_5" => null,
"add_show_rebroadcast_date_absolute_6" => null,
"add_show_rebroadcast_time_absolute_6" => null,
"add_show_rebroadcast_date_absolute_7" => null,
"add_show_rebroadcast_time_absolute_7" => null,
"add_show_rebroadcast_date_absolute_8" => null,
"add_show_rebroadcast_time_absolute_8" => null,
"add_show_rebroadcast_date_absolute_9" => null,
"add_show_rebroadcast_time_absolute_9" => null,
"add_show_rebroadcast_date_absolute_10" => null,
"add_show_rebroadcast_time_absolute_10" => null,
"add_show_rebroadcast_date_1" => "1 days",
"add_show_rebroadcast_time_1" => "00:00",
"add_show_rebroadcast_date_2" => "2 days",
"add_show_rebroadcast_time_2" => "12:00",
"add_show_rebroadcast_date_3" => null,
"add_show_rebroadcast_time_3" => null,
"add_show_rebroadcast_date_4" => null,
"add_show_rebroadcast_time_4" => null,
"add_show_rebroadcast_date_5" => null,
"add_show_rebroadcast_time_5" => null,
"add_show_rebroadcast_date_6" => null,
"add_show_rebroadcast_time_6" => null,
"add_show_rebroadcast_date_7" => null,
"add_show_rebroadcast_time_7" => null,
"add_show_rebroadcast_date_8" => null,
"add_show_rebroadcast_time_8" => null,
"add_show_rebroadcast_date_9" => null,
"add_show_rebroadcast_time_9" => null,
"add_show_rebroadcast_date_10" => null,
"add_show_rebroadcast_time_10" => null,
"add_show_hosts_autocomplete" => null,
"add_show_background_color" => "364492",
"add_show_color" => "ffffff",
"add_show_hosts" => null,
"add_show_day_check" => array(5)
);
}
}

View File

@ -0,0 +1,51 @@
[database]
host = localhost
dbname = libretime_test
dbuser = libretime
dbpass = libretime
[rabbitmq]
host = 127.0.0.1
port = 5672
user = airtime_tests
password = airtime_tests
vhost = /airtime_tests
[general]
dev_env = testing
api_key = H2NRICX6CM8F50CU123C
web_server_user = www-data
airtime_dir = /usr/share/airtime
base_url = localhost
base_port = 80
base_dir = /
cache_ahead_hours = 1
station_id = teststation
[current_backend]
storage_backend=file
[monit]
monit_user = guest
monit_password = airtime
[soundcloud]
connection_retries = 3
time_between_retries = 60
soundcloud_client_id = 0
soundcloud_client_secret = 0
soundcloud_redirect_uri = http://soundcloud.example.org/redirect
[ldap]
hostname = ldap.example.org
binddn = 'uid=libretime,cn=sysaccounts,cn=etc,dc=int,dc=example,dc=org'
password = hackme
account_domain = INT.EXAMPLE.ORG
basedn = 'cn=users,cn=accounts,dc=int,dc=example,dc=org'
filter_field = uid
groupmap_guest = 'cn=guest,cn=groups,cn=accounts,dc=int,dc=example,dc=org'
groupmap_host = 'cn=host,cn=groups,cn=accounts,dc=int,dc=example,dc=org'
groupmap_program_manager = 'cn=program_manager,cn=groups,cn=accounts,dc=int,dc=example,dc=org'
groupmap_admin = 'cn=admins,cn=groups,cn=accounts,dc=int,dc=example,dc=org'
groupmap_superadmin = 'cn=superadmin,cn=groups,cn=accounts,dc=int,dc=example,dc=org'

View File

@ -0,0 +1,35 @@
[database]
host = localhost
dbname = libretime_test
dbuser = libretime
dbpass = libretime
[rabbitmq]
host = 127.0.0.1
port = 5672
user = airtime_tests
password = airtime_tests
vhost = /airtime_tests
[general]
dev_env = testing
api_key = H2NRICX6CM8F50CU123C
web_server_user = www-data
airtime_dir = /usr/share/airtime
base_url = localhost
base_port = 80
base_dir = /
cache_ahead_hours = 1
station_id = teststation
[monit]
monit_user = guest
monit_password = airtime
[soundcloud]
connection_retries = 3
time_between_retries = 60
soundcloud_client_id = 0
soundcloud_client_secret = 0
soundcloud_redirect_uri = http://soundcloud.example.org/redirect

View File

View File

@ -0,0 +1,30 @@
<phpunit bootstrap="./application/bootstrap.php" colors="true">
<testsuite name="My Application Tests">
<directory>./</directory>
</testsuite>
<filter>
<whitelist>
<directory suffix=".php">../application/</directory>
<exclude>
<directory suffix=".phtml">../application/</directory>
<file>../application/Bootstrap.php</file>
<file>../application/controllers/ErrorController.php</file>
</exclude>
</whitelist>
</filter>
<php>
<env name="ENVIRONMENT" value="testing"/>
<env name="AIRTIME_UNIT_TEST" value="1"/>
<env name="LIBRETIME_CONF_DIR" value="./conf"/>
<env name="LIBRETIME_LOG_DIR" value="./log"/>
</php>
<!-- Disabling broken code coverage report. It's not using our autoloader for some reason...
<logging>
<log type="coverage-html" target="./log/report" charset="UTF-8" yui="true" hightlight="true" lowupperbound="50" highlowerbound="80">
<log type="testdox" target="./log/testdox.html">
</log></log></logging>
-->
</phpunit>

37
airtime_mvc/tests/runtests.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
#Create a RabbitMQ airtime_tests user
#This is necessary for tests to run
rabbitmqctl start_app
RABBITMQ_VHOST="/airtime_tests"
RABBITMQ_USER="airtime_tests"
RABBITMQ_PASSWORD="airtime_tests"
EXCHANGES="airtime-pypo|pypo-fetch|airtime-analyzer|media-monitor"
rabbitmqctl list_vhosts | grep $RABBITMQ_VHOST
RESULT="$?"
if [ $RESULT = "0" ]; then
rabbitmqctl delete_vhost $RABBITMQ_VHOST
rabbitmqctl delete_user $RABBITMQ_USER
fi
rabbitmqctl add_vhost $RABBITMQ_VHOST
rabbitmqctl add_user $RABBITMQ_USER $RABBITMQ_PASSWORD
rabbitmqctl set_permissions -p $RABBITMQ_VHOST $RABBITMQ_USER "$EXCHANGES" "$EXCHANGES" "$EXCHANGES"
export RABBITMQ_USER
export RABBITMQ_PASSWORD
export RABBITMQ_VHOST
export AIRTIME_UNIT_TEST="1"
#Change the working directory to this script's directory
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR
#Run the unit tests
phpunit --verbose --log-junit test_results.xml