unparsed code[/code:]', ), array( 'Test default bbcodes: simple list', '[list]no item[/list]', '[list:]no item[/list:u:]', ), array( 'Test default bbcodes: simple list-item only', '[*]unparsed', '[*]unparsed', ), array( 'Test default bbcodes: simple list-item', '[list][*]item[/list]', '[list:][*:]item[/*:m:][/list:u:]', ), array( 'Test default bbcodes: simple list-item closed', '[list][*]item[/*][/list]', '[list:][*:]item[/*:][/list:u:]', ), array( 'Test default bbcodes: simple list-item numbered', '[list=1][*]item[/list]', '[list=1:][*:]item[/*:m:][/list:o:]', ), array( 'Test default bbcodes: simple list-item alpha', '[list=a][*]item[/list]', '[list=a:][*:]item[/*:m:][/list:o:]', ), array( 'Test default bbcodes: simple list-item roman', '[list=i][*]item[/list]', '[list=i:][*:]item[/*:m:][/list:o:]', ), array( 'Test default bbcodes: simple list-item disc', '[list=disc][*]item[/list]', '[list=disc:][*:]item[/*:m:][/list:u:]', ), array( 'Test default bbcodes: simple list-item circle', '[list=circle][*]item[/list]', '[list=circle:][*:]item[/*:m:][/list:u:]', ), array( 'Test default bbcodes: simple list-item square', '[list=square][*]item[/list]', '[list=square:][*:]item[/*:m:][/list:u:]', ), array( 'Test default bbcodes: simple img', '[img]https://area51.phpbb.com/images/area51.png[/img]', '[img:]https://area51.phpbb.com/images/area51.png[/img:]', ), array( 'Test default bbcodes: simple url', '[url]https://area51.phpbb.com/[/url]', '[url:]https://area51.phpbb.com/[/url:]', ), array( 'Test default bbcodes: simple url with description', '[url=https://area51.phpbb.com/]Area51[/url]', '[url=https://area51.phpbb.com/:]Area51[/url:]', ), array( 'Test default bbcodes: simple email', '[email]bbcode-test@phpbb.com[/email]', '[email:]bbcode-test@phpbb.com[/email:]', ), array( 'Test default bbcodes: simple email with description', '[email=bbcode-test@phpbb.com]Email[/email]', '[email=bbcode-test@phpbb.com:]Email[/email:]', ), array( 'Test default bbcodes: simple attachment', '[attachment=0]filename[/attachment]', '[attachment=0:]filename[/attachment:]', ), // Special cases for quote which were reported as bugs before array( 'PHPBB3-1401 - correct: parsed', '[quote="[test]test"]test [ test[/quote]', '[quote="[test]test":]test [ test[/quote:]', ), array( 'PHPBB3-6117 - correct: parsed', '[quote]test[/quote] test ] and [ test [quote]test[/quote]', '[quote:]test[/quote:] test ] and [ test [quote:]test[/quote:]', ), array( 'PHPBB3-6200 - correct: parsed', '[quote="["]test[/quote]', '[quote="[":]test[/quote:]', ), array( 'PHPBB3-9364 - quoted: "test[/[/b]quote] test" / non-quoted: "[/quote] test" - also failed if layout distorted', '[quote]test[/[/b]quote] test [/quote][/quote] test', '[quote:]test[/[/b]quote] test [/quote:][/quote] test', ), array( 'PHPBB3-8096 - first quote tag parsed, second quote tag unparsed', '[quote="a"]a[/quote][quote="a]a[/quote]', '[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', '[quote="[i]test[/i]"]test[/quote]', '[quote="[i:]test[/i:]":]test[/quote:]', ), array( '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', '[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]', '[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]', '[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 test case: secondpass parses as [b:]bold [i:]bold + italic[/i:] italic[/b:]', ), ); } /** * @dataProvider bbcode_firstpass_data */ public function test_bbcode_firstpass($description, $message, $expected, $incomplete = false) { if ($incomplete) { $this->markTestIncomplete($incomplete); } global $user, $request; $user = new phpbb_mock_user; $request = new phpbb_mock_request; $bbcode = new bbcode_firstpass(); $bbcode->message = $message; $bbcode->bbcode_init(false); $bbcode->parse_bbcode(); $this->assertEquals($expected, $bbcode->message); } }