]> BookStack Code Mirror - bookstack/blob - tests/Settings/SettingsTest.php
Replaced embeds with images in exports
[bookstack] / tests / Settings / SettingsTest.php
1 <?php
2
3 namespace Tests\Settings;
4
5 use Tests\TestCase;
6
7 class SettingsTest extends TestCase
8 {
9     public function test_settings_endpoint_redirects_to_settings_view()
10     {
11         $resp = $this->asAdmin()->get('/settings');
12
13         $resp->assertStatus(302);
14
15         // Manually check path to ensure it's generated as the full path
16         $location = $resp->headers->get('location');
17         $this->assertEquals(url('/settings/features'), $location);
18     }
19
20     public function test_settings_category_links_work_as_expected()
21     {
22         $this->asAdmin();
23         $categories = [
24             'features'      => 'Features & Security',
25             'customization' => 'Customization',
26             'registration'  => 'Registration',
27         ];
28
29         foreach ($categories as $category => $title) {
30             $resp = $this->get("/settings/{$category}");
31             $resp->assertElementContains('h1', $title);
32             $resp->assertElementExists("form[action$=\"/settings/{$category}\"]");
33         }
34     }
35
36     public function test_not_found_setting_category_throws_404()
37     {
38         $resp = $this->asAdmin()->get('/settings/biscuits');
39
40         $resp->assertStatus(404);
41         $resp->assertSee('Page Not Found');
42     }
43 }