style(legacy): fix code format with php-cs-fixer (#1674)

This commit is contained in:
Jonas L 2022-03-14 11:15:04 +01:00 committed by GitHub
parent e1dc69af9e
commit 69d8eae845
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
111 changed files with 1163 additions and 1163 deletions

View file

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