Better detection of running on the command line.

This commit is contained in:
jgen 2014-02-19 18:10:40 -05:00
parent 5a49bb59e4
commit 141be8768f
2 changed files with 6 additions and 10 deletions

View File

@ -8,7 +8,7 @@ class AliasEditorTest extends ShimmieWebTestCase {
$this->log_in_as_user(); $this->log_in_as_user();
$this->get_page('alias/list'); $this->get_page('alias/list');
$this->assert_title("Alias List"); $this->assert_title("Alias List");
$this->assertFalse($this->assertFieldByName('oldtag', '')); $this->assert_no_text("Add");
$this->log_out(); $this->log_out();
$this->log_in_as_admin(); $this->log_in_as_admin();

View File

@ -110,15 +110,11 @@ class SCoreWebTestCase extends WebTestCase {
* the right thing; no need for http:// or any such * the right thing; no need for http:// or any such
*/ */
protected function get_page($page) { protected function get_page($page) {
if($_SERVER['HTTP_HOST'] == "<cli command>") { // Check if we are running on the command line
if(php_sapi_name() === 'cli' || $_SERVER['HTTP_HOST'] == "<cli command>") {
//print "http://127.0.0.1/2.Xm/index.php?q=$page"; $host = rtrim(trim(constant("_TRAVIS_WEBHOST")), "/");
$this->assertFalse(empty($host)); // Make sure that we know the host address.
$host = constant("_TRAVIS_WEBHOST"); $raw = $this->get($host."/index.php?q=".str_replace("?", "&", $page));
// Make sure that we know where the host is.
$this->assertFalse(empty($host));
$raw = $this->get($host."index.php?q=".str_replace("?", "&", $page));
} }
else { else {
$raw = $this->get(make_http(make_link($page))); $raw = $this->get(make_http(make_link($page)));