Skip to content

Commit fc27dc0

Browse files
committed
[ticket/15893] Add test for covering phpbb_format_quote
PHPBB3-15893
1 parent b7243fa commit fc27dc0

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
*
4+
* This file is part of the phpBB Forum Software package.
5+
*
6+
* @copyright (c) phpBB Limited <https://www.phpbb.com>
7+
* @license GNU General Public License, version 2 (GPL-2.0)
8+
*
9+
* For full copyright and license information, please see
10+
* the docs/CREDITS.txt file.
11+
*
12+
*/
13+
14+
require_once dirname(__FILE__) . '/../../phpBB/includes/message_parser.php';
15+
16+
class phpbb_functions_content_phpbb_format_quote_test extends phpbb_test_case
17+
{
18+
public function setUp()
19+
{
20+
global $cache, $user, $phpbb_root_path, $phpEx;
21+
22+
$lang_file_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
23+
$lang = new \phpbb\language\language($lang_file_loader);
24+
$user = new \phpbb\user($lang, '\phpbb\datetime');
25+
$cache = new phpbb_mock_cache();
26+
27+
parent::setUp();
28+
}
29+
30+
public function data_phpbb_format_quote()
31+
{
32+
return [
33+
[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"],
34+
[false, ['author' => 'admin', 'user_id' => 2], '[quote=&quot;username&quot;]quoted[/quote]', "admin wrote:\n&gt; [quote=&quot;username&quot;]quoted[/quote]\n"]
35+
];
36+
}
37+
38+
39+
/**
40+
* @dataProvider data_phpbb_format_quote
41+
*/
42+
public function test_phpbb_format_quote($bbcode_status, $quote_attributes, $message, $expected)
43+
{
44+
$text_formatter_utils = new \phpbb\textformatter\s9e\utils();
45+
46+
$message_parser = new parse_message($message);
47+
48+
phpbb_format_quote($bbcode_status, $quote_attributes, $text_formatter_utils, $message_parser);
49+
50+
$this->assertEquals($expected, $message_parser->message);
51+
}
52+
}

0 commit comments

Comments
 (0)