]> BookStack Code Mirror - bookstack/blobdiff - tests/Unit/UrlTest.php
Update settings.php
[bookstack] / tests / Unit / UrlTest.php
index c7d33312c4c0dccc2ca5f2e3f421cb0941703d24..feff4797718baa4904dce7d80dcbaf4aca5180a6 100644 (file)
@@ -1,4 +1,6 @@
-<?php namespace Tests;
+<?php namespace Tests\Unit;
+
+use Tests\TestCase;
 
 class UrlTest extends TestCase
 {
@@ -16,10 +18,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