]> BookStack Code Mirror - bookstack/blobdiff - tests/UrlTest.php
respective book and chapter structure added.
[bookstack] / tests / UrlTest.php
index 90215d558e02799bc75af878469cb79d7abe7b77..c1e133804dfea4c4170ef8d0181040fd42726c72 100644 (file)
@@ -3,8 +3,6 @@
 namespace Tests;
 
 use BookStack\Http\Request;
-use function request;
-use function url;
 
 class UrlTest extends TestCase
 {
@@ -34,4 +32,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());
+    }
 }