CC-5651: Unit Test the Scheduler
* Added runtests.sh script for unit tests * Use the airtime_test database config in Config.php, propel * First unit test passes! :-)
This commit is contained in:
parent
298a9e6b7c
commit
fea3f4073a
|
@ -18,8 +18,13 @@ class Config {
|
||||||
"rootDir" => __DIR__."/../.."
|
"rootDir" => __DIR__."/../.."
|
||||||
);
|
);
|
||||||
|
|
||||||
$filename = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf";
|
//In the unit testing environment, we always want to use our local airtime.conf in airtime_mvc/application/test:
|
||||||
|
if (getenv('AIRTIME_UNIT_TEST') == '1') {
|
||||||
|
$filename = "airtime.conf";
|
||||||
|
} else {
|
||||||
|
$filename = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf";
|
||||||
|
}
|
||||||
|
|
||||||
$values = parse_ini_file($filename, true);
|
$values = parse_ini_file($filename, true);
|
||||||
|
|
||||||
// Name of the web server user
|
// Name of the web server user
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#Note: project.home is automatically generated by the propel-install script.
|
#Note: project.home is automatically generated by the propel-install script.
|
||||||
#Any manual changes to this value will be overwritten.
|
#Any manual changes to this value will be overwritten.
|
||||||
project.home = /home/denise/airtime/airtime_mvc
|
project.home = /home/asantoni/airtime/airtime_mvc
|
||||||
project.build = ${project.home}/build
|
project.build = ${project.home}/build
|
||||||
|
|
||||||
#Database driver
|
#Database driver
|
||||||
|
|
|
@ -8,6 +8,12 @@
|
||||||
<dsn>pgsql:host=localhost;port=5432;dbname=airtime;user=airtime;password=airtime</dsn>
|
<dsn>pgsql:host=localhost;port=5432;dbname=airtime;user=airtime;password=airtime</dsn>
|
||||||
</connection>
|
</connection>
|
||||||
</datasource>
|
</datasource>
|
||||||
|
<datasource id="airtime_test">
|
||||||
|
<adapter>pgsql</adapter> <!-- sqlite, mysql, myssql, oracle, or pgsql -->
|
||||||
|
<connection>
|
||||||
|
<dsn>pgsql:host=localhost;port=5432;dbname=airtime_test;user=airtime;password=airtime</dsn>
|
||||||
|
</connection>
|
||||||
|
</datasource>
|
||||||
</datasources>
|
</datasources>
|
||||||
</propel>
|
</propel>
|
||||||
</config>
|
</config>
|
||||||
|
|
|
@ -17,18 +17,14 @@ class ShowTest extends Zend_Test_PHPUnit_DatabaseTestCase
|
||||||
//Load Database parameters
|
//Load Database parameters
|
||||||
|
|
||||||
//We need to load the config before our app bootstrap runs. The config
|
//We need to load the config before our app bootstrap runs. The config
|
||||||
//is normally
|
//is normally
|
||||||
$_SERVER['AIRTIME_CONF'] = 'airtime.conf';
|
|
||||||
$CC_CONFIG = Config::getConfig();
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$dbuser = $CC_CONFIG['dsn']['username'];
|
$dbuser = $CC_CONFIG['dsn']['username'];
|
||||||
$dbpasswd = $CC_CONFIG['dsn']['password'];
|
$dbpasswd = $CC_CONFIG['dsn']['password'];
|
||||||
$dbname = $CC_CONFIG['dsn']['database'];
|
$dbname = $CC_CONFIG['dsn']['database'];
|
||||||
$dbhost = $CC_CONFIG['dsn']['hostspec'];
|
$dbhost = $CC_CONFIG['dsn']['hostspec'];
|
||||||
echo($dbuser);
|
|
||||||
echo($dbpasswd);
|
|
||||||
echo($dbname);
|
|
||||||
echo($dbhost);
|
|
||||||
AirtimeInstall::createDatabase();
|
AirtimeInstall::createDatabase();
|
||||||
AirtimeInstall::createDatabaseTables($dbuser, $dbpasswd, $dbname, $dbhost);
|
AirtimeInstall::createDatabaseTables($dbuser, $dbpasswd, $dbname, $dbhost);
|
||||||
AirtimeInstall::SetDefaultTimezone();
|
AirtimeInstall::SetDefaultTimezone();
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
export AIRTIME_UNIT_TEST="1"
|
||||||
|
phpunit
|
||||||
|
|
Loading…
Reference in New Issue