style(legacy): fix code format with php-cs-fixer (#1674)
This commit is contained in:
parent
e1dc69af9e
commit
69d8eae845
111 changed files with 1163 additions and 1163 deletions
|
@ -38,28 +38,28 @@ Logging::setLogPath(LIBRETIME_LOG_FILEPATH);
|
|||
|
||||
set_include_path(APPLICATION_PATH . '/common' . PATH_SEPARATOR . get_include_path());
|
||||
|
||||
//Propel classes.
|
||||
// Propel classes.
|
||||
set_include_path(APPLICATION_PATH . '/models' . PATH_SEPARATOR . get_include_path());
|
||||
|
||||
//Services
|
||||
// Services
|
||||
set_include_path(APPLICATION_PATH . '/services' . PATH_SEPARATOR . get_include_path());
|
||||
|
||||
//models
|
||||
// models
|
||||
set_include_path(APPLICATION_PATH . '/models' . PATH_SEPARATOR . get_include_path());
|
||||
|
||||
//Controllers.
|
||||
// Controllers.
|
||||
set_include_path(APPLICATION_PATH . '/controllers' . PATH_SEPARATOR . get_include_path());
|
||||
|
||||
//Controller plugins.
|
||||
// Controller plugins.
|
||||
set_include_path(APPLICATION_PATH . '/controllers/plugins' . PATH_SEPARATOR . get_include_path());
|
||||
|
||||
//test data
|
||||
// test data
|
||||
set_include_path(APPLICATION_PATH . '/../tests/application/testdata' . PATH_SEPARATOR . get_include_path());
|
||||
|
||||
//helper functions
|
||||
// helper functions
|
||||
set_include_path(APPLICATION_PATH . '/../tests/application/helpers' . PATH_SEPARATOR . get_include_path());
|
||||
|
||||
//cloud storage files
|
||||
// cloud storage files
|
||||
set_include_path(APPLICATION_PATH . '/cloud_storage' . PATH_SEPARATOR . get_include_path());
|
||||
|
||||
require_once 'jooola/propel1/runtime/lib/Propel.php';
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
set_include_path(__DIR__ . '/../../legacy/library' . PATH_SEPARATOR . get_include_path());
|
||||
|
||||
//require_once('Zend/Loader/Autoloader.php');
|
||||
// require_once('Zend/Loader/Autoloader.php');
|
||||
class AirtimeInstall
|
||||
{
|
||||
public const CONF_DIR_BINARIES = '/usr/lib/airtime';
|
||||
|
@ -59,12 +59,12 @@ class AirtimeInstall
|
|||
$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.
|
||||
// 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 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
|
||||
|
@ -215,7 +215,7 @@ class AirtimeInstall
|
|||
{
|
||||
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";
|
||||
// $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 = ['schema.sql', 'sequences.sql', 'views.sql', 'triggers.sql', 'defaultdata.sql'];
|
||||
foreach ($files as $f) {
|
||||
|
|
|
@ -6,17 +6,17 @@ class TestHelper
|
|||
{
|
||||
$authAdapter = Application_Model_Auth::getAuthAdapter();
|
||||
|
||||
//pass to the adapter the submitted username and password
|
||||
// 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
|
||||
// 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
|
||||
// the default storage is a session with namespace Zend_Auth
|
||||
$authStorage = $auth->getStorage();
|
||||
$authStorage->write($userInfo);
|
||||
}
|
||||
|
@ -39,8 +39,8 @@ class TestHelper
|
|||
|
||||
public static function installTestDatabase()
|
||||
{
|
||||
//We need to load the config before our app bootstrap runs. The config
|
||||
//is normally
|
||||
// We need to load the config before our app bootstrap runs. The config
|
||||
// is normally
|
||||
$CC_CONFIG = Config::getConfig();
|
||||
|
||||
$dbhost = $CC_CONFIG['dsn']['host'];
|
||||
|
@ -51,7 +51,7 @@ class TestHelper
|
|||
|
||||
$databaseAlreadyExists = AirtimeInstall::createDatabase();
|
||||
if ($databaseAlreadyExists) {
|
||||
//Truncate all the tables
|
||||
// Truncate all the tables
|
||||
$con = Propel::getConnection();
|
||||
$sql = "select * from pg_tables where tableowner = '{$dbuser}'";
|
||||
|
||||
|
@ -61,7 +61,7 @@ class TestHelper
|
|||
$rows = [];
|
||||
}
|
||||
|
||||
//Add any tables that shouldn't be cleared here.
|
||||
// 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
|
||||
|
@ -74,23 +74,23 @@ class TestHelper
|
|||
if (in_array($tablename, $tablesToNotClear)) {
|
||||
continue;
|
||||
}
|
||||
//echo " * Clearing database table $tablename...";
|
||||
// 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";
|
||||
// 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
|
||||
// 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:
|
||||
// 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')";
|
||||
|
@ -106,9 +106,9 @@ class TestHelper
|
|||
|
||||
$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.
|
||||
// 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 {
|
||||
|
@ -124,7 +124,7 @@ class TestHelper
|
|||
}
|
||||
$con->commit();
|
||||
} else {
|
||||
//Create all the database tables
|
||||
// Create all the database tables
|
||||
AirtimeInstall::CreateDatabaseTables($dbuser, $dbpasswd, $dbname, $dbhost, $dbport);
|
||||
AirtimeInstall::UpdateDatabaseTables();
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
class BlockDbTest extends Zend_Test_PHPUnit_DatabaseTestCase //PHPUnit_Framework_TestCase
|
||||
class BlockDbTest extends Zend_Test_PHPUnit_DatabaseTestCase // PHPUnit_Framework_TestCase
|
||||
{
|
||||
private $_connectionMock;
|
||||
|
||||
|
@ -60,7 +60,7 @@ class BlockDbTest extends Zend_Test_PHPUnit_DatabaseTestCase //PHPUnit_Framework
|
|||
$bltest = new Application_Model_Block();
|
||||
$bltest->saveSmartBlockCriteria($testCriteria);
|
||||
$tracks = $bltest->getListOfFilesUnderLimit();
|
||||
//$tracks = $bltest->getLength();
|
||||
// $tracks = $bltest->getLength();
|
||||
$this->assertNotEmpty($tracks);
|
||||
// need to load a example criteria into the database
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ class BlockDbTest extends Zend_Test_PHPUnit_DatabaseTestCase //PHPUnit_Framework
|
|||
$bltest = new Application_Model_Block();
|
||||
$bltest->saveSmartBlockCriteria($testCriteria);
|
||||
$tracks = $bltest->getListOfFilesUnderLimit();
|
||||
//$tracks = $bltest->getLength();
|
||||
// $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
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
class ScheduleUnitTest extends Zend_Test_PHPUnit_ControllerTestCase //PHPUnit_Framework_TestCase
|
||||
class ScheduleUnitTest extends Zend_Test_PHPUnit_ControllerTestCase // PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
|
@ -26,23 +26,23 @@ class ScheduleUnitTest extends Zend_Test_PHPUnit_ControllerTestCase //PHPUnit_Fr
|
|||
$testShowData = ShowServiceData::getNoRepeatNoRRData();
|
||||
$showService = new Application_Service_ShowService();
|
||||
$futureDate = new DateTime();
|
||||
$futureDate->add(new DateInterval('P1Y')); //1 year into the future
|
||||
$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.
|
||||
// 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.
|
||||
$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
|
||||
// $showService->setCcShow($testShowData); //Denise says this is not needed.
|
||||
$showService->addUpdateShow($testShowData); // Create show instances
|
||||
|
||||
// Moved creation of stor directory to TestHelper for setup
|
||||
|
||||
|
@ -57,23 +57,23 @@ class ScheduleUnitTest extends Zend_Test_PHPUnit_ControllerTestCase //PHPUnit_Fr
|
|||
'MDATA_KEY_DURATION' => '00:01:00',
|
||||
'is_record' => false, ];
|
||||
|
||||
//Create the file in the database via the HTTP API.
|
||||
// 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
|
||||
// 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.
|
||||
// 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. :-)
|
||||
// Test the function we actually want to test. :-)
|
||||
$this->assertEquals($scheduleModel->IsFileScheduledInTheFuture($fileId), true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,14 +17,14 @@ require_once '../application/configs/conf.php';
|
|||
class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase
|
||||
{
|
||||
private $_connectionMock;
|
||||
//private $_nowDT;
|
||||
// private $_nowDT;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
TestHelper::installTestDatabase();
|
||||
TestHelper::setupZendBootstrap();
|
||||
|
||||
//$this->_nowDT = new DateTime("now", new DateTimeZone("UTC"));
|
||||
// $this->_nowDT = new DateTime("now", new DateTimeZone("UTC"));
|
||||
|
||||
parent::setUp();
|
||||
}
|
||||
|
@ -308,11 +308,11 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase
|
|||
|
||||
$service_show = new Application_Service_ShowService(null, $data);
|
||||
$service_show->addUpdateShow($data);
|
||||
//delete some single instances first
|
||||
// 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
|
||||
// delete all instances including and after where id=4
|
||||
$service_show->deleteShow(4);
|
||||
|
||||
$ds = new Zend_Test_PHPUnit_Db_DataSet_QueryDataSet(
|
||||
|
@ -338,10 +338,10 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase
|
|||
$showService = new Application_Service_ShowService(null, $data);
|
||||
|
||||
$showService->addUpdateShow($data);
|
||||
//move the start date forward one week and the start time forward one hour
|
||||
// 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
|
||||
// need to create a new service so it gets constructed with the new data
|
||||
$showService = new Application_Service_ShowService(null, $editData);
|
||||
$showService->editRepeatingShowInstance($editData);
|
||||
|
||||
|
@ -398,7 +398,7 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase
|
|||
|
||||
$showService->addUpdateShow($data);
|
||||
|
||||
//simulate the user moves forward in the calendar
|
||||
// simulate the user moves forward in the calendar
|
||||
$end = new DateTime('2044-03-12', new DateTimeZone('UTC'));
|
||||
$showService->delegateInstanceCreation(null, $end, true);
|
||||
|
||||
|
@ -515,7 +515,7 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase
|
|||
$showService = new Application_Service_ShowService(null, $data);
|
||||
$showService->addUpdateShow($data);
|
||||
|
||||
//insert some fake tracks into cc_schedule table
|
||||
// insert some fake tracks into cc_schedule table
|
||||
$ccFiles = new CcFiles();
|
||||
$ccFiles
|
||||
->setDbCueIn('00:00:00')
|
||||
|
@ -538,7 +538,7 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase
|
|||
$scheduler = new Application_Model_Scheduler();
|
||||
$scheduler->scheduleAfter($scheduleItems, $mediaItems);
|
||||
|
||||
//delete the first repeat day
|
||||
// delete the first repeat day
|
||||
$data['add_show_day_check'] = [6];
|
||||
$data['add_show_id'] = 1;
|
||||
$showService = new Application_Service_ShowService(null, $data, true);
|
||||
|
@ -572,7 +572,7 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase
|
|||
$showService = new Application_Service_ShowService(null, $data);
|
||||
$showService->addUpdateShow($data);
|
||||
|
||||
//insert some fake tracks into cc_schedule table
|
||||
// insert some fake tracks into cc_schedule table
|
||||
$ccFiles = new CcFiles();
|
||||
$ccFiles
|
||||
->setDbCueIn('00:00:00')
|
||||
|
@ -595,7 +595,7 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase
|
|||
$scheduler = new Application_Model_Scheduler();
|
||||
$scheduler->scheduleAfter($scheduleItems, $mediaItems);
|
||||
|
||||
//delete the first repeat day
|
||||
// delete the first repeat day
|
||||
$data['add_show_day_check'] = [6];
|
||||
$data['add_show_id'] = 1;
|
||||
$showService = new Application_Service_ShowService(null, $data, true);
|
||||
|
@ -622,7 +622,7 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase
|
|||
{
|
||||
TestHelper::loginUser();
|
||||
|
||||
//test change repeat type from weekly to no-repeat
|
||||
// test change repeat type from weekly to no-repeat
|
||||
$data = ShowServiceData::getWeeklyRepeatNoEndNoRRData();
|
||||
$showService = new Application_Service_ShowService(null, $data);
|
||||
$showService->addUpdateShow($data);
|
||||
|
@ -652,7 +652,7 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase
|
|||
{
|
||||
TestHelper::loginUser();
|
||||
|
||||
//test change repeat type weekly to bi-weekly
|
||||
// test change repeat type weekly to bi-weekly
|
||||
$data = ShowServiceData::getWeeklyRepeatNoEndNoRRData();
|
||||
$showService = new Application_Service_ShowService(null, $data);
|
||||
$showService->addUpdateShow($data);
|
||||
|
|
|
@ -105,7 +105,7 @@ class ShowServiceUnitTest extends PHPUnit_Framework_TestCase
|
|||
|
||||
$utcTimezone = new DateTimeZone('UTC');
|
||||
|
||||
//America/Toronto
|
||||
// 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'));
|
||||
|
||||
|
@ -113,7 +113,7 @@ class ShowServiceUnitTest extends PHPUnit_Framework_TestCase
|
|||
$this->assertEquals([
|
||||
$localStartDT->setTimezone($utcTimezone), $localEndDT->setTimezone($utcTimezone), ], $dt);
|
||||
|
||||
//America/Toronto with offset for rebroadcast shows
|
||||
// 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'));
|
||||
|
||||
|
@ -125,7 +125,7 @@ class ShowServiceUnitTest extends PHPUnit_Framework_TestCase
|
|||
$this->assertEquals([
|
||||
$localRebroadcastStartDT->setTimezone($utcTimezone), $localRebroadcastEndDT->setTimezone($utcTimezone), ], $dt);
|
||||
|
||||
//Australia/Brisbane
|
||||
// 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'));
|
||||
|
||||
|
@ -133,7 +133,7 @@ class ShowServiceUnitTest extends PHPUnit_Framework_TestCase
|
|||
$this->assertEquals([
|
||||
$localStartDT->setTimezone($utcTimezone), $localEndDT->setTimezone($utcTimezone), ], $dt);
|
||||
|
||||
//America/Vancouver
|
||||
// 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'));
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
class ShowServiceData
|
||||
{
|
||||
//Just a regular show - Non repeating, and not a recording & rebroadcast show.
|
||||
// Just a regular show - Non repeating, and not a recording & rebroadcast show.
|
||||
public static function getNoRepeatNoRRData()
|
||||
{
|
||||
return [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue