This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/tests/test_install.php

53 lines
1.3 KiB
PHP
Raw Normal View History

<?php
2014-02-17 20:45:42 +00:00
$options = getopt("d:");
$db = $options["d"];
if (empty($db)){
2014-02-18 20:41:42 +00:00
die("Error: need to specifiy a database for the test environment.");
}
2014-02-18 21:28:43 +00:00
define("_TRAVIS_DATABASE", $db);
require_once('lib/simpletest/autorun.php');
require_once('lib/simpletest/unit_tester.php');
2014-02-17 20:03:27 +00:00
require_once('lib/simpletest/web_tester.php');
require_once('lib/simpletest/reporter.php');
class ShimmieSimpleTestCase extends WebTestCase {
2014-02-17 20:53:22 +00:00
function testInstallShimmie()
{
2014-02-18 21:28:43 +00:00
$db = constant("_TRAVIS_DATABASE");
2014-02-18 20:41:42 +00:00
// Make sure that we know what database to use.
2014-02-18 21:28:43 +00:00
$this->assertFalse(empty($db));
2014-02-18 20:41:42 +00:00
$this->get('http://127.0.0.1/');
$this->assertResponse(200);
2014-02-17 20:45:42 +00:00
$this->assertTitle("Shimmie Installation");
$this->assertText("Database Install");
2014-02-18 21:28:43 +00:00
$this->setField("database_type", $db);
$this->assertField("database_host", "localhost");
2014-02-18 21:28:43 +00:00
if ($db === "mysql") {
$this->setField("database_user", "root");
$this->setField("database_password", "");
2014-02-18 21:28:43 +00:00
} elseif ($db === "pgsql") {
$this->setField("database_user", "postgres");
$this->setField("database_password", "");
}
$this->assertField("database_name", "shimmie");
2014-02-18 08:32:05 +00:00
$this->clickSubmit("Go!");
if (!$this->assertTitle("Welcome to Shimmie")) {
$this->showSource();
}
2014-02-18 08:32:05 +00:00
$this->assertText("Welcome to Shimmie");
$this->assertText("This message will go away once your first image");
}
}