The location of the webserver should be configurable in the travis file.

This commit is contained in:
jgen 2014-02-19 03:29:12 -05:00
parent cb135d4763
commit 8b0ac0e9c1
4 changed files with 24 additions and 6 deletions

View file

@ -24,8 +24,8 @@ install:
- if [[ "$DB" == "mysql" ]]; then mysql -e "CREATE DATABASE shimmie;" -uroot; fi
script:
- php tests/test_install.php -d $DB
- php tests/all_tests.php
- php tests/test_install.php -d $DB -h "http://127.0.0.1/"
- php tests/all_tests.php -h "http://127.0.0.1/"
# If a failure occured then dump out a bunch of logs for debugging purposes.
after_failure:

View file

@ -111,10 +111,14 @@ class SCoreWebTestCase extends WebTestCase {
*/
protected function get_page($page) {
if($_SERVER['HTTP_HOST'] == "<cli command>") {
// FIXME: this should be a command line option.
//print "http://127.0.0.1/2.Xm/index.php?q=$page";
$raw = $this->get("http://127.0.0.1/index.php?q=".str_replace("?", "&", $page));
$host = constant("_TRAVIS_WEBHOST");
// Make sure that we know where the host is.
$this->assertFalse(empty($host));
$raw = $this->get($host."index.php?q=".str_replace("?", "&", $page));
}
else {
$raw = $this->get(make_http(make_link($page)));

View file

@ -15,6 +15,14 @@ require_once('lib/simpletest/reporter.php');
// Enable all errors.
error_reporting(E_ALL);
// Get the command line option telling us where the webserver is.
$options = getopt("h::");
$host = trim($options["h"], "'\"");
if (empty($host)){ $host = "http://127.0.0.1/"; }
define("_TRAVIS_WEBHOST", $host);
// The code below is based on the code in index.php
//--------------------------------------------------

View file

@ -17,22 +17,28 @@ require_once('lib/simpletest/reporter.php');
error_reporting(E_ALL);
// Get the command line option telling us what database to use.
$options = getopt("d:");
$options = getopt("d:h::");
$db = $options["d"];
$host = trim($options["h"], "'\"");
if (empty($db)){ die("Error: need to specifiy a database for the test environment."); }
if (empty($host)){ $host = "http://127.0.0.1/"; }
define("_TRAVIS_DATABASE", $db);
define("_TRAVIS_WEBHOST", $host);
class ShimmieInstallerTest extends WebTestCase {
function testInstallShimmie()
{
$db = constant("_TRAVIS_DATABASE");
$host = constant("_TRAVIS_WEBHOST");
// Make sure that we know where the host is.
$this->assertFalse(empty($host));
// Make sure that we know what database to use.
$this->assertFalse(empty($db));
$this->get('http://127.0.0.1/');
$this->get($host);
$this->assertResponse(200);
$this->assertTitle("Shimmie Installation");
$this->assertText("Database Install");