]> BookStack Code Mirror - bookstack/commitdiff
Settings: Added test to cover setting category by view
authorDan Brown <redacted>
Fri, 11 Oct 2024 12:33:07 +0000 (13:33 +0100)
committerDan Brown <redacted>
Fri, 11 Oct 2024 12:33:07 +0000 (13:33 +0100)
app/Settings/SettingController.php
tests/ThemeTest.php

index 447bb205b53f8d0402b9aee90f9b5ec1009a5c53..1c5f13bc67f2059be0ce5fe9b368c065d12fb31c 100644 (file)
@@ -58,7 +58,7 @@ class SettingController extends Controller
     protected function ensureCategoryExists(string $category): void
     {
         if (!view()->exists('settings.categories.' . $category)) {
-            abort(404, 'Category not found');
+            abort(404);
         }
     }
 }
index 8e12b88d85c07ebcd7b47a8ded7896a058ef1011..837b94eee72061bef6bc6c59f23d49fba5b7db2d 100644 (file)
@@ -451,6 +451,19 @@ END;
         });
     }
 
+    public function test_custom_settings_category_page_can_be_added_via_view_file()
+    {
+        $content = 'My SuperCustomSettings';
+
+        $this->usingThemeFolder(function (string $folder) use ($content) {
+            $viewDir = theme_path('settings/categories');
+            mkdir($viewDir, 0777, true);
+            file_put_contents($viewDir . '/beans.blade.php', $content);
+
+            $this->asAdmin()->get('/settings/beans')->assertSee($content);
+        });
+    }
+
     protected function usingThemeFolder(callable $callback)
     {
         // Create a folder and configure a theme