Use a constant instead.

This commit is contained in:
jgen 2014-02-18 16:28:43 -05:00
parent cc88a33088
commit 74748d55c0

View File

@ -7,35 +7,33 @@ if (empty($db)){
die("Error: need to specifiy a database for the test environment."); die("Error: need to specifiy a database for the test environment.");
} }
define("_TRAVIS_DATABASE", $db);
require_once('lib/simpletest/autorun.php'); require_once('lib/simpletest/autorun.php');
require_once('lib/simpletest/unit_tester.php'); require_once('lib/simpletest/unit_tester.php');
require_once('lib/simpletest/web_tester.php'); require_once('lib/simpletest/web_tester.php');
require_once('lib/simpletest/reporter.php'); require_once('lib/simpletest/reporter.php');
class ShimmieSimpleTestCase extends WebTestCase { class ShimmieSimpleTestCase extends WebTestCase {
var $database;
function ShimmieTestCase() {
$this->database = $db;
}
function testInstallShimmie() function testInstallShimmie()
{ {
$db = constant("_TRAVIS_DATABASE");
// Make sure that we know what database to use. // Make sure that we know what database to use.
$this->assertFalse(empty($this->database)); $this->assertFalse(empty($db));
$this->get('http://127.0.0.1/'); $this->get('http://127.0.0.1/');
$this->assertResponse(200); $this->assertResponse(200);
$this->assertTitle("Shimmie Installation"); $this->assertTitle("Shimmie Installation");
$this->assertText("Database Install"); $this->assertText("Database Install");
$this->setField("database_type", $this->database); $this->setField("database_type", $db);
$this->assertField("database_host", "localhost"); $this->assertField("database_host", "localhost");
if ($this->database === "mysql") { if ($db === "mysql") {
$this->setField("database_user", "root"); $this->setField("database_user", "root");
$this->setField("database_password", ""); $this->setField("database_password", "");
} elseif ($this->database === "pgsql") { } elseif ($db === "pgsql") {
$this->setField("database_user", "postgres"); $this->setField("database_user", "postgres");
$this->setField("database_password", ""); $this->setField("database_password", "");
} }