From 6ed446232cfb26bc0041529c5f10f1d3a2ae3003 Mon Sep 17 00:00:00 2001
From: Pieter Frenssen <pieter@frenssen.be>
Date: Thu, 13 Sep 2012 17:12:14 +0200
Subject: [PATCH] Issue #1783704 by pfrenssen: Test that paths can be matched
 to large patterns in drupal_match_path().

---
 modules/simpletest/tests/path.test | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/modules/simpletest/tests/path.test b/modules/simpletest/tests/path.test
index a506349..d1c1cab 100644
--- a/modules/simpletest/tests/path.test
+++ b/modules/simpletest/tests/path.test
@@ -124,6 +124,26 @@ class DrupalMatchPathTestCase extends DrupalWebTestCase {
       ),
     );
   }
+
+  /**
+   * Tests that paths can be matched to large patterns.
+   */
+  function testDrupalMatchPathLargePattern() {
+    // Create a large patterns string.
+    $patterns = array();
+    for ($i = 0 ; $i < 20000 ; $i++) {
+      $patterns[] = "node/$i";
+    }
+    $patterns = implode("\n", $patterns);
+
+    // Try a matching path.
+    $result = drupal_match_path('node/19999', $patterns);
+    $this->assertTrue($result, t('A matching path was found in a large patterns string.'));
+
+    // Try a non-matching path.
+    $result = drupal_match_path('node/20000', $patterns);
+    $this->assertFalse($result, t('A non-matching path was not found in a large patterns string.'));
+  }
 }
 
 /**
-- 
1.7.12

