CC-5651: Unit Test the Scheduler

* Fixed the test airtime.conf a bit
* Create the database tables and db properly
This commit is contained in:
Albert Santoni 2013-12-19 12:01:32 -05:00
parent b95fb38164
commit c4adbab04e
3 changed files with 21 additions and 5 deletions

View File

@ -43,8 +43,6 @@ if (file_exists('/usr/share/php/libzend-framework-php')) {
set_include_path('/usr/share/php/libzend-framework-php' . PATH_SEPARATOR . get_include_path());
}
$_SERVER['AIRTIME_CONF'] = 'airtime.conf';
require_once 'Zend/Application.php';
require_once 'Zend/Config.php';
#require_once 'DatabaseTestCase.php';

View File

@ -1,6 +1,7 @@
<?php
require_once "Zend/Test/PHPUnit/DatabaseTestCase.php";
require_once "ShowService.php";
require_once "../application/configs/conf.php";
require_once "AirtimeInstall.php";
class ShowTest extends Zend_Test_PHPUnit_DatabaseTestCase
@ -12,10 +13,27 @@ class ShowTest extends Zend_Test_PHPUnit_DatabaseTestCase
//XXX: Zend_Test_PHPUnit_DatabaseTestCase doesn't use this for whatever reason:
//$this->bootstrap = array($this, 'appBootstrap');
//So instead we just manually call the appBootstrap here:
$this->appBootstrap();
//TODO: Use AirtimeInstall.php to create the database and database tables
//AirtimeInstall::createDatabase(blah blah);
//AirtimeInstall::createDatabaseTables(blah blah);
//Load Database parameters
//We need to load the config before our app bootstrap runs. The config
//is normally
$_SERVER['AIRTIME_CONF'] = 'airtime.conf';
$CC_CONFIG = Config::getConfig();
$dbuser = $CC_CONFIG['dsn']['username'];
$dbpasswd = $CC_CONFIG['dsn']['password'];
$dbname = $CC_CONFIG['dsn']['database'];
$dbhost = $CC_CONFIG['dsn']['hostspec'];
echo($dbuser);
echo($dbpasswd);
echo($dbname);
echo($dbhost);
AirtimeInstall::createDatabase();
AirtimeInstall::createDatabaseTables($dbuser, $dbpasswd, $dbname, $dbhost);
$this->appBootstrap();
parent::setUp();
}