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/message_parser_test.php | 532 ++++++++++++++++++++++++++ 1 file changed, 532 insertions(+) create mode 100644 tests/text_processing/message_parser_test.php (limited to 'tests/text_processing/message_parser_test.php') diff --git a/tests/text_processing/message_parser_test.php b/tests/text_processing/message_parser_test.php new file mode 100644 index 0000000000..59af2553f8 --- /dev/null +++ b/tests/text_processing/message_parser_test.php @@ -0,0 +1,532 @@ + 999)); + + $map = array( + array('MAX_FLASH_HEIGHT_EXCEEDED', 123, 'Your flash files may only be up to 123 pixels high.'), + array('MAX_FLASH_WIDTH_EXCEEDED', 456, 'Your flash files may only be up to 456 pixels wide.'), + array('MAX_FONT_SIZE_EXCEEDED', 120, 'You may only use fonts up to size 120.'), + array('MAX_FONT_SIZE_EXCEEDED', 200, 'You may only use fonts up to size 200.'), + array('MAX_IMG_HEIGHT_EXCEEDED', 12, 'Your images may only be up to 12 pixels high.'), + array('MAX_IMG_WIDTH_EXCEEDED', 34, 'Your images may only be up to 34 pixels wide.'), + array('TOO_MANY_SMILIES', 3, 'Your message contains too many smilies. The maximum number of smilies allowed is 3.'), + array('TOO_MANY_URLS', 2, 'Your message contains too many URLs. The maximum number of URLs allowed is 2.'), + array('UNAUTHORISED_BBCODE', '[flash]', 'You cannot use certain BBCodes: [flash].'), + array('UNAUTHORISED_BBCODE', '[img]', 'You cannot use certain BBCodes: [img].'), + array('UNAUTHORISED_BBCODE', '[quote]', 'You cannot use certain BBCodes: [quote].'), + array('UNAUTHORISED_BBCODE', '[url]', 'You cannot use certain BBCodes: [url].'), + ); + + $user = $this->getMockBuilder('phpbb\\user')->disableOriginalConstructor()->getMock(); + $user->expects($this->any()) + ->method('lang') + ->will($this->returnValueMap($map)); + + $user->lang = array( + 'NO_POLL_TITLE' => 'You have to enter a poll title.', + 'POLL_TITLE_TOO_LONG' => 'The poll title must contain fewer than 100 characters.', + 'POLL_TITLE_COMP_TOO_LONG' => 'The parsed size of your poll title is too large, consider removing BBCodes or smilies.', + 'TOO_FEW_POLL_OPTIONS' => 'You must enter at least two poll options.', + 'TOO_MANY_POLL_OPTIONS' => 'You have tried to enter too many poll options.', + 'TOO_MANY_USER_OPTIONS' => 'You cannot specify more options per user than existing poll options.', + 'UNABLE_GET_IMAGE_SIZE' => 'It was not possible to determine the dimensions of the image.' + ); + + $phpbb_container = new phpbb_mock_container_builder; + $phpbb_container->set('user', $user); + $phpbb_container->set('config', $config); + + if (isset($setup)) + { + $setup($parser, $phpbb_container, $this); + } + + $this->get_test_case_helpers()->set_s9e_services($phpbb_container); + } + + /** + * @dataProvider get_test_polls + */ + public function test_parse_poll($poll, $expected, $warn_msg = array()) + { + $this->prepare_s9e_services(); + + $message_parser = new parse_message('Me[i]s[/i]sage'); + + // Add some default values + $poll += array( + 'poll_length' => 123, + 'poll_start' => 123, + 'poll_last_vote' => 123, + 'poll_vote_change' => true, + 'enable_bbcode' => true, + 'enable_urls' => true, + 'enable_smilies' => true, + 'img_status' => true + ); + + $message_parser->parse_poll($poll); + $this->assertSame($expected, array_intersect_key($poll, $expected)); + + $this->assertSame( + 'Me[i]s[/i]sage', + $message_parser->parse(true, true, true, true, true, true, true, false) + ); + + $this->assertSame($warn_msg, $message_parser->warn_msg); + } + + public function get_test_polls() + { + return array( + array( + array( + 'poll_title' => 'foo [b]bar[/b] baz', + 'poll_option_text' => "[i]foo[/i]\nbar\n[i]baz[/i]", + 'poll_max_options' => 3, + 'poll_options_size' => 3 + ), + array( + 'poll_title' => 'foo [b]bar[/b] baz', + 'poll_option_text' => "[i]foo[/i]\nbar\n[i]baz[/i]", + 'poll_options' => array( + '[i]foo[/i]', + 'bar', + '[i]baz[/i]' + ) + ) + ), + array( + array( + 'poll_title' => 'xxx', + 'poll_option_text' => "[quote]quote[/quote]\n:)", + 'poll_max_options' => 2, + 'poll_options_size' => 2 + ), + array( + 'poll_title' => 'xxx', + 'poll_option_text' => "[quote]quote[/quote]\n:)", + 'poll_options' => array( + '[quote]quote[/quote]', + ':)' + ) + ), + array('You cannot use certain BBCodes: [quote].') + ), + array( + array( + 'poll_title' => 'xxx', + 'poll_option_text' => "[flash=12,34]http://example.org/x.swf[/flash]\n:)", + 'poll_max_options' => 2, + 'poll_options_size' => 2 + ), + array( + 'poll_title' => 'xxx', + 'poll_option_text' => "[flash=12,34]http://example.org/x.swf[/flash]\n:)", + 'poll_options' => array( + '[flash=12,34]http://example.org/x.swf[/flash]', + ':)' + ) + ), + array('You cannot use certain BBCodes: [flash].') + ), + array( + array( + 'poll_title' => 'xxx', + 'poll_option_text' => "[b]x\ny[/b]", + 'poll_max_options' => 2, + 'poll_options_size' => 2 + ), + array( + 'poll_title' => 'xxx', + 'poll_option_text' => "[b]x\ny[/b]", + 'poll_options' => array( + '[b]x', + 'y[/b]', + ) + ) + ), + ); + } + + /** + * @dataProvider get_test_cases + */ + public function test_options($original, $expected, array $args, $setup = null, $warn_msg = array()) + { + $this->prepare_s9e_services($setup); + + $message_parser = new parse_message($original); + call_user_func_array(array($message_parser, 'parse'), $args); + + $this->assertSame($expected, $message_parser->message); + $this->assertSame($warn_msg, $message_parser->warn_msg); + } + + public function get_test_cases() + { + return array( + array( + '[b]bold[/b]', + '[b]bold[/b]', + array(true, true, true, true, true, true, true) + ), + array( + '[b]bold[/b]', + '[b]bold[/b]', + array(false, true, true, true, true, true, true) + ), + array( + 'http://example.org', + 'http://example.org', + array(true, true, true, true, true, true, true) + ), + array( + 'http://example.org', + 'http://example.org', + array(true, false, true, true, true, true, true) + ), + array( + ':)', + ':)', + array(true, true, true, true, true, true, true) + ), + array( + ':)', + ':)', + array(true, true, false, true, true, true, true) + ), + array( + '[url=http://example.org][img]http://example.org/img.png[/img][/url]', + '[url=http://example.org][img]http://example.org/img.png[/img][/url]', + array(true, true, true, true, true, true, true) + ), + array( + '[url=http://example.org][img]http://example.org/img.png[/img][/url]', + '[url=http://example.org][img]http://example.org/img.png[/img][/url]', + array(true, true, true, false, true, true, true), + null, + array('You cannot use certain BBCodes: [img].') + ), + array( + '[flash=12,34]http://example.org/foo.swf[/flash]', + '[flash=12,34]http://example.org/foo.swf[/flash]', + array(true, true, true, true, true, true, true) + ), + array( + '[flash=12,34]http://example.org/foo.swf[/flash]', + '[flash=12,34]http://example.org/foo.swf[/flash]', + array(true, true, true, true, false, true, true), + null, + array('You cannot use certain BBCodes: [flash].') + ), + array( + '[quote="foo"]bar :)[/quote]', + '[quote="foo"]bar :)[/quote]', + array(true, true, true, true, true, true, true) + ), + array( + '[quote="foo"]bar :)[/quote]', + '[quote="foo"]bar :)[/quote]', + array(true, true, true, true, true, false, true), + null, + array('You cannot use certain BBCodes: [quote].') + ), + array( + '[url=http://example.org][img]http://example.org/img.png[/img][/url]', + '[url=http://example.org][img]http://example.org/img.png[/img][/url]', + array(true, true, true, true, true, true, true) + ), + array( + '[url=http://example.org][img]http://example.org/img.png[/img][/url]', + '[url=http://example.org][img]http://example.org/img.png[/img][/url]', + array(true, true, true, true, true, true, false), + null, + array('You cannot use certain BBCodes: [url].') + ), + array( + '[size=200]200[/size]', + '[size=200]200[/size]', + array(true, true, true, true, true, true, true), + function ($parser, $phpbb_container) + { + $phpbb_container->get('config')->set('max_post_font_size', 200); + } + ), + array( + '[size=200]200[/size]', + '[size=200]200[/size]', + array(true, true, true, true, true, true, true), + function ($parser, $phpbb_container) + { + $phpbb_container->get('config')->set('max_post_font_size', 0); + } + ), + array( + '[size=2000]2000[/size]', + '[size=2000]2000[/size]', + array(true, true, true, true, true, true, true), + function ($parser, $phpbb_container) + { + $phpbb_container->get('config')->set('max_post_font_size', 200); + }, + array('You may only use fonts up to size 200.') + ), + array( + '[size=0]0[/size]', + '[size=0]0[/size]', + array(true, true, true, true, true, true, true), + function ($parser, $phpbb_container) + { + $phpbb_container->get('config')->set('max_post_font_size', 200); + } + ), + array( + '[size=200]200[/size]', + '[size=200]200[/size]', + array(true, true, true, true, true, true, true), + function ($parser, $phpbb_container) + { + $phpbb_container->get('config')->set('max_sig_font_size', 200); + } + ), + array( + '[size=200]200[/size]', + '[size=200]200[/size]', + array(true, true, true, true, true, true, true, true, 'sig'), + function ($parser, $phpbb_container) + { + $phpbb_container->get('config')->set('max_sig_font_size', 120); + }, + array('You may only use fonts up to size 120.') + ), + array( + '[img]http://example.org/100x100.png[/img]', + '[img]http://example.org/100x100.png[/img]', + array(true, true, true, true, true, true, true), + function ($parser, $phpbb_container) + { + $phpbb_container->get('config')->set('max_post_img_height', 12); + }, + array('Your images may only be up to 12 pixels high.') + ), + array( + '[img]http://example.org/100x100.png[/img]', + '[img]http://example.org/100x100.png[/img]', + array(true, true, true, true, true, true, true), + function ($parser, $phpbb_container) + { + $phpbb_container->get('config')->set('max_post_img_width', 34); + }, + array('Your images may only be up to 34 pixels wide.') + ), + array( + '[img]http://example.org/100x100.png[/img]', + '[img]http://example.org/100x100.png[/img]', + array(true, true, true, true, true, true, true), + function ($parser, $phpbb_container) + { + $phpbb_container->get('config')->set('max_post_img_height', 0); + $phpbb_container->get('config')->set('max_post_img_width', 0); + } + ), + array( + '[img]http://example.org/100x100.png[/img]', + '[img]http://example.org/100x100.png[/img]', + array(true, true, true, true, true, true, true), + function ($parser, $phpbb_container) + { + $phpbb_container->get('config')->set('max_post_img_height', 100); + $phpbb_container->get('config')->set('max_post_img_width', 100); + } + ), + array( + '[img]http://example.org/100x100.png[/img]', + '[img]http://example.org/100x100.png[/img]', + array(true, true, true, true, true, true, true), + function ($parser, $phpbb_container) + { + $phpbb_container->get('config')->set('max_sig_img_height', 12); + $phpbb_container->get('config')->set('max_sig_img_width', 34); + } + ), + array( + '[img]http://example.org/404.png[/img]', + '[img]http://example.org/404.png[/img]', + array(true, true, true, true, true, true, true), + function ($parser, $phpbb_container) + { + $phpbb_container->get('config')->set('max_post_img_height', 12); + }, + array('It was not possible to determine the dimensions of the image.') + ), + array( + '[flash=999,999]http://example.org/foo.swf[/flash]', + '[flash=999,999]http://example.org/foo.swf[/flash]', + array(true, true, true, true, true, true, true), + function ($parser, $phpbb_container) + { + $phpbb_container->get('config')->set('max_post_img_height', 123); + }, + array('Your flash files may only be up to 123 pixels high.') + ), + array( + '[flash=999,999]http://example.org/foo.swf[/flash]', + '[flash=999,999]http://example.org/foo.swf[/flash]', + array(true, true, true, true, true, true, true), + function ($parser, $phpbb_container) + { + $phpbb_container->get('config')->set('max_post_img_width', 456); + }, + array('Your flash files may only be up to 456 pixels wide.') + ), + array( + ':) :) :)', + ':) :) :)', + array(true, true, true, true, true, true, true, true), + function ($parser, $phpbb_container) + { + $phpbb_container->get('config')->set('max_post_smilies', 3); + } + ), + array( + ':) :) :) :)', + ':) :) :) :)', + array(true, true, true, true, true, true, true, true), + function ($parser, $phpbb_container) + { + $phpbb_container->get('config')->set('max_post_smilies', 3); + }, + array('Your message contains too many smilies. The maximum number of smilies allowed is 3.') + ), + array( + ':) :) :) :)', + ':) :) :) :)', + array(true, true, true, true, true, true, true, true), + function ($parser, $phpbb_container) + { + $phpbb_container->get('config')->set('max_post_smilies', 0); + } + ), + array( + ':) :) :) :)', + ':) :) :) :)', + array(true, true, true, true, true, true, true, true), + function ($parser, $phpbb_container) + { + $phpbb_container->get('config')->set('max_sig_smilies', 3); + } + ), + array( + ':) :) :) :)', + ':) :) :) :)', + array(true, true, true, true, true, true, true, true, 'sig'), + function ($parser, $phpbb_container) + { + $phpbb_container->get('config')->set('max_sig_smilies', 3); + }, + array('Your message contains too many smilies. The maximum number of smilies allowed is 3.') + ), + array( + 'http://example.org http://example.org http://example.org', + 'http://example.org http://example.org http://example.org', + array(true, true, true, true, true, true, true, true), + function ($parser, $phpbb_container) + { + $phpbb_container->get('config')->set('max_post_urls', 2); + }, + array('Your message contains too many URLs. The maximum number of URLs allowed is 2.') + ), + array( + 'http://example.org http://example.org http://example.org', + 'http://example.org http://example.org http://example.org', + array(true, true, true, true, true, true, true, true), + function ($parser, $phpbb_container) + { + $phpbb_container->get('config')->set('max_post_urls', 0); + } + ), + array( + 'http://example.org http://example.org http://example.org', + 'http://example.org http://example.org http://example.org', + array(true, true, true, true, true, true, true, true), + function ($parser, $phpbb_container) + { + $phpbb_container->get('config')->set('max_sig_urls', 2); + } + ), + ); + } +} + +class phpbb_text_processing_message_parser_test_proxy +{ + protected $response; + + public function stream_open($url) + { + if (strpos($url, '100x100')) + { + // Return a 100 x 100 PNG image + $this->response = base64_decode('iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAQAAAABYmaj5AAAAE0lEQVR4AWOgKxgFo2AUjIJRAAAFeAABHs0ozQAAAABJRU5ErkJggg=='); + } + else + { + $this->response = '404 not found'; + } + + return true; + } + + public function stream_stat() + { + return false; + } + + public function stream_read($len) + { + $chunk = substr($this->response, 0, $len); + $this->response = substr($this->response, $len); + + return $chunk; + } + + public function stream_eof() + { + return ($this->response === false); + } +} -- 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/message_parser_test.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'tests/text_processing/message_parser_test.php') diff --git a/tests/text_processing/message_parser_test.php b/tests/text_processing/message_parser_test.php index 59af2553f8..cdbd6c0ca7 100644 --- a/tests/text_processing/message_parser_test.php +++ b/tests/text_processing/message_parser_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 1b4bdff3b3d01cd422f7a49a1de14b3edbd76804 Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Fri, 6 Mar 2015 13:00:03 +0100 Subject: [ticket/11768] Fixed test double PHPBB3-11768 --- tests/text_processing/message_parser_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/text_processing/message_parser_test.php') diff --git a/tests/text_processing/message_parser_test.php b/tests/text_processing/message_parser_test.php index cdbd6c0ca7..691c0d5b8a 100644 --- a/tests/text_processing/message_parser_test.php +++ b/tests/text_processing/message_parser_test.php @@ -53,6 +53,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case array('UNAUTHORISED_BBCODE', '[img]', 'You cannot use certain BBCodes: [img].'), array('UNAUTHORISED_BBCODE', '[quote]', 'You cannot use certain BBCodes: [quote].'), array('UNAUTHORISED_BBCODE', '[url]', 'You cannot use certain BBCodes: [url].'), + array('UNABLE_GET_IMAGE_SIZE', 'It was not possible to determine the dimensions of the image.'), ); $user = $this->getMockBuilder('phpbb\\user')->disableOriginalConstructor()->getMock(); @@ -67,7 +68,6 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case 'TOO_FEW_POLL_OPTIONS' => 'You must enter at least two poll options.', 'TOO_MANY_POLL_OPTIONS' => 'You have tried to enter too many poll options.', 'TOO_MANY_USER_OPTIONS' => 'You cannot specify more options per user than existing poll options.', - 'UNABLE_GET_IMAGE_SIZE' => 'It was not possible to determine the dimensions of the image.' ); $phpbb_container = new phpbb_mock_container_builder; -- cgit v1.2.1 From 97d05eb2350895f13872c8435f204796938b8b6f Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Thu, 28 May 2015 12:23:51 +0200 Subject: [ticket/13860] Fixed PHP notices from undeclared vars/properties PHPBB3-13860 --- tests/text_processing/message_parser_test.php | 53 +++++++++++++++------------ 1 file changed, 30 insertions(+), 23 deletions(-) (limited to 'tests/text_processing/message_parser_test.php') diff --git a/tests/text_processing/message_parser_test.php b/tests/text_processing/message_parser_test.php index 691c0d5b8a..bee1b3fca3 100644 --- a/tests/text_processing/message_parser_test.php +++ b/tests/text_processing/message_parser_test.php @@ -61,6 +61,13 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case ->method('lang') ->will($this->returnValueMap($map)); + $user->data = array( + 'is_bot' => false, + 'is_registered' => true, + 'user_id' => 2, + ); + $user->style = array('style_id' => 1); + $user->lang = array( 'NO_POLL_TITLE' => 'You have to enter a poll title.', 'POLL_TITLE_TOO_LONG' => 'The poll title must contain fewer than 100 characters.', @@ -76,7 +83,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case if (isset($setup)) { - $setup($parser, $phpbb_container, $this); + $setup($phpbb_container, $this); } $this->get_test_case_helpers()->set_s9e_services($phpbb_container); @@ -286,7 +293,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case '[size=200]200[/size]', '[size=200]200[/size]', array(true, true, true, true, true, true, true), - function ($parser, $phpbb_container) + function ($phpbb_container) { $phpbb_container->get('config')->set('max_post_font_size', 200); } @@ -295,7 +302,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case '[size=200]200[/size]', '[size=200]200[/size]', array(true, true, true, true, true, true, true), - function ($parser, $phpbb_container) + function ($phpbb_container) { $phpbb_container->get('config')->set('max_post_font_size', 0); } @@ -304,7 +311,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case '[size=2000]2000[/size]', '[size=2000]2000[/size]', array(true, true, true, true, true, true, true), - function ($parser, $phpbb_container) + function ($phpbb_container) { $phpbb_container->get('config')->set('max_post_font_size', 200); }, @@ -314,7 +321,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case '[size=0]0[/size]', '[size=0]0[/size]', array(true, true, true, true, true, true, true), - function ($parser, $phpbb_container) + function ($phpbb_container) { $phpbb_container->get('config')->set('max_post_font_size', 200); } @@ -323,7 +330,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case '[size=200]200[/size]', '[size=200]200[/size]', array(true, true, true, true, true, true, true), - function ($parser, $phpbb_container) + function ($phpbb_container) { $phpbb_container->get('config')->set('max_sig_font_size', 200); } @@ -332,7 +339,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case '[size=200]200[/size]', '[size=200]200[/size]', array(true, true, true, true, true, true, true, true, 'sig'), - function ($parser, $phpbb_container) + function ($phpbb_container) { $phpbb_container->get('config')->set('max_sig_font_size', 120); }, @@ -342,7 +349,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case '[img]http://example.org/100x100.png[/img]', '[img]http://example.org/100x100.png[/img]', array(true, true, true, true, true, true, true), - function ($parser, $phpbb_container) + function ($phpbb_container) { $phpbb_container->get('config')->set('max_post_img_height', 12); }, @@ -352,7 +359,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case '[img]http://example.org/100x100.png[/img]', '[img]http://example.org/100x100.png[/img]', array(true, true, true, true, true, true, true), - function ($parser, $phpbb_container) + function ($phpbb_container) { $phpbb_container->get('config')->set('max_post_img_width', 34); }, @@ -362,7 +369,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case '[img]http://example.org/100x100.png[/img]', '[img]http://example.org/100x100.png[/img]', array(true, true, true, true, true, true, true), - function ($parser, $phpbb_container) + function ($phpbb_container) { $phpbb_container->get('config')->set('max_post_img_height', 0); $phpbb_container->get('config')->set('max_post_img_width', 0); @@ -372,7 +379,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case '[img]http://example.org/100x100.png[/img]', '[img]http://example.org/100x100.png[/img]', array(true, true, true, true, true, true, true), - function ($parser, $phpbb_container) + function ($phpbb_container) { $phpbb_container->get('config')->set('max_post_img_height', 100); $phpbb_container->get('config')->set('max_post_img_width', 100); @@ -382,7 +389,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case '[img]http://example.org/100x100.png[/img]', '[img]http://example.org/100x100.png[/img]', array(true, true, true, true, true, true, true), - function ($parser, $phpbb_container) + function ($phpbb_container) { $phpbb_container->get('config')->set('max_sig_img_height', 12); $phpbb_container->get('config')->set('max_sig_img_width', 34); @@ -392,7 +399,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case '[img]http://example.org/404.png[/img]', '[img]http://example.org/404.png[/img]', array(true, true, true, true, true, true, true), - function ($parser, $phpbb_container) + function ($phpbb_container) { $phpbb_container->get('config')->set('max_post_img_height', 12); }, @@ -402,7 +409,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case '[flash=999,999]http://example.org/foo.swf[/flash]', '[flash=999,999]http://example.org/foo.swf[/flash]', array(true, true, true, true, true, true, true), - function ($parser, $phpbb_container) + function ($phpbb_container) { $phpbb_container->get('config')->set('max_post_img_height', 123); }, @@ -412,7 +419,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case '[flash=999,999]http://example.org/foo.swf[/flash]', '[flash=999,999]http://example.org/foo.swf[/flash]', array(true, true, true, true, true, true, true), - function ($parser, $phpbb_container) + function ($phpbb_container) { $phpbb_container->get('config')->set('max_post_img_width', 456); }, @@ -422,7 +429,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case ':) :) :)', ':) :) :)', array(true, true, true, true, true, true, true, true), - function ($parser, $phpbb_container) + function ($phpbb_container) { $phpbb_container->get('config')->set('max_post_smilies', 3); } @@ -431,7 +438,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case ':) :) :) :)', ':) :) :) :)', array(true, true, true, true, true, true, true, true), - function ($parser, $phpbb_container) + function ($phpbb_container) { $phpbb_container->get('config')->set('max_post_smilies', 3); }, @@ -441,7 +448,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case ':) :) :) :)', ':) :) :) :)', array(true, true, true, true, true, true, true, true), - function ($parser, $phpbb_container) + function ($phpbb_container) { $phpbb_container->get('config')->set('max_post_smilies', 0); } @@ -450,7 +457,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case ':) :) :) :)', ':) :) :) :)', array(true, true, true, true, true, true, true, true), - function ($parser, $phpbb_container) + function ($phpbb_container) { $phpbb_container->get('config')->set('max_sig_smilies', 3); } @@ -459,7 +466,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case ':) :) :) :)', ':) :) :) :)', array(true, true, true, true, true, true, true, true, 'sig'), - function ($parser, $phpbb_container) + function ($phpbb_container) { $phpbb_container->get('config')->set('max_sig_smilies', 3); }, @@ -469,7 +476,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case 'http://example.org http://example.org http://example.org', 'http://example.org http://example.org http://example.org', array(true, true, true, true, true, true, true, true), - function ($parser, $phpbb_container) + function ($phpbb_container) { $phpbb_container->get('config')->set('max_post_urls', 2); }, @@ -479,7 +486,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case 'http://example.org http://example.org http://example.org', 'http://example.org http://example.org http://example.org', array(true, true, true, true, true, true, true, true), - function ($parser, $phpbb_container) + function ($phpbb_container) { $phpbb_container->get('config')->set('max_post_urls', 0); } @@ -488,7 +495,7 @@ class phpbb_text_processing_message_parser_test extends phpbb_test_case 'http://example.org http://example.org http://example.org', 'http://example.org http://example.org http://example.org', array(true, true, true, true, true, true, true, true), - function ($parser, $phpbb_container) + function ($phpbb_container) { $phpbb_container->get('config')->set('max_sig_urls', 2); } -- 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/message_parser_test.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'tests/text_processing/message_parser_test.php') diff --git a/tests/text_processing/message_parser_test.php b/tests/text_processing/message_parser_test.php index bee1b3fca3..a3dbf644f6 100644 --- a/tests/text_processing/message_parser_test.php +++ b/tests/text_processing/message_parser_test.php @@ -12,10 +12,7 @@ */ require_once __DIR__ . '/../../phpBB/includes/bbcode.php'; -require_once __DIR__ . '/../../phpBB/includes/functions.php'; -require_once __DIR__ . '/../../phpBB/includes/functions_content.php'; require_once __DIR__ . '/../../phpBB/includes/message_parser.php'; -require_once __DIR__ . '/../../phpBB/includes/utf/utf_tools.php'; class phpbb_text_processing_message_parser_test extends phpbb_test_case { -- cgit v1.2.1