X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/895f656897c70190b8e0a4e426a56b9df83a23b2..refs/pull/3630/head:/tests/Settings/SettingsTest.php diff --git a/tests/Settings/SettingsTest.php b/tests/Settings/SettingsTest.php index b55911523..e2ac6f27c 100644 --- a/tests/Settings/SettingsTest.php +++ b/tests/Settings/SettingsTest.php @@ -10,22 +10,34 @@ class SettingsTest extends TestCase { $resp = $this->asAdmin()->get('/settings'); - $resp->assertRedirect('/settings/features'); + $resp->assertStatus(302); + + // Manually check path to ensure it's generated as the full path + $location = $resp->headers->get('location'); + $this->assertEquals(url('/settings/features'), $location); } public function test_settings_category_links_work_as_expected() { $this->asAdmin(); $categories = [ - 'features' => 'Features & Security', + 'features' => 'Features & Security', 'customization' => 'Customization', - 'registration' => 'Registration', + 'registration' => 'Registration', ]; foreach ($categories as $category => $title) { $resp = $this->get("/settings/{$category}"); - $resp->assertElementContains('h1', $title); - $resp->assertElementExists("form[action$=\"/settings/{$category}\"]"); + $this->withHtml($resp)->assertElementContains('h1', $title); + $this->withHtml($resp)->assertElementExists("form[action$=\"/settings/{$category}\"]"); } } -} \ No newline at end of file + + public function test_not_found_setting_category_throws_404() + { + $resp = $this->asAdmin()->get('/settings/biscuits'); + + $resp->assertStatus(404); + $resp->assertSee('Page Not Found'); + } +}