Skip to content
Snippets Groups Projects
Commit 29fcd958 authored by catch's avatar catch
Browse files

Issue #2514196 by pameeela, Aki Tendo, Lendude, lauriii:...

Issue #2514196 by pameeela, Aki Tendo, Lendude, lauriii: AliasManager->getAliasByPath() handles $path in confusing manner
parent a73a32ba
No related branches found
No related tags found
Loading
Pipeline #132746 canceled
Pipeline: drupal

#132748

    ......@@ -194,7 +194,7 @@ public function getPathByAlias($alias, $langcode = NULL) {
    * {@inheritdoc}
    */
    public function getAliasByPath($path, $langcode = NULL) {
    if ($path[0] !== '/') {
    if (!str_starts_with($path, '/')) {
    throw new \InvalidArgumentException(sprintf('Source path %s has to start with a slash.', $path));
    }
    // If no language is explicitly specified we default to the current URL
    ......
    ......@@ -210,6 +210,16 @@ public function testGetAliasByPathNoMatch() {
    $this->aliasManager->writeCache();
    }
    /**
    * Tests the getAliasByPath method exception.
    *
    * @covers ::getAliasByPath
    */
    public function testGetAliasByPathException(): void {
    $this->expectException(\InvalidArgumentException::class);
    $this->aliasManager->getAliasByPath('no-leading-slash-here');
    }
    /**
    * Tests the getAliasByPath method for a path that has a matching alias.
    *
    ......
    • catch @catch

      mentioned in commit ab22c1f3

      ·

      mentioned in commit ab22c1f3

      Toggle commit list
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment