mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/11250] Add tests for simple nesting and code
PHPBB3-11250
This commit is contained in:
parent
8bbf3a788f
commit
4f080ba0d6
1 changed files with 44 additions and 7 deletions
|
@ -17,7 +17,7 @@ class phpbb_bbcode_parser_test extends PHPUnit_Framework_TestCase
|
|||
public function bbcode_firstpass_data()
|
||||
{
|
||||
return array(
|
||||
// Default BBCodes from in their simplest way
|
||||
// Default bbcodes from in their simplest way
|
||||
array(
|
||||
'Test default bbcodes: simple bold',
|
||||
'[b]bold[/b]',
|
||||
|
@ -176,32 +176,69 @@ class phpbb_bbcode_parser_test extends PHPUnit_Framework_TestCase
|
|||
'[quote="a":]a[/quote:][quote="a]a[/quote]',
|
||||
),
|
||||
|
||||
// Simple bbcodes nesting
|
||||
array(
|
||||
'Allow textual bbcodes in textual bbcodes',
|
||||
'[b]bold [i]bold + italic[/i][/b]',
|
||||
'[b:]bold [i:]bold + italic[/i:][/b:]',
|
||||
),
|
||||
array(
|
||||
'Allow textual bbcodes in url with description',
|
||||
'[url=https://area51.phpbb.com/]Area51 [i]italic[/i][/url]',
|
||||
'[url=https://area51.phpbb.com/:]Area51 [i:]italic[/i:][/url:]',
|
||||
),
|
||||
array(
|
||||
'Allow url with description in textual bbcodes',
|
||||
'[i]italic [url=https://area51.phpbb.com/]Area51[/url][/i]',
|
||||
'[i:]italic [url=https://area51.phpbb.com/:]Area51[/url:][/i:]',
|
||||
),
|
||||
|
||||
// Nesting bbcodes into quote usernames
|
||||
array(
|
||||
'Allow textual BBcodes in usernames',
|
||||
'Allow textual bbcodes in usernames',
|
||||
'[quote="[i]test[/i]"]test[/quote]',
|
||||
'[quote="[i:]test[/i:]":]test[/quote:]',
|
||||
),
|
||||
array(
|
||||
'Allow links BBcodes in usernames',
|
||||
'Allow links bbcodes in usernames',
|
||||
'[quote="[url=https://area51.phpbb.com/]test[/url]"]test[/quote]',
|
||||
'[quote="[url=https://area51.phpbb.com/:]test[/url:]":]test[/quote:]',
|
||||
),
|
||||
array(
|
||||
'Allow img BBcodes in usernames - Username displayed the image',
|
||||
'Allow img bbcodes in usernames - Username displayed the image',
|
||||
'[quote="[img]https://area51.phpbb.com/images/area51.png[/img]"]test[/quote]',
|
||||
'[quote="[img:]https://area51.phpbb.com/images/area51.png[/img:]":]test[/quote:]',
|
||||
),
|
||||
array(
|
||||
'Disallow flash BBcodes in usernames - Username displayed as [flash]http://www.phpbb.com/[/flash]',
|
||||
'Disallow flash bbcodes in usernames - Username displayed as [flash]http://www.phpbb.com/[/flash]',
|
||||
'[quote="[flash]http://www.phpbb.com/[/flash]"]test[/quote]',
|
||||
'[quote="[flash]http://www.phpbb.com/[/flash]":]test[/quote:]',
|
||||
),
|
||||
array(
|
||||
'Disallow quote BBcodes in usernames - Username displayed as [quote]test[/quote]',
|
||||
'Disallow quote bbcodes in usernames - Username displayed as [quote]test[/quote]',
|
||||
'[quote="[quote]test[/quote]"]test[/quote]',
|
||||
'[quote="[quote]test[/quote]":]test[/quote:]',
|
||||
),
|
||||
|
||||
// Do not parse bbcodes in code boxes
|
||||
array(
|
||||
'Do not parse textual bbcodes in code',
|
||||
'[code]unparsed code [b]bold [i]bold + italic[/i][/b][/code]',
|
||||
'[code:]unparsed code [b]bold [i]bold + italic[/i][/b][/code:]',
|
||||
),
|
||||
array(
|
||||
'Do not parse quote bbcodes in code',
|
||||
'[code]unparsed code [quote="username"]quoted[/quote][/code]',
|
||||
'[code:]unparsed code [quote="username"]quoted[/quote][/code:]',
|
||||
),
|
||||
|
||||
// New user friendly mixed nesting
|
||||
array(
|
||||
'Textual bbcode nesting into textual bbcode',
|
||||
'[b]bold [i]bold + italic[/b] italic[/i]',
|
||||
'[b:]bold [i:]bold + italic[/b:] italic[/i:]',
|
||||
'Incomplete: secondpass parses as [b:]bold [i:]bold + italic[/i:] italic[/b:]',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -209,7 +246,7 @@ class phpbb_bbcode_parser_test extends PHPUnit_Framework_TestCase
|
|||
/**
|
||||
* @dataProvider bbcode_firstpass_data
|
||||
*/
|
||||
public function test_bbcode_firstpass($description, $message, $expected)
|
||||
public function test_bbcode_firstpass($description, $message, $expected, $incomplete = false)
|
||||
{
|
||||
if ($incomplete)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue