Index: common.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/common.test,v
retrieving revision 1.3
diff -u -p -r1.3 common.test
--- common.test	21 Aug 2008 19:36:38 -0000	1.3
+++ common.test	28 Aug 2008 10:40:22 -0000
@@ -137,3 +137,46 @@ class DrupalHTTPRequestTestCase extends 
     $this->assertEqual($unable_to_parse->error, 'unable to parse URL', t('Returned with unable to parse URL error.'));
   }
 }
+
+/**
+ * Test drupal_get_headers()
+ */
+class DrupalGETHeadersTestCase extends DrupalWebTestCase {
+  /**
+   * Implementation of hook_getInfo()
+   */ 
+  function getInfo(){
+    return array(
+      'name' => t('Drupal Get Headers'),
+      'description' => t("Perform tests on Drupal's Get Headers function"),
+      'group' => t('System')
+      );
+  }
+
+  function testDrupalGETHeaders() {
+
+    // get the inital headers
+    $headers = drupal_get_headers();
+    $expected = $headers;
+
+    // now we generate some static and some random tests to test the function
+    $test_headers[] = "X-<title>example.com | Example site</title>";
+    $test_headers[] = '<meta name="Generator" content="Drupal 7
+      (http://drupal.org)" />';
+    // create a number count of random headers
+    $count = rand(2, 0);
+    for ($i = 0; $i < $count; $i++) {
+      $test_headers[] = $this->randomName(10, "X-");
+    }
+
+    // now test each header and compare it with the expected results
+    foreach ($test_headers as $header) {
+    // set the test header
+      drupal_set_header($header);
+
+      $expected .= "\n". $header;
+      $this->assertEqual($expected, drupal_get_headers(), t("unable to set the
+      header"));
+    }
+  }
+}
