]> BookStack Code Mirror - bookstack/blobdiff - tests/Unit/UrlTest.php
Add the "Create Shelf" resp. "Create Book" to the home view
[bookstack] / tests / Unit / UrlTest.php
index c7d33312c4c0dccc2ca5f2e3f421cb0941703d24..c2386443c6fdacd9260cc8b5bfb7777c74a5c208 100644 (file)
@@ -16,10 +16,16 @@ class UrlTest extends TestCase
 
     public function test_url_helper_takes_custom_url_into_account()
     {
-        putenv('APP_URL=http://example.com/bookstack');
-        $this->refreshApplication();
-        $this->assertEquals('http://example.com/bookstack/books', url('/books'));
-        putenv('APP_URL=');
+        $this->runWithEnv('APP_URL', 'http://example.com/bookstack', function() {
+            $this->assertEquals('http://example.com/bookstack/books', url('/books'));
+        });
+    }
+
+    public function test_url_helper_sets_correct_scheme_even_when_request_scheme_is_different()
+    {
+        $this->runWithEnv('APP_URL', 'https://example.com/', function() {
+            $this->get('http://example.com/login')->assertSee('https://example.com/dist/styles.css');
+        });
     }
 
 }
\ No newline at end of file