[ticket/11250] Add tests for simple nesting and code

PHPBB3-11250
This commit is contained in:
Joas Schilling 2012-12-14 14:29:11 +01:00
parent 8bbf3a788f
commit 4f080ba0d6

View file

@ -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)
{