summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/core/Config_test.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/codeigniter/core/Config_test.php')
-rw-r--r--tests/codeigniter/core/Config_test.php24
1 files changed, 17 insertions, 7 deletions
diff --git a/tests/codeigniter/core/Config_test.php b/tests/codeigniter/core/Config_test.php
index 2c28a639c..f125fc6e9 100644
--- a/tests/codeigniter/core/Config_test.php
+++ b/tests/codeigniter/core/Config_test.php
@@ -76,7 +76,8 @@ class Config_test extends CI_TestCase {
// Capture server vars
$old_host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : NULL;
- $old_script = isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : NULL;
+ $old_script_name = isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : NULL;
+ $old_script_filename = $_SERVER['SCRIPT_FILENAME'];
$old_https = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : NULL;
// Setup server vars for detection
@@ -85,6 +86,7 @@ class Config_test extends CI_TestCase {
$script = 'base_test.php';
$_SERVER['HTTP_HOST'] = $host;
$_SERVER['SCRIPT_NAME'] = $path.$script;
+ $_SERVER['SCRIPT_FILENAME'] = '/foo/bar/'.$script;
// Rerun constructor
$this->config = new $cls;
@@ -95,6 +97,7 @@ class Config_test extends CI_TestCase {
// Rerun constructor
$path = '/path/';
$_SERVER['SCRIPT_NAME'] = $path.$script;
+ $_SERVER['SCRIPT_FILENAME'] = '/foo/bar/'.$path.$script;
$this->config = new $cls;
// Test plain detected (subfolder)
@@ -110,10 +113,12 @@ class Config_test extends CI_TestCase {
// Restore server vars
if ($old_host === NULL) unset($_SERVER['HTTP_HOST']);
else $_SERVER['HTTP_HOST'] = $old_host;
- if ($old_script === NULL) unset($_SERVER['SCRIPT_NAME']);
- else $_SERVER['SCRIPT_NAME'] = $old_script;
+ if ($old_script_name === NULL) unset($_SERVER['SCRIPT_NAME']);
+ else $_SERVER['SCRIPT_NAME'] = $old_script_name;
if ($old_https === NULL) unset($_SERVER['HTTPS']);
else $_SERVER['HTTPS'] = $old_https;
+
+ $_SERVER['SCRIPT_FILENAME'] = $old_script_filename;
}
// --------------------------------------------------------------------
@@ -200,13 +205,18 @@ class Config_test extends CI_TestCase {
'number' => 42,
'letter' => 'Z'
);
+
$pkg_dir = 'package';
- $this->ci_vfs_create($file.'.php', '<?php $config = '.var_export($cfg2, TRUE).';', $this->ci_app_root,
- array($pkg_dir, 'config'));
- $this->config->_config_paths[] = $this->ci_vfs_path($pkg_dir.'/', APPPATH);
+ $this->ci_vfs_create(
+ $file.'.php',
+ '<?php $config = '.var_export($cfg2, TRUE).';',
+ $this->ci_app_root,
+ array($pkg_dir, 'config')
+ );
+ array_unshift($this->config->_config_paths, $this->ci_vfs_path($pkg_dir.'/', APPPATH));
$this->assertTrue($this->config->load($file, TRUE));
$this->assertEquals(array_merge($cfg, $cfg2), $this->config->item($file));
- array_pop($this->config->_config_paths);
+ array_shift($this->config->_config_paths);
// Test graceful fail of invalid file
$file = 'badfile';