]> BookStack Code Mirror - bookstack/blobdiff - tests/Settings/SettingsTest.php
respective book and chapter structure added.
[bookstack] / tests / Settings / SettingsTest.php
index 1161a466ee95d4c56e78bbd087156200a13aa088..9d45706e77bbbda8800428cd2b839e65797a3351 100644 (file)
@@ -2,13 +2,14 @@
 
 namespace Tests\Settings;
 
-use Illuminate\Support\Facades\Storage;
 use Tests\TestCase;
-use Tests\Uploads\UsesImages;
 
 class SettingsTest extends TestCase
 {
-    use UsesImages;
+    public function test_admin_can_see_settings()
+    {
+        $this->asAdmin()->get('/settings/features')->assertSee('Settings');
+    }
 
     public function test_settings_endpoint_redirects_to_settings_view()
     {
@@ -48,7 +49,7 @@ class SettingsTest extends TestCase
     public function test_updating_and_removing_app_icon()
     {
         $this->asAdmin();
-        $galleryFile = $this->getTestImage('my-app-icon.png');
+        $galleryFile = $this->files->uploadedImage('my-app-icon.png');
         $expectedPath = public_path('uploads/images/system/' . date('Y-m') . '/my-app-icon.png');
 
         $this->assertFalse(setting()->get('app-icon'));
@@ -56,6 +57,10 @@ class SettingsTest extends TestCase
         $this->assertFalse(setting()->get('app-icon-128'));
         $this->assertFalse(setting()->get('app-icon-64'));
         $this->assertFalse(setting()->get('app-icon-32'));
+        $this->assertEquals(
+            file_get_contents(public_path('icon.ico')),
+            file_get_contents(public_path('favicon.ico')),
+        );
 
         $prevFileCount = count(glob(dirname($expectedPath) . DIRECTORY_SEPARATOR . '*.png'));
 
@@ -75,6 +80,11 @@ class SettingsTest extends TestCase
         $resp = $this->get('/');
         $this->withHtml($resp)->assertElementCount('link[sizes][href*="my-app-icon"]', 6);
 
+        $this->assertNotEquals(
+            file_get_contents(public_path('icon.ico')),
+            file_get_contents(public_path('favicon.ico')),
+        );
+
         $reset = $this->post('/settings/customization', ['app_icon_reset' => 'true']);
         $reset->assertRedirect('/settings/customization');
 
@@ -85,5 +95,10 @@ class SettingsTest extends TestCase
         $this->assertFalse(setting()->get('app-icon-128'));
         $this->assertFalse(setting()->get('app-icon-64'));
         $this->assertFalse(setting()->get('app-icon-32'));
+
+        $this->assertEquals(
+            file_get_contents(public_path('icon.ico')),
+            file_get_contents(public_path('favicon.ico')),
+        );
     }
 }