summaryrefslogtreecommitdiff
path: root/modules/simpletest/tests/bootstrap.test
diff options
context:
space:
mode:
Diffstat (limited to 'modules/simpletest/tests/bootstrap.test')
-rw-r--r--modules/simpletest/tests/bootstrap.test16
1 files changed, 11 insertions, 5 deletions
diff --git a/modules/simpletest/tests/bootstrap.test b/modules/simpletest/tests/bootstrap.test
index befc5ea53..eedf1a914 100644
--- a/modules/simpletest/tests/bootstrap.test
+++ b/modules/simpletest/tests/bootstrap.test
@@ -20,6 +20,8 @@ class BootstrapIPAddressTestCase extends DrupalWebTestCase {
$this->cluster_ip = '127.0.0.4';
$this->untrusted_ip = '0.0.0.0';
+ drupal_static_reset('ip_address');
+
$_SERVER['REMOTE_ADDR'] = $this->remote_ip;
unset($_SERVER['HTTP_X_FORWARDED_FOR']);
unset($_SERVER['HTTP_X_CLUSTER_CLIENT_IP']);
@@ -29,6 +31,7 @@ class BootstrapIPAddressTestCase extends DrupalWebTestCase {
function tearDown() {
$_SERVER = $this->oldserver;
+ drupal_static_reset('ip_address');
parent::tearDown();
}
@@ -38,37 +41,40 @@ class BootstrapIPAddressTestCase extends DrupalWebTestCase {
function testIPAddressHost() {
// Test the normal IP address.
$this->assertTrue(
- ip_address(true) == $this->remote_ip,
+ ip_address() == $this->remote_ip,
t('Got remote IP address')
);
// Proxy forwarding on but no proxy addresses defined.
variable_set('reverse_proxy', 1);
$this->assertTrue(
- ip_address(true) == $this->remote_ip,
+ ip_address() == $this->remote_ip,
t('Proxy forwarding without trusted proxies got remote IP address')
);
// Proxy forwarding on and proxy address not trusted.
variable_set('reverse_proxy_addresses', array($this->proxy_ip));
+ drupal_static_reset('ip_address');
$_SERVER['REMOTE_ADDR'] = $this->untrusted_ip;
$this->assertTrue(
- ip_address(true) == $this->untrusted_ip,
+ ip_address() == $this->untrusted_ip,
t('Proxy forwarding with untrusted proxy got remote IP address')
);
// Proxy forwarding on and proxy address trusted.
$_SERVER['REMOTE_ADDR'] = $this->proxy_ip;
$_SERVER['HTTP_X_FORWARDED_FOR'] = $this->forwarded_ip;
+ drupal_static_reset('ip_address');
$this->assertTrue(
- ip_address(true) == $this->forwarded_ip,
+ ip_address() == $this->forwarded_ip,
t('Proxy forwarding with trusted proxy got forwarded IP address')
);
// Cluster environment.
$_SERVER['HTTP_X_CLUSTER_CLIENT_IP'] = $this->cluster_ip;
+ drupal_static_reset('ip_address');
$this->assertTrue(
- ip_address(TRUE) == $this->cluster_ip,
+ ip_address() == $this->cluster_ip,
t('Cluster environment got cluster client IP')
);
$this->assertFalse(drupal_valid_http_host('security/.drupal.org:80'), t('HTTP_HOST with / is invalid'));