* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case
{
public function test_bbcode_code_lang_is_saved()
{
$container = $this->get_test_case_helpers()->set_s9e_services();
$parser = $container->get('text_formatter.parser');
$original = '[code]...[/code][code=php]...[/code]';
$expected = '[code]...[code=php]...
' ), array( '[quote="username"]quoted[/quote]', 'quoted
' ), array( '[code]unparsed code[/code]', 'username wrote:quoted
CODE: Select all
unparsed code
'
),
array(
'[url]https://area51.phpbb.com/[/url]',
'https://area51.phpbb.com/'
),
array(
'[url=https://area51.phpbb.com/]Area51[/url]',
'Area51'
),
array(
'[email]bbcode-test@phpbb.com[/email]',
'bbcode-test@phpbb.com'
),
array(
'[email=bbcode-test@phpbb.com]Email[/email]',
'Email'
),
array(
'[attachment=0]filename[/attachment]',
''
),
array(
// PHPBB3-1401 - correct: parsed
'[quote="[test]test"]test [ test[/quote]',
'' ), array( // PHPBB3-6117 - correct: parsed '[quote]test[/quote] test ] and [ test [quote]test[/quote]', '[test]test wrote:test [ test
test ] and [ testtest
' ), array( // PHPBB3-6200 - correct: parsed '[quote="["]test[/quote]', 'test
' ), 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', '[ wrote:test
[/quote] test' ), array( // PHPBB3-8096 - first quote tag parsed, second quote tag unparsed '[quote="a"]a[/quote][quote="a]a[/quote]', 'test[/[/b]quote] test
[quote="a]a[/quote]' ), array( // Allow textual bbcodes in textual bbcodes '[b]bold [i]bold + italic[/i][/b]', 'bold bold + italic' ), array( // Allow textual bbcodes in url with description '[url=https://area51.phpbb.com/]Area51 [i]italic[/i][/url]', 'Area51 italic' ), array( // Allow url with description in textual bbcodes '[i]italic [url=https://area51.phpbb.com/]Area51[/url][/i]', 'italic Area51' ), array( // Do not parse textual bbcodes in code '[code]unparsed code [b]bold [i]bold + italic[/i][/b][/code]', 'a wrote:a
CODE: Select all
unparsed code [b]bold [i]bold + italic[/i][/b]CODE: Select all
unparsed code [quote="username"]quoted[/quote]CODE: Select all
' . "\tline1\n line2CODE: Select all
' . "\tline1\n line2' ), array( '[quote="[url]http://example.org[/url]"]...[/quote]', 'xxx wrote:...
' ), array( '[quote=http://example.org]...[/quote]', 'http://example.org wrote:...
' ), array( "[quote]\nThis is a long quote that is definitely going to exceed 80 characters\n[/quote]\n\nFollowed by a reply", "http://example.org wrote:...
\n\nFollowed by a reply" ), array( '[quote=Username post_id=123]...[/quote]', '\nThis is a long quote that is definitely going to exceed 80 characters\n
' ), array( // Users are not allowed to submit their own URL for the post '[quote="Username" post_url="http://fake.example.org"]...[/quote]', 'Username wrote: ↑...
' ), array( '[quote=Username time=58705871]...[/quote]', 'Username wrote:...
' ), array( '[quote=Username user_id=123]...[/quote]', 'Username wrote:1971-11-11 11:11:11...
' ), array( // Users are not allowed to submit their own URL for the profile '[quote=Username profile_url=http://fake.example.org]...[/quote]', 'Username wrote:...
' ), array( // From phpbb_textformatter_s9e_utils_test::test_generate_quote() '[quote=\'[quote="foo"]\']...[/quote]', 'Username wrote:...
' ), array( "Emoji: \xF0\x9F\x98\x80", 'Emoji:[quote="foo"] wrote:...