We can actually push the trim functions to when we create the define, less overhead.
This commit is contained in:
parent
141be8768f
commit
eea4d34978
3 changed files with 8 additions and 8 deletions
|
@ -111,8 +111,8 @@ class SCoreWebTestCase extends WebTestCase {
|
|||
*/
|
||||
protected function get_page($page) {
|
||||
// Check if we are running on the command line
|
||||
if(php_sapi_name() === 'cli' || $_SERVER['HTTP_HOST'] == "<cli command>") {
|
||||
$host = rtrim(trim(constant("_TRAVIS_WEBHOST")), "/");
|
||||
if(php_sapi_name() == 'cli' || $_SERVER['HTTP_HOST'] == "<cli command>") {
|
||||
$host = constant("_TRAVIS_WEBHOST");
|
||||
$this->assertFalse(empty($host)); // Make sure that we know the host address.
|
||||
$raw = $this->get($host."/index.php?q=".str_replace("?", "&", $page));
|
||||
}
|
||||
|
|
|
@ -17,10 +17,10 @@ error_reporting(E_ALL);
|
|||
define("CLI_LOG_LEVEL", -100); // output everything.
|
||||
|
||||
// Get the command line option telling us where the webserver is.
|
||||
$options = getopt("h::");
|
||||
$host = trim($options["h"], "'\"");
|
||||
$options = getopt("h:");
|
||||
$host = rtrim(trim($options["h"], "/");
|
||||
|
||||
if (empty($host)){ $host = "http://127.0.0.1/"; }
|
||||
if (empty($host)){ $host = "http://127.0.0.1"; }
|
||||
|
||||
define("_TRAVIS_WEBHOST", $host);
|
||||
|
||||
|
|
|
@ -16,12 +16,12 @@ require_once('lib/simpletest/reporter.php');
|
|||
error_reporting(E_ALL);
|
||||
|
||||
// Get the command line option telling us what database to use.
|
||||
$options = getopt("d:h::");
|
||||
$options = getopt("d:h:");
|
||||
$db = $options["d"];
|
||||
$host = trim($options["h"], "'\"");
|
||||
$host = rtrim(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/"; }
|
||||
if (empty($host)){ $host = "http://127.0.0.1"; }
|
||||
|
||||
define("_TRAVIS_DATABASE", $db);
|
||||
define("_TRAVIS_WEBHOST", $host);
|
||||
|
|
Reference in a new issue