CC-5651: Unit Test the Scheduler
Moved common database setup functions to helper class
This commit is contained in:
parent
3826a88d1f
commit
fc4dfd5cb0
2 changed files with 34 additions and 25 deletions
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
require_once "AirtimeInstall.php";
|
||||
|
||||
class TestHelper
|
||||
{
|
||||
public static function loginUser()
|
||||
|
@ -20,4 +22,32 @@ class TestHelper
|
|||
$authStorage->write($userInfo);
|
||||
}
|
||||
}
|
||||
|
||||
public static function getDbZendConfig()
|
||||
{
|
||||
return new Zend_Config(
|
||||
array(
|
||||
'host' => '127.0.0.1',
|
||||
'dbname' => 'airtime_test',
|
||||
'username' => 'airtime',
|
||||
'password' => 'airtime'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
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'];
|
||||
|
||||
AirtimeInstall::createDatabase();
|
||||
AirtimeInstall::createDatabaseTables($dbuser, $dbpasswd, $dbname, $dbhost);
|
||||
AirtimeInstall::SetDefaultTimezone();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue