Skip to content

Commit

Permalink
Fix missing trim argument
Browse files Browse the repository at this point in the history
Required in case of root outputs so that the route key is relative
  • Loading branch information
caendesilva committed Dec 18, 2023
1 parent 89c6352 commit 0f8fe02
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static function enabled(): bool

public static function routeKey(): string
{
return ltrim(DocumentationPage::outputDirectory().'/search');
return ltrim(DocumentationPage::outputDirectory().'/search', '/');
}

protected static function anotherSearchPageExists(): bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,10 @@ public function testStaticRouteKeyHelperWithCustomOutputDirectory()
DocumentationPage::setOutputDirectory('foo');
$this->assertSame('foo/search', DocumentationSearchPage::routeKey());
}

public function testStaticRouteKeyHelperWithRootOutputDirectory()
{
DocumentationPage::setOutputDirectory('');
$this->assertSame('search', DocumentationSearchPage::routeKey());
}
}

0 comments on commit 0f8fe02

Please sign in to comment.