Index: modules/simpletest/tests/custom_rewrite_url_inbound.inc
===================================================================
RCS file: modules/simpletest/tests/custom_rewrite_url_inbound.inc
diff -N modules/simpletest/tests/custom_rewrite_url_inbound.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/simpletest/tests/custom_rewrite_url_inbound.inc	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,9 @@
+<?php
+function custom_url_rewrite_inbound(&$result, $path, $path_language) {
+  global $user;
+  if (preg_match('|^foobar(/.*)|', $path, $matches)) {
+      $result = 'node'. $matches[1];
+  }
+
+}
+?>
Index: modules/simpletest/tests/custom_rewrite_url_inbound.test
===================================================================
RCS file: modules/simpletest/tests/custom_rewrite_url_inbound.test
diff -N modules/simpletest/tests/custom_rewrite_url_inbound.test
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/simpletest/tests/custom_rewrite_url_inbound.test	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,61 @@
+<?php
+/**
+ * SimpleTest case to test the functionality of the custom_url_rewrite_inbound(). function
+ *
+ */
+class PathTestCase extends DrupalWebTestCase {
+  /**
+   * Implementation of getInfo().
+   *
+   * @return array
+   */
+  function getInfo() {
+    return array(
+      'name' => t('Custom url rewrite inbound test'),
+      'description' => t('Test for custom_url_rewrite_inbound function.'),
+      'group' => t('Path'),
+    );
+  }
+
+  /**
+   * Tests the drupal_get_normal_path function without having included the custom_url_rewrite_inbound function.
+   */
+  function testCustomUrlRewriteInboundWithoutFunction() {
+    $id = $this->randomName();
+    $inbound_path = 'foobar/'. $id;
+    $real_path    = 'node/'. $id;
+
+    $found_path = drupal_get_normal_path($inbound_path);
+    $this->assertNotEqual($found_path, $real_path, t('Inbound path does not get rewritten because the function is not yet included.'));
+  }
+
+  /**
+   * Tests a successful rewrite by the drupal_get_normal_path function.
+   */
+  function testCustomUrlRewriteInbound() {
+    // This function would normally be in settings.php, so we're simulating that by including it here.
+    include(drupal_get_path('module', 'simpletest') . '/tests/custom_rewrite_url_inbound.inc');
+
+    $id = $this->randomName();
+    $inbound_path = 'foobar/'. $id;
+    $real_path    = 'node/'. $id;
+
+    $found_path = drupal_get_normal_path($inbound_path);
+    $this->assertEqual($found_path, $real_path, t('Inbound path gets rewritten when function is defined.'));
+  }
+
+  /**
+   * Tests the output of the drupal_get_normal_path function with a path that can't be rewritten
+   */
+  function testCustomUrlRewriteInboundNoMatch() {
+
+    include(drupal_get_path('module', 'simpletest') .'/tests/custom_rewrite_url_inbound.inc');
+
+    $id = $this->randomName();
+    $inbound_path = 'no_match/'. $id;
+    $real_path    = 'node/'. $id;
+
+    $found_path = drupal_get_normal_path($inbound_path);
+    $this->assertNotEqual($found_path, $real_path, t('Inbound path does not match any of the patterns defined in the custom_url_rewrite_inbound function'));
+  }
+}
