From c4adbab04e312428ae849f1450f3f37c7ac0f8a6 Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Thu, 19 Dec 2013 12:01:32 -0500 Subject: [PATCH] CC-5651: Unit Test the Scheduler * Fixed the test airtime.conf a bit * Create the database tables and db properly --- .../tests/{application => }/airtime.conf | 0 airtime_mvc/tests/application/bootstrap.php | 2 -- .../tests/application/models/ShowTest.php | 24 ++++++++++++++++--- 3 files changed, 21 insertions(+), 5 deletions(-) rename airtime_mvc/tests/{application => }/airtime.conf (100%) diff --git a/airtime_mvc/tests/application/airtime.conf b/airtime_mvc/tests/airtime.conf similarity index 100% rename from airtime_mvc/tests/application/airtime.conf rename to airtime_mvc/tests/airtime.conf diff --git a/airtime_mvc/tests/application/bootstrap.php b/airtime_mvc/tests/application/bootstrap.php index 25b478cb9..5c4581627 100644 --- a/airtime_mvc/tests/application/bootstrap.php +++ b/airtime_mvc/tests/application/bootstrap.php @@ -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'; diff --git a/airtime_mvc/tests/application/models/ShowTest.php b/airtime_mvc/tests/application/models/ShowTest.php index 71cd63eea..29d426563 100644 --- a/airtime_mvc/tests/application/models/ShowTest.php +++ b/airtime_mvc/tests/application/models/ShowTest.php @@ -1,6 +1,7 @@ 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(); }