X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/63cb6015a8c6db453f5551e50c04bf6ebbc0f3f1..refs/pull/3433/head:/tests/UrlTest.php diff --git a/tests/UrlTest.php b/tests/UrlTest.php index b9f1acf4b..13f9d9e0c 100644 --- a/tests/UrlTest.php +++ b/tests/UrlTest.php @@ -3,8 +3,8 @@ namespace Tests; use BookStack\Http\Request; -use function url; use function request; +use function url; class UrlTest extends TestCase { @@ -34,4 +34,18 @@ class UrlTest extends TestCase $this->assertEquals('/cool/docs', $bsRequest->getBaseUrl()); $this->assertEquals('https://donkey.example.com:8091/cool/docs/login', $bsRequest->getUri()); } + + public function test_app_url_without_path_does_not_duplicate_path_slash() + { + config()->set('app.url', 'https://donkey.example.com'); + + // Have to manually get and wrap request in our custom type due to testing mechanics + $this->get('/settings'); + $bsRequest = Request::createFrom(request()); + + $this->assertEquals('https://donkey.example.com', $bsRequest->getSchemeAndHttpHost()); + $this->assertEquals('', $bsRequest->getBaseUrl()); + $this->assertEquals('/settings', $bsRequest->getPathInfo()); + $this->assertEquals('https://donkey.example.com/settings', $bsRequest->getUri()); + } }