5 class FooterLinksTest extends TestCase
7 public function test_saving_setting()
9 $resp = $this->asAdmin()->post('/settings', [
10 'setting-app-footer-links' => [
11 ['label' => 'My custom link 1', 'url' => 'https://example.com/1'],
12 ['label' => 'My custom link 2', 'url' => 'https://example.com/2'],
15 $resp->assertRedirect('/settings');
17 $result = setting('app-footer-links');
18 $this->assertIsArray($result);
19 $this->assertCount(2, $result);
20 $this->assertEquals('My custom link 2', $result[1]['label']);
21 $this->assertEquals('https://example.com/1', $result[0]['url']);
24 public function test_set_options_visible_on_settings_page()
26 $this->setSettings(['app-footer-links' => [
27 ['label' => 'My custom link', 'url' => 'https://example.com/link-a'],
28 ['label' => 'Another Link', 'url' => 'https://example.com/link-b'],
31 $resp = $this->asAdmin()->get('/settings');
32 $resp->assertSee('value="My custom link"');
33 $resp->assertSee('value="Another Link"');
34 $resp->assertSee('value="https://example.com/link-a"');
35 $resp->assertSee('value="https://example.com/link-b"');
38 public function test_footer_links_show_on_pages()
40 $this->setSettings(['app-footer-links' => [
41 ['label' => 'My custom link', 'url' => 'https://example.com/link-a'],
42 ['label' => 'Another Link', 'url' => 'https://example.com/link-b'],
45 $this->get('/login')->assertElementContains('footer a[href="https://example.com/link-a"]', 'My custom link');
46 $this->asEditor()->get('/')->assertElementContains('footer a[href="https://example.com/link-b"]', 'Another link');
49 public function test_using_translation_system_for_labels()
51 $this->setSettings(['app-footer-links' => [
52 ['label' => 'trans::common.privacy_policy', 'url' => 'https://example.com/privacy'],
53 ['label' => 'trans::common.terms_of_service', 'url' => 'https://example.com/terms'],
56 $resp = $this->get('/login');
57 $resp->assertElementContains('footer a[href="https://example.com/privacy"]', 'Privacy Policy');
58 $resp->assertElementContains('footer a[href="https://example.com/terms"]', 'Terms of Service');