diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2012-12-14 14:29:11 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2012-12-14 14:29:11 +0100 |
commit | 4f080ba0d66846ced15295cb0813245d54bd1833 (patch) | |
tree | ffdbc3dc1c1bc08138eed74d196ab6de8d67a4a3 /tests/bbcode/parser_test.php | |
parent | 8bbf3a788fd14a0c9dd67e985d401ce19c1da8a5 (diff) | |
download | forums-4f080ba0d66846ced15295cb0813245d54bd1833.tar forums-4f080ba0d66846ced15295cb0813245d54bd1833.tar.gz forums-4f080ba0d66846ced15295cb0813245d54bd1833.tar.bz2 forums-4f080ba0d66846ced15295cb0813245d54bd1833.tar.xz forums-4f080ba0d66846ced15295cb0813245d54bd1833.zip |
[ticket/11250] Add tests for simple nesting and code
PHPBB3-11250
Diffstat (limited to 'tests/bbcode/parser_test.php')
-rw-r--r-- | tests/bbcode/parser_test.php | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/tests/bbcode/parser_test.php b/tests/bbcode/parser_test.php index be5cb8524e..b87c3668a9 100644 --- a/tests/bbcode/parser_test.php +++ b/tests/bbcode/parser_test.php @@ -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) { |