diff options
| author | stevendegroote <stevendegroote@gmail.com> | 2019-09-17 23:15:54 +0200 |
|---|---|---|
| committer | stevendegroote <stevendegroote@gmail.com> | 2019-09-17 23:15:54 +0200 |
| commit | f8967fec78d826ea8d9ca34f65966ff8a7674b47 (patch) | |
| tree | f9c5f408e7764ec6343e084e7fc6d62d07e3400f /tests/functions_content/phpbb_format_quote_test.php | |
| parent | ce93b224107a65b43253c36812b636321eb55a78 (diff) | |
| parent | 4db585a4cb2e5359074a82ef088574609155294b (diff) | |
| download | forums-f8967fec78d826ea8d9ca34f65966ff8a7674b47.tar forums-f8967fec78d826ea8d9ca34f65966ff8a7674b47.tar.gz forums-f8967fec78d826ea8d9ca34f65966ff8a7674b47.tar.bz2 forums-f8967fec78d826ea8d9ca34f65966ff8a7674b47.tar.xz forums-f8967fec78d826ea8d9ca34f65966ff8a7674b47.zip | |
Merge branch '3.2.x' into ticket/16159
Diffstat (limited to 'tests/functions_content/phpbb_format_quote_test.php')
| -rw-r--r-- | tests/functions_content/phpbb_format_quote_test.php | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/functions_content/phpbb_format_quote_test.php b/tests/functions_content/phpbb_format_quote_test.php new file mode 100644 index 0000000000..cbbd46d0a9 --- /dev/null +++ b/tests/functions_content/phpbb_format_quote_test.php @@ -0,0 +1,57 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +require_once dirname(__FILE__) . '/../../phpBB/includes/message_parser.php'; + +class phpbb_functions_content_phpbb_format_quote_test extends phpbb_test_case +{ + /** @var \phpbb\language\language */ + protected $lang; + + public function setUp() + { + global $cache, $user, $phpbb_root_path, $phpEx; + + $lang_file_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $this->lang = new \phpbb\language\language($lang_file_loader); + $user = new \phpbb\user($this->lang, '\phpbb\datetime'); + $cache = new phpbb_mock_cache(); + + parent::setUp(); + } + + public function data_phpbb_format_quote() + { + return [ + [true, ['author' => 'admin', 'user_id' => 2], '[quote="username"]quoted[/quote]', '', "[quote=admin user_id=2][quote="username"]quoted[/quote][/quote]\n\n"], + [false, ['author' => 'admin', 'user_id' => 2], '[quote="username"]quoted[/quote]', '', "admin wrote:\n> [quote="username"]quoted[/quote]\n"], + [true, ['author' => 'admin', 'user_id' => 2], '[quote="username"]quoted[/quote]', "[url=http://viewtopic.php?p=1#p1]Subject: Foo[/url]\n\n", "[url=http://viewtopic.php?p=1#p1]Subject: Foo[/url]\n\n[quote=admin user_id=2][quote="username"]quoted[/quote][/quote]\n\n"], + [false, ['author' => 'admin', 'user_id' => 2], '[quote="username"]quoted[/quote]', "http://viewtopic.php?p=1#p1 - Subject: Foo\n\n", "http://viewtopic.php?p=1#p1 - Subject: Foo\n\nadmin wrote:\n> [quote="username"]quoted[/quote]\n"], + ]; + } + + + /** + * @dataProvider data_phpbb_format_quote + */ + public function test_phpbb_format_quote($bbcode_status, $quote_attributes, $message, $message_link, $expected) + { + $text_formatter_utils = new \phpbb\textformatter\s9e\utils(); + + $message_parser = new parse_message($message); + + phpbb_format_quote($this->lang, $message_parser, $text_formatter_utils, $bbcode_status, $quote_attributes, $message_link); + + $this->assertEquals($expected, $message_parser->message); + } +} |
