Skip to content

Commit 4dc75ba

Browse files
committed
Settings: Added test to cover setting category by view
1 parent a3d0f74 commit 4dc75ba

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

app/Settings/SettingController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function update(Request $request, AppSettingsStore $store, string $catego
5858
protected function ensureCategoryExists(string $category): void
5959
{
6060
if (!view()->exists('settings.categories.' . $category)) {
61-
abort(404, 'Category not found');
61+
abort(404);
6262
}
6363
}
6464
}

tests/ThemeTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,19 @@ public function test_header_links_start_template_file_can_be_used()
451451
});
452452
}
453453

454+
public function test_custom_settings_category_page_can_be_added_via_view_file()
455+
{
456+
$content = 'My SuperCustomSettings';
457+
458+
$this->usingThemeFolder(function (string $folder) use ($content) {
459+
$viewDir = theme_path('settings/categories');
460+
mkdir($viewDir, 0777, true);
461+
file_put_contents($viewDir . '/beans.blade.php', $content);
462+
463+
$this->asAdmin()->get('/settings/beans')->assertSee($content);
464+
});
465+
}
466+
454467
protected function usingThemeFolder(callable $callback)
455468
{
456469
// Create a folder and configure a theme

0 commit comments

Comments
 (0)