From 147a713cc066d493b50b82a9d475aa9af940e2b4 Mon Sep 17 00:00:00 2001 From: s9e Date: Sat, 22 Nov 2014 20:00:58 +0100 Subject: [ticket/11768] This commit integrates s9e\TextFormatter This commit integrates s9e\TextFormatter as outlined in http://area51.phpbb.com/phpBB/viewtopic.php?f=108&t=44467 PHPBB3-11768 --- tests/text_processing/decode_message_test.php | 87 +++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 tests/text_processing/decode_message_test.php (limited to 'tests/text_processing/decode_message_test.php') diff --git a/tests/text_processing/decode_message_test.php b/tests/text_processing/decode_message_test.php new file mode 100644 index 0000000000..855b3c6c57 --- /dev/null +++ b/tests/text_processing/decode_message_test.php @@ -0,0 +1,87 @@ +assertSame($expected, $actual); + } + + public function get_legacy_tests() + { + return array( + array( + "&<>"'", + "&<>"'" + ), + array( + ':)', + ':)' + ), + /** + * Fails as per PHPBB3-8420 + * @link http://tracker.phpbb.com/browse/PHPBB3-8420 + * + array( + '[url=http://example.com:2cpxwbdy]:arrow: here[/url:2cpxwbdy]', + '[url=http://example.com] :arrow: here[/url]', + '2cpxwbdy' + ), + */ + ); + } + + /** + * @dataProvider get_text_formatter_tests + */ + public function test_text_formatter($original, $expected) + { + $this->get_test_case_helpers()->set_s9e_services(); + + $actual = $original; + decode_message($actual); + + $this->assertSame($expected, $actual); + } + + public function get_text_formatter_tests() + { + return array( + array( + "&<>\"'", + "&<>"'" + ), + array( + ':)', + ':)' + ), + array( + "a
\nb
", + "a\nb" + ), + /** + * @link http://tracker.phpbb.com/browse/PHPBB3-8420 + */ + array( + '[url=http://example.com] :arrow: here[/url]', + '[url=http://example.com] :arrow: here[/url]' + ), + ); + } +} -- cgit v1.2.1 From 462696aa4787112b67b2ea8febf6a9f40a461baa Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Tue, 3 Mar 2015 01:42:54 +0100 Subject: [ticket/11768] Replaced headers in test files PHPBB3-11768 --- tests/text_processing/decode_message_test.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'tests/text_processing/decode_message_test.php') diff --git a/tests/text_processing/decode_message_test.php b/tests/text_processing/decode_message_test.php index 855b3c6c57..c9c1da52d5 100644 --- a/tests/text_processing/decode_message_test.php +++ b/tests/text_processing/decode_message_test.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -- cgit v1.2.1 From d63412af4c177a97997ddd65c91ee6ced7760bc9 Mon Sep 17 00:00:00 2001 From: rxu Date: Tue, 7 Jul 2015 22:50:06 +0700 Subject: [ticket/13377] Add test entries PHPBB3-13377 --- tests/text_processing/decode_message_test.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/text_processing/decode_message_test.php') diff --git a/tests/text_processing/decode_message_test.php b/tests/text_processing/decode_message_test.php index c9c1da52d5..7de599f2b1 100644 --- a/tests/text_processing/decode_message_test.php +++ b/tests/text_processing/decode_message_test.php @@ -38,6 +38,14 @@ class phpbb_text_processing_decode_message_test extends phpbb_test_case ':)', ':)' ), + array( + 'www.phpbb.com', + 'www.phpbb.com' + ), + array( + 'http://www.phpbb.com', + 'http://www.phpbb.com' + ), /** * Fails as per PHPBB3-8420 * @link http://tracker.phpbb.com/browse/PHPBB3-8420 -- cgit v1.2.1 From dad531e4b2c19dd22b8dd6a15e410e187a67fe46 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 13 Mar 2016 12:29:55 +0100 Subject: [ticket/14527] Add tests for reverted improper fix PHPBB3-14527 --- tests/text_processing/decode_message_test.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'tests/text_processing/decode_message_test.php') diff --git a/tests/text_processing/decode_message_test.php b/tests/text_processing/decode_message_test.php index 7de599f2b1..6ee5f91578 100644 --- a/tests/text_processing/decode_message_test.php +++ b/tests/text_processing/decode_message_test.php @@ -16,6 +16,15 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; class phpbb_text_processing_decode_message_test extends phpbb_test_case { + public function setUp() + { + parent::setUp(); + + global $phpbb_dispatcher; + + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + } + /** * @dataProvider get_legacy_tests */ @@ -40,12 +49,20 @@ class phpbb_text_processing_decode_message_test extends phpbb_test_case ), array( 'www.phpbb.com', - 'www.phpbb.com' + 'http://www.phpbb.com' ), array( 'http://www.phpbb.com', 'http://www.phpbb.com' ), + array( + 'this is just text', + 'http://www.phpbb.com' + ), + array( + 'http://www.phpbb.com/some/ ... /shortened', + 'http://www.phpbb.com/some/more/link/that/is/shortened' + ), /** * Fails as per PHPBB3-8420 * @link http://tracker.phpbb.com/browse/PHPBB3-8420 -- cgit v1.2.1 From 17b8e93a5350e297f9be0925120f0b6cf34f5ffe Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 13 Mar 2016 14:48:21 +0100 Subject: [ticket/14527] Decode automatically generated postlink without prefix The http prefix gets automatically added and should be removed prior to outputting the post to the user. PHPBB3-14527 --- tests/text_processing/decode_message_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/text_processing/decode_message_test.php') diff --git a/tests/text_processing/decode_message_test.php b/tests/text_processing/decode_message_test.php index 6ee5f91578..fd1719fedc 100644 --- a/tests/text_processing/decode_message_test.php +++ b/tests/text_processing/decode_message_test.php @@ -49,7 +49,7 @@ class phpbb_text_processing_decode_message_test extends phpbb_test_case ), array( 'www.phpbb.com', - 'http://www.phpbb.com' + 'www.phpbb.com' ), array( 'http://www.phpbb.com', -- cgit v1.2.1 From 14e8113fcf01be7dbdb080458fcbf4e75668cc1a Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Thu, 31 Mar 2016 11:06:47 -0700 Subject: [ticket/14576] Move common required files to bootstrap PHPBB3-14576 --- tests/text_processing/decode_message_test.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'tests/text_processing/decode_message_test.php') diff --git a/tests/text_processing/decode_message_test.php b/tests/text_processing/decode_message_test.php index fd1719fedc..e2402e721a 100644 --- a/tests/text_processing/decode_message_test.php +++ b/tests/text_processing/decode_message_test.php @@ -11,9 +11,6 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; - class phpbb_text_processing_decode_message_test extends phpbb_test_case { public function setUp() -- cgit v1.2.1