From a3accfaf461bc963f0661bdab1befbc9ef50a514 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Wed, 11 Jan 2017 01:54:14 -0800 Subject: [ticket/14989] Allow more admin-configurable schemes in post links PHPBB3-14989 --- tests/functional/posting_test.php | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'tests/functional') diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php index 9dd8a1dc91..f3b222b388 100644 --- a/tests/functional/posting_test.php +++ b/tests/functional/posting_test.php @@ -246,4 +246,45 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case // Test that the preview contains the correct link $this->assertEquals($url, $crawler->filter('#preview a')->attr('href')); } + + public function test_allowed_schemes_links() + { + $text = 'http://example.org/ tcp://localhost:22/ServiceName'; + + $this->login(); + $this->admin_login(); + + // Post with default settings + $crawler = self::request('GET', 'posting.php?mode=post&f=2'); + $form = $crawler->selectButton('Preview')->form(array( + 'subject' => 'Test subject', + 'message' => $text, + )); + $crawler = self::submit($form); + $this->assertContains( + 'http://example.org/ tcp://localhost:22/ServiceName', + $crawler->filter('#preview .content')->html() + ); + + // Update allowed schemes + $crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=post'); + $form = $crawler->selectButton('Submit')->form(); + $values = $form->getValues(); + $values['config[allowed_schemes_links]'] = 'https,tcp'; + $form->setValues($values); + $crawler = self::submit($form); + $this->assertEquals(1, $crawler->filter('.successbox')->count()); + + // Post with new settings + $crawler = self::request('GET', 'posting.php?mode=post&f=2'); + $form = $crawler->selectButton('Preview')->form(array( + 'subject' => 'Test subject', + 'message' => $text, + )); + $crawler = self::submit($form); + $this->assertContains( + 'http://example.org/ tcp://localhost:22/ServiceName', + $crawler->filter('#preview .content')->html() + ); + } } -- cgit v1.2.1