3 namespace Tests\Settings;
7 class FooterLinksTest extends TestCase
9 public function test_saving_setting()
11 $resp = $this->asAdmin()->post('/settings/customization', [
12 'setting-app-footer-links' => [
13 ['label' => 'My custom link 1', 'url' => 'https://example.com/1'],
14 ['label' => 'My custom link 2', 'url' => 'https://example.com/2'],
17 $resp->assertRedirect('/settings/customization');
19 $result = setting('app-footer-links');
20 $this->assertIsArray($result);
21 $this->assertCount(2, $result);
22 $this->assertEquals('My custom link 2', $result[1]['label']);
23 $this->assertEquals('https://example.com/1', $result[0]['url']);
26 public function test_set_options_visible_on_settings_page()
28 $this->setSettings(['app-footer-links' => [
29 ['label' => 'My custom link', 'url' => 'https://example.com/link-a'],
30 ['label' => 'Another Link', 'url' => 'https://example.com/link-b'],
33 $resp = $this->asAdmin()->get('/settings/customization');
34 $resp->assertSee('value="My custom link"', false);
35 $resp->assertSee('value="Another Link"', false);
36 $resp->assertSee('value="https://example.com/link-a"', false);
37 $resp->assertSee('value="https://example.com/link-b"', false);
40 public function test_footer_links_show_on_pages()
42 $this->setSettings(['app-footer-links' => [
43 ['label' => 'My custom link', 'url' => 'https://example.com/link-a'],
44 ['label' => 'Another Link', 'url' => 'https://example.com/link-b'],
47 $this->get('/login')->assertElementContains('footer a[href="https://example.com/link-a"]', 'My custom link');
48 $this->asEditor()->get('/')->assertElementContains('footer a[href="https://example.com/link-b"]', 'Another link');
51 public function test_using_translation_system_for_labels()
53 $this->setSettings(['app-footer-links' => [
54 ['label' => 'trans::common.privacy_policy', 'url' => 'https://example.com/privacy'],
55 ['label' => 'trans::common.terms_of_service', 'url' => 'https://example.com/terms'],
58 $resp = $this->get('/login');
59 $resp->assertElementContains('footer a[href="https://example.com/privacy"]', 'Privacy Policy');
60 $resp->assertElementContains('footer a[href="https://example.com/terms"]', 'Terms of Service');