aboutsummaryrefslogtreecommitdiffstats
path: root/tests/functions_content/phpbb_format_quote_test.php
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2018-12-02 12:54:31 +0100
committerMarc Alexander <admin@m-a-styles.de>2018-12-02 19:50:02 +0100
commitfc27dc02b42e3afa98e96bdab0daf752c6cb9ccf (patch)
tree1cec67a40a98b72dd6940dfe62dd042c408d531f /tests/functions_content/phpbb_format_quote_test.php
parentb7243fad62a61a3f8fb8e4417aec847b89cea508 (diff)
downloadforums-fc27dc02b42e3afa98e96bdab0daf752c6cb9ccf.tar
forums-fc27dc02b42e3afa98e96bdab0daf752c6cb9ccf.tar.gz
forums-fc27dc02b42e3afa98e96bdab0daf752c6cb9ccf.tar.bz2
forums-fc27dc02b42e3afa98e96bdab0daf752c6cb9ccf.tar.xz
forums-fc27dc02b42e3afa98e96bdab0daf752c6cb9ccf.zip
[ticket/15893] Add test for covering phpbb_format_quote
PHPBB3-15893
Diffstat (limited to 'tests/functions_content/phpbb_format_quote_test.php')
-rw-r--r--tests/functions_content/phpbb_format_quote_test.php52
1 files changed, 52 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..0f6136f5d9
--- /dev/null
+++ b/tests/functions_content/phpbb_format_quote_test.php
@@ -0,0 +1,52 @@
+<?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
+{
+ public function setUp()
+ {
+ global $cache, $user, $phpbb_root_path, $phpEx;
+
+ $lang_file_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
+ $lang = new \phpbb\language\language($lang_file_loader);
+ $user = new \phpbb\user($lang, '\phpbb\datetime');
+ $cache = new phpbb_mock_cache();
+
+ parent::setUp();
+ }
+
+ public function data_phpbb_format_quote()
+ {
+ return [
+ [true, ['author' => 'admin', 'user_id' => 2], '[quote=&quot;username&quot;]quoted[/quote]', "[quote=admin user_id=2][quote=&quot;username&quot;]quoted[/quote][/quote]\n\n"],
+ [false, ['author' => 'admin', 'user_id' => 2], '[quote=&quot;username&quot;]quoted[/quote]', "admin wrote:\n&gt; [quote=&quot;username&quot;]quoted[/quote]\n"]
+ ];
+ }
+
+
+ /**
+ * @dataProvider data_phpbb_format_quote
+ */
+ public function test_phpbb_format_quote($bbcode_status, $quote_attributes, $message, $expected)
+ {
+ $text_formatter_utils = new \phpbb\textformatter\s9e\utils();
+
+ $message_parser = new parse_message($message);
+
+ phpbb_format_quote($bbcode_status, $quote_attributes, $text_formatter_utils, $message_parser);
+
+ $this->assertEquals($expected, $message_parser->message);
+ }
+}