Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / redirect / tests / src / Kernel / RedirectAPITest.php
index 462b9cf9b51d8759bc6b0edc4b8228214904ff8f..f57e66bc06cfe8110169a7c4864c678af9b10e44 100644 (file)
@@ -148,6 +148,23 @@ class RedirectAPITest extends KernelTestBase {
     }
   }
 
+  /**
+   * Test slash is removed from source path in findMatchingRedirect.
+   */
+  public function testDuplicateRedirectEntry() {
+    $redirect = $this->controller->create();
+    $redirect->setSource('/foo/foo', []);
+    $redirect->setRedirect('foo');
+    $redirect->save();
+
+    $redirect_repository = \Drupal::service('redirect.repository');
+    $matched_redirect = $redirect_repository->findMatchingRedirect('/foo/foo', [], 'en-AU');
+    $this->assertNotNull($matched_redirect);
+
+    $null_redirect = $redirect_repository->findMatchingRedirect('/foo/foo-bar', [], 'en-AU');
+    $this->assertNull($null_redirect);
+  }
+
   /**
    * Test redirect_sort_recursive().
    */