From 0f8fe02c68cace2d5ab9567195d8f6d7e6ce243c Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Mon, 18 Dec 2023 11:35:38 +0100 Subject: [PATCH] Fix missing trim argument Required in case of root outputs so that the route key is relative --- .../Features/Documentation/DocumentationSearchPage.php | 2 +- .../framework/tests/Feature/DocumentationSearchPageTest.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/framework/src/Framework/Features/Documentation/DocumentationSearchPage.php b/packages/framework/src/Framework/Features/Documentation/DocumentationSearchPage.php index 4e6c1778678..e16fe950279 100644 --- a/packages/framework/src/Framework/Features/Documentation/DocumentationSearchPage.php +++ b/packages/framework/src/Framework/Features/Documentation/DocumentationSearchPage.php @@ -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 diff --git a/packages/framework/tests/Feature/DocumentationSearchPageTest.php b/packages/framework/tests/Feature/DocumentationSearchPageTest.php index cfb45b76a0c..e7a2adc4dc3 100644 --- a/packages/framework/tests/Feature/DocumentationSearchPageTest.php +++ b/packages/framework/tests/Feature/DocumentationSearchPageTest.php @@ -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()); + } }