Fail if there is no database defined.
This commit is contained in:
parent
689621a7ed
commit
f12b32b5d9
1 changed files with 14 additions and 2 deletions
|
@ -3,15 +3,27 @@
|
||||||
$options = getopt("d:");
|
$options = getopt("d:");
|
||||||
$db = $options["d"];
|
$db = $options["d"];
|
||||||
|
|
||||||
|
if (is_empty($db)){
|
||||||
|
die("Error: need to specifiy a database for the test environment.");
|
||||||
|
}
|
||||||
|
|
||||||
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()
|
||||||
{
|
{
|
||||||
|
// Make sure that we know what database to use.
|
||||||
|
$this->assertFalse(is_empty($this->database));
|
||||||
|
|
||||||
$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");
|
||||||
|
@ -20,10 +32,10 @@ class ShimmieSimpleTestCase extends WebTestCase {
|
||||||
$this->setField("database_type", $this->database);
|
$this->setField("database_type", $this->database);
|
||||||
$this->assertField("database_host", "localhost");
|
$this->assertField("database_host", "localhost");
|
||||||
|
|
||||||
if ($db === "mysql") {
|
if ($this->database === "mysql") {
|
||||||
$this->setField("database_user", "root");
|
$this->setField("database_user", "root");
|
||||||
$this->setField("database_password", "");
|
$this->setField("database_password", "");
|
||||||
} elseif ($db === "pgsql") {
|
} elseif ($this->database === "pgsql") {
|
||||||
$this->setField("database_user", "postgres");
|
$this->setField("database_user", "postgres");
|
||||||
$this->setField("database_password", "");
|
$this->setField("database_password", "");
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue