5 class FooterLinksTest extends TestCase
8 public function test_saving_setting()
10 $resp = $this->asAdmin()->post("/settings", [
11 'setting-app-footer-links' => [
12 ['label' => 'My custom link 1', 'url' => 'https://example.com/1'],
13 ['label' => 'My custom link 2', 'url' => 'https://example.com/2'],
16 $resp->assertRedirect('/settings');
18 $result = setting('app-footer-links');
19 $this->assertIsArray($result);
20 $this->assertCount(2, $result);
21 $this->assertEquals('My custom link 2', $result[1]['label']);
22 $this->assertEquals('https://example.com/1', $result[0]['url']);
25 public function test_set_options_visible_on_settings_page()
27 $this->setSettings(['app-footer-links' => [
28 ['label' => 'My custom link', 'url' => 'https://example.com/link-a'],
29 ['label' => 'Another Link', 'url' => 'https://example.com/link-b'],
32 $resp = $this->asAdmin()->get('/settings');
33 $resp->assertSee('value="My custom link"');
34 $resp->assertSee('value="Another Link"');
35 $resp->assertSee('value="https://example.com/link-a"');
36 $resp->assertSee('value="https://example.com/link-b"');
39 public function test_footer_links_show_on_pages()
41 $this->setSettings(['app-footer-links' => [
42 ['label' => 'My custom link', 'url' => 'https://example.com/link-a'],
43 ['label' => 'Another Link', 'url' => 'https://example.com/link-b'],
46 $this->get('/login')->assertElementContains('footer a[href="https://example.com/link-a"]', 'My custom link');
47 $this->asEditor()->get('/')->assertElementContains('footer a[href="https://example.com/link-b"]', 'Another link');
50 public function test_using_translation_system_for_labels()
52 $this->setSettings(['app-footer-links' => [
53 ['label' => 'trans::common.privacy_policy', 'url' => 'https://example.com/privacy'],
54 ['label' => 'trans::common.terms_of_service', 'url' => 'https://example.com/terms'],
57 $resp = $this->get('/login');
58 $resp->assertElementContains('footer a[href="https://example.com/privacy"]', 'Privacy Policy');
59 $resp->assertElementContains('footer a[href="https://example.com/terms"]', 'Terms of Service');