summaryrefslogtreecommitdiff
path: root/includes/bootstrap.test
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-06-26 21:07:59 +0000
committerDries Buytaert <dries@buytaert.net>2008-06-26 21:07:59 +0000
commit66ddfda7a211d0c8dbba8d622fe08918a0fbfe15 (patch)
treecbb2a2a74694fc63e22c2de7a1f0fd26e254edce /includes/bootstrap.test
parent2877c1027a05ab516439f4917cfc25c84b2bef10 (diff)
downloadbrdo-66ddfda7a211d0c8dbba8d622fe08918a0fbfe15.tar.gz
brdo-66ddfda7a211d0c8dbba8d622fe08918a0fbfe15.tar.bz2
- Patch #274994 by R.Muilwijk, boombatower: bring back the includes-tests.
Diffstat (limited to 'includes/bootstrap.test')
-rw-r--r--includes/bootstrap.test83
1 files changed, 0 insertions, 83 deletions
diff --git a/includes/bootstrap.test b/includes/bootstrap.test
deleted file mode 100644
index beb94edf0..000000000
--- a/includes/bootstrap.test
+++ /dev/null
@@ -1,83 +0,0 @@
-<?php
-
-class BootstrapIPAddressTestCase extends DrupalWebTestCase {
-
- /**
- * Implementation of getInfo().
- */
- function getInfo() {
- return array(
- 'name' => t('IP address test'),
- 'description' => t('Get the IP address from the current visitor from the server variables.'),
- 'group' => t('Bootstrap')
- );
- }
-
- /**
- * Implementation of setUp().
- */
- function setUp() {
- $this->oldserver = $_SERVER;
-
- $this->remote_ip = '127.0.0.1';
- $this->proxy_ip = '127.0.0.2';
- $this->forwarded_ip = '127.0.0.3';
- $this->cluster_ip = '127.0.0.4';
- $this->untrusted_ip = '0.0.0.0';
-
- $_SERVER['REMOTE_ADDR'] = $this->remote_ip;
- unset($_SERVER['HTTP_X_FORWARDED_FOR']);
- unset($_SERVER['HTTP_X_CLUSTER_CLIENT_IP']);
-
- parent::setUp();
- }
-
- /**
- * Implementation of tearDown().
- */
- function tearDown() {
- $_SERVER = $this->oldserver;
- parent::tearDown();
- }
-
- /**
- * testIPAddress
- */
- function testIPAddress() {
- // Test the normal IP address.
- $this->assertTrue(
- ip_address(true) == $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,
- 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));
- $_SERVER['REMOTE_ADDR'] = $this->untrusted_ip;
- $this->assertTrue(
- ip_address(true) == $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;
- $this->assertTrue(
- ip_address(true) == $this->forwarded_ip,
- t('Proxy forwarding with trusted proxy got forwarded IP address')
- );
-
- // Cluster environment.
- $_SERVER['HTTP_X_CLUSTER_CLIENT_IP'] = $this->cluster_ip;
- $this->assertTrue(
- ip_address(true) == $this->cluster_ip,
- t('Cluster environment got cluster client IP')
- );
- }
-}