]> BookStack Code Mirror - bookstack/blobdiff - tests/Settings/FooterLinksTest.php
respective book and chapter structure added.
[bookstack] / tests / Settings / FooterLinksTest.php
index f26f809d5392b71a34045455e2cf3debc000226b..f0bf65e770dca3be224fe3ce9493e814afe1746c 100644 (file)
@@ -1,4 +1,6 @@
-<?php namespace Tests\Settings;
+<?php
+
+namespace Tests\Settings;
 
 use Tests\TestCase;
 
@@ -6,13 +8,13 @@ class FooterLinksTest extends TestCase
 {
     public function test_saving_setting()
     {
-        $resp = $this->asAdmin()->post('/settings', [
+        $resp = $this->asAdmin()->post('/settings/customization', [
             'setting-app-footer-links' => [
                 ['label' => 'My custom link 1', 'url' => 'https://example.com/1'],
                 ['label' => 'My custom link 2', 'url' => 'https://example.com/2'],
             ],
         ]);
-        $resp->assertRedirect('/settings');
+        $resp->assertRedirect('/settings/customization');
 
         $result = setting('app-footer-links');
         $this->assertIsArray($result);
@@ -28,11 +30,11 @@ class FooterLinksTest extends TestCase
             ['label' => 'Another Link', 'url' => 'https://example.com/link-b'],
         ]]);
 
-        $resp = $this->asAdmin()->get('/settings');
-        $resp->assertSee('value="My custom link"');
-        $resp->assertSee('value="Another Link"');
-        $resp->assertSee('value="https://example.com/link-a"');
-        $resp->assertSee('value="https://example.com/link-b"');
+        $resp = $this->asAdmin()->get('/settings/customization');
+        $resp->assertSee('value="My custom link"', false);
+        $resp->assertSee('value="Another Link"', false);
+        $resp->assertSee('value="https://example.com/link-a"', false);
+        $resp->assertSee('value="https://example.com/link-b"', false);
     }
 
     public function test_footer_links_show_on_pages()
@@ -42,8 +44,11 @@ class FooterLinksTest extends TestCase
             ['label' => 'Another Link', 'url' => 'https://example.com/link-b'],
         ]]);
 
-        $this->get('/login')->assertElementContains('footer a[href="https://example.com/link-a"]', 'My custom link');
-        $this->asEditor()->get('/')->assertElementContains('footer a[href="https://example.com/link-b"]', 'Another link');
+        $resp = $this->get('/login');
+        $this->withHtml($resp)->assertElementContains('footer a[href="https://example.com/link-a"]', 'My custom link');
+
+        $resp = $this->asEditor()->get('/');
+        $this->withHtml($resp)->assertElementContains('footer a[href="https://example.com/link-b"]', 'Another link');
     }
 
     public function test_using_translation_system_for_labels()
@@ -54,7 +59,7 @@ class FooterLinksTest extends TestCase
         ]]);
 
         $resp = $this->get('/login');
-        $resp->assertElementContains('footer a[href="https://example.com/privacy"]', 'Privacy Policy');
-        $resp->assertElementContains('footer a[href="https://example.com/terms"]', 'Terms of Service');
+        $this->withHtml($resp)->assertElementContains('footer a[href="https://example.com/privacy"]', 'Privacy Policy');
+        $this->withHtml($resp)->assertElementContains('footer a[href="https://example.com/terms"]', 'Terms of Service');
     }
 }