diff options
Diffstat (limited to 'tests')
17 files changed, 415 insertions, 32 deletions
diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php index 8e6328d1d3..764376a945 100644 --- a/tests/functional/posting_test.php +++ b/tests/functional/posting_test.php @@ -235,7 +235,7 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case )); $crawler = self::submit($form); $this->assertContains( - '<span style="font-weight: bold">My signature</span>', + '<strong class="text-strong">My signature</strong>', $crawler->filter('#preview .signature')->html() ); } diff --git a/tests/text_formatter/s9e/bbcode_merger_test.php b/tests/text_formatter/s9e/bbcode_merger_test.php new file mode 100644 index 0000000000..815539056b --- /dev/null +++ b/tests/text_formatter/s9e/bbcode_merger_test.php @@ -0,0 +1,280 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @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_bbcode_merger_test extends phpbb_test_case +{ + /** + * @dataProvider get_merge_bbcodes_tests + */ + public function test_merge_bbcodes($usage_without, $template_without, $usage_with, $template_with, $expected_usage, $expected_template) + { + $container = $this->get_test_case_helpers()->set_s9e_services(); + $factory = $container->get('text_formatter.s9e.factory'); + $bbcode_merger = new \phpbb\textformatter\s9e\bbcode_merger($factory); + + $without = ['usage' => $usage_without, 'template' => $template_without]; + $with = ['usage' => $usage_with, 'template' => $template_with]; + $merged = $bbcode_merger->merge_bbcodes($without, $with); + + // Normalize the expected template's whitespace to match the default indentation + $expected_template = str_replace("\n\t\t\t\t", "\n", $expected_template); + $expected_template = str_replace("\t", ' ', $expected_template); + + $this->assertSame($expected_usage, $merged['usage']); + $this->assertSame($expected_template, $merged['template']); + } + + public function get_merge_bbcodes_tests() + { + return [ + [ + '[x]{TEXT}[/x]', + '<b>{TEXT}</b>', + + '[x={TEXT1}]{TEXT}[/x]', + '<b title="{TEXT1}">{TEXT}</b>', + + '[x={TEXT1?}]{TEXT}[/x]', + '<b> + <xsl:if test="@x"> + <xsl:attribute name="title"> + <xsl:value-of select="@x"/> + </xsl:attribute> + </xsl:if> + <xsl:apply-templates/> + </b>' + ], + [ + // The tokens' numbering differs between versions + '[x]{TEXT}[/x]', + '<b>{TEXT}</b>', + + '[x={TEXT1}]{TEXT2}[/x]', + '<b title="{TEXT1}">{TEXT2}</b>', + + '[x={TEXT1?}]{TEXT2}[/x]', + '<b> + <xsl:if test="@x"> + <xsl:attribute name="title"> + <xsl:value-of select="@x"/> + </xsl:attribute> + </xsl:if> + <xsl:apply-templates/> + </b>' + ], + [ + '[x]{URL}[/x]', + '<a href="{URL}">{URL}</a>', + + '[x={URL}]{TEXT}[/x]', + '<a href="{URL}">{TEXT}</a>', + + '[x={URL;useContent}]{TEXT}[/x]', + '<a href="{@x}"> + <xsl:apply-templates/> + </a>' + ], + [ + '[x]{URL}[/x]', + '<a href="{URL}">{L_GO_TO}: {URL}</a>', + + '[x={URL}]{TEXT}[/x]', + '<a href="{URL}">{L_GO_TO}: {TEXT}</a>', + + '[x={URL;useContent}]{TEXT}[/x]', + '<a href="{@x}">{L_GO_TO}: <xsl:apply-templates/></a>' + ], + [ + // Test that unsafe BBCodes can still be merged + '[script]{TEXT}[/script]', + '<script>{TEXT}</script>', + + '[script={TEXT1}]{TEXT2}[/script]', + '<script type="{TEXT1}">{TEXT2}</script>', + + '[script={TEXT1?}]{TEXT2}[/script]', + '<script> + <xsl:if test="@script"> + <xsl:attribute name="type"> + <xsl:value-of select="@script"/> + </xsl:attribute> + </xsl:if> + <xsl:apply-templates/> + </script>' + ], + [ + // https://www.phpbb.com/community/viewtopic.php?p=14848281#p14848281 + '[note]{TEXT}[/note]', + '<span class="prime_bbcode_note_spur" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);"></span><span class="prime_bbcode_note">{TEXT}</span>', + + '[note={TEXT1}]{TEXT2}[/note]', + '<span class="prime_bbcode_note_text" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);">{TEXT1}</span><span class="prime_bbcode_note_spur" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);"></span><span class="prime_bbcode_note">{TEXT2}</span>', + + '[note={TEXT1?}]{TEXT2}[/note]', + '<xsl:if test="@note"> + <span class="prime_bbcode_note_text" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);"> + <xsl:value-of select="@note"/> + </span> + </xsl:if> + <span class="prime_bbcode_note_spur" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);"/> + <span class="prime_bbcode_note"> + <xsl:apply-templates/> + </span>' + ], + [ + // https://www.phpbb.com/community/viewtopic.php?p=14768441#p14768441 + '[MI]{TEXT}[/MI]', + '<span style="color:red">MI:</span> <span style="color:#f6efe2">{TEXT}</span>', + + '[MI={TEXT2}]{TEXT1}[/MI]', + '<span style="color:red">MI for: "{TEXT2}":</span> <span style="color:#f6efe2">{TEXT1}</span>', + + '[MI={TEXT2?}]{TEXT1}[/MI]', + '<span style="color:red">MI<xsl:if test="@mi"> for: "<xsl:value-of select="@mi"/>"</xsl:if>:</span> + <xsl:text> </xsl:text> + <span style="color:#f6efe2"> + <xsl:apply-templates/> + </span>' + ], + [ + // https://www.phpbb.com/community/viewtopic.php?p=14700506#p14700506 + '[spoiler]{TEXT}[/spoiler]', + '<span class="spoiler"> {TEXT}</span>', + + '[spoiler={TEXT1}]{TEXT2}[/spoiler]', + '<div class="spoiler"><small> {TEXT1}</small>{TEXT2}</div>', + + '[spoiler={TEXT1?}]{TEXT2}[/spoiler]', + '<xsl:choose> + <xsl:when test="@spoiler"> + <div class="spoiler"> + <small> + <xsl:text> </xsl:text> + <xsl:value-of select="@spoiler"/> + </small> + <xsl:apply-templates/> + </div> + </xsl:when> + <xsl:otherwise> + <span class="spoiler"> + <xsl:text> </xsl:text> + <xsl:apply-templates/> + </span> + </xsl:otherwise> + </xsl:choose>' + ], + [ + // https://www.phpbb.com/community/viewtopic.php?p=14859676#p14859676 + '[AE]{TEXT}[/AE]', + '<table width="100%" border="1"> + <tr><td width="100%" align="center"> + <table width="100%" border="0"> + <tr> + <td width="100%" bgcolor="#E1E4F2"> + <table width="100%" border="0" bgcolor="#F5F5FF"> + <tr> + <td width="1%" bgcolor="#000000" nowrap align="left"> + <font color="#FFFFFF" face="Arial"><font size="1"><b> ACTIVE EFFECTS & CONDITIONS </b></font></font></td> + <td width="99%"> </td> + </tr> + <tr> + <td width="100%" bgcolor="#FFE5BA" colspan="2"> + <table width="100%" cellpadding="2"> + <tr> + <td width="100%" align="left" valign="top"> + {TEXT} + </td> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + </table> + </td></tr> + </table> + <p> </p>', + + '[AE={TEXT1}]{TEXT2}[/AE]', + '<table width="100%" border="1"> + <tr><td width="100%" align="center"> + <table width="100%" border="0"> + <tr> + <td width="100%" bgcolor="#E1E4F2"> + <table width="100%" border="0" bgcolor="#F5F5FF"> + <tr> + <td width="1%" bgcolor="#000000" nowrap align="left"> + <font color="#FFFFFF" face="Arial"><font size="1"><b> {TEXT1} </b></font></font></td> + <td width="99%"> </td> + </tr> + <tr> + <td width="100%" bgcolor="#FFE5BA" colspan="2"> + <table width="100%" cellpadding="2"> + <tr> + <td width="100%" align="left" valign="top"> + {TEXT2} + </td> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + </table> + </td></tr> + </table> + <p> </p>', + + '[AE={TEXT1?}]{TEXT2}[/AE]', + '<table width="100%" border="1"> + <tr> + <td width="100%" align="center"> + <table width="100%" border="0"> + <tr> + <td width="100%" bgcolor="#E1E4F2"> + <table width="100%" border="0" bgcolor="#F5F5FF"> + <tr> + <td width="1%" bgcolor="#000000" nowrap="nowrap" align="left"> + <font color="#FFFFFF" face="Arial"> + <font size="1"> + <b> <xsl:choose><xsl:when test="@ae"><xsl:text> </xsl:text><xsl:value-of select="@ae"/></xsl:when><xsl:otherwise>ACTIVE EFFECTS & CONDITIONS</xsl:otherwise></xsl:choose> </b> + </font> + </font> + </td> + <td width="99%"> </td> + </tr> + <tr> + <td width="100%" bgcolor="#FFE5BA" colspan="2"> + <table width="100%" cellpadding="2"> + <tr> + <td width="100%" align="left" valign="top"> + <xsl:apply-templates/> + </td> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + </table> + <p> </p>' + ], + ]; + } +} diff --git a/tests/text_formatter/s9e/default_formatting_test.php b/tests/text_formatter/s9e/default_formatting_test.php index a0c57214e4..8887b9daee 100644 --- a/tests/text_formatter/s9e/default_formatting_test.php +++ b/tests/text_formatter/s9e/default_formatting_test.php @@ -50,27 +50,27 @@ class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case return array( array( '[b]bold[/b]', - '<span style="font-weight: bold">bold</span>' + '<span style="font-weight:bold">bold</span>' ), array( '[u]underlined[/u]', - '<span style="text-decoration: underline">underlined</span>' + '<span style="text-decoration:underline">underlined</span>' ), array( '[i]italic[/i]', - '<span style="font-style: italic">italic</span>' + '<span style="font-style:italic">italic</span>' ), array( '[color=#FF0000]colored[/color]', - '<span style="color: #FF0000">colored</span>' + '<span style="color:#FF0000">colored</span>' ), array( '[color=red]colored[/color]', - '<span style="color: red">colored</span>' + '<span style="color:red">colored</span>' ), array( '[size=75]smaller[/size]', - '<span style="font-size: 75%; line-height: normal">smaller</span>' + '<span style="font-size:75%;line-height:normal">smaller</span>' ), array( '[quote]quoted[/quote]', @@ -102,31 +102,31 @@ class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case ), array( '[list=1][*]item[/list]', - '<ol style="list-style-type: decimal"><li>item</li></ol>' + '<ol style="list-style-type:decimal"><li>item</li></ol>' ), array( '[list=a][*]item[/list]', - '<ol style="list-style-type: lower-alpha"><li>item</li></ol>' + '<ol style="list-style-type:lower-alpha"><li>item</li></ol>' ), array( '[list=i][*]item[/list]', - '<ol style="list-style-type: lower-roman"><li>item</li></ol>' + '<ol style="list-style-type:lower-roman"><li>item</li></ol>' ), array( '[list=I][*]item[/list]', - '<ol style="list-style-type: upper-roman"><li>item</li></ol>' + '<ol style="list-style-type:upper-roman"><li>item</li></ol>' ), array( '[list=disc][*]item[/list]', - '<ul style="list-style-type: disc"><li>item</li></ul>' + '<ul style="list-style-type:disc"><li>item</li></ul>' ), array( '[list=circle][*]item[/list]', - '<ul style="list-style-type: circle"><li>item</li></ul>' + '<ul style="list-style-type:circle"><li>item</li></ul>' ), array( '[list=square][*]item[/list]', - '<ul style="list-style-type: square"><li>item</li></ul>' + '<ul style="list-style-type:square"><li>item</li></ul>' ), array( '[img]https://area51.phpbb.com/images/area51.png[/img]', @@ -180,17 +180,17 @@ class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case array( // Allow textual bbcodes in textual bbcodes '[b]bold [i]bold + italic[/i][/b]', - '<span style="font-weight: bold">bold <span style="font-style: italic">bold + italic</span></span>' + '<span style="font-weight:bold">bold <span style="font-style:italic">bold + italic</span></span>' ), array( // Allow textual bbcodes in url with description '[url=https://area51.phpbb.com/]Area51 [i]italic[/i][/url]', - '<a href="https://area51.phpbb.com/" class="postlink">Area51 <span style="font-style: italic">italic</span></a>' + '<a href="https://area51.phpbb.com/" class="postlink">Area51 <span style="font-style:italic">italic</span></a>' ), array( // Allow url with description in textual bbcodes '[i]italic [url=https://area51.phpbb.com/]Area51[/url][/i]', - '<span style="font-style: italic">italic <a href="https://area51.phpbb.com/" class="postlink">Area51</a></span>' + '<span style="font-style:italic">italic <a href="https://area51.phpbb.com/" class="postlink">Area51</a></span>' ), array( // Do not parse textual bbcodes in code @@ -205,7 +205,7 @@ class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case array( // Textual bbcode nesting into textual bbcode '[b]bold [i]bold + italic[/b] italic[/i]', - '<span style="font-weight: bold">bold <span style="font-style: italic">bold + italic</span></span><span style="font-style: italic"> italic</span>' + '<span style="font-weight:bold">bold <span style="font-style:italic">bold + italic</span></span><span style="font-style:italic"> italic</span>' ), array( "[code]\tline1\n line2[/code]", @@ -298,7 +298,7 @@ class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case ), array( "Emoji: \xF0\x9F\x98\x80", - 'Emoji: <img alt="' . "\xF0\x9F\x98\x80" . '" class="emoji smilies" draggable="false" src="//cdn.jsdelivr.net/emojione/assets/svg/1f600.svg">' + 'Emoji: <img alt="' . "\xF0\x9F\x98\x80" . '" class="emoji smilies" draggable="false" src="//cdn.jsdelivr.net/emojione/assets/3.1/png/64/1f600.png">' ), array( "Emoji: \xF0\x9F\x98\x80", diff --git a/tests/text_formatter/s9e/factory_test.php b/tests/text_formatter/s9e/factory_test.php index fd9b4e4c09..d35330a975 100644 --- a/tests/text_formatter/s9e/factory_test.php +++ b/tests/text_formatter/s9e/factory_test.php @@ -248,6 +248,22 @@ class phpbb_textformatter_s9e_factory_test extends phpbb_database_test_case } /** + * @testdox Accepts unsafe default BBCodes + */ + public function test_unsafe_default_bbcodes() + { + $fixture = __DIR__ . '/fixtures/unsafe_default_bbcodes.xml'; + $style_dir = __DIR__ . '/fixtures/styles/'; + $container = $this->get_test_case_helpers()->set_s9e_services(null, $fixture, $style_dir); + $parser = $container->get('text_formatter.parser'); + $renderer = $container->get('text_formatter.renderer'); + + $original = '[b]alert(1)[/b]'; + $expected = '<script>alert(1)</script>'; + $this->assertSame($expected, $renderer->render($parser->parse($original))); + } + + /** * @testdox get_configurator() triggers events before and after configuration */ public function test_configure_events() diff --git a/tests/text_formatter/s9e/fixtures/styles/unsafe/template/bbcode.html b/tests/text_formatter/s9e/fixtures/styles/unsafe/template/bbcode.html new file mode 100644 index 0000000000..f3932f9b78 --- /dev/null +++ b/tests/text_formatter/s9e/fixtures/styles/unsafe/template/bbcode.html @@ -0,0 +1,40 @@ +<!-- BEGIN ulist_open --><ul style="list-style-type: {LIST_TYPE}"><!-- END ulist_open --> +<!-- BEGIN ulist_open_default --><ul><!-- END ulist_open_default --> +<!-- BEGIN ulist_close --></ul><!-- END ulist_close --> + +<!-- BEGIN olist_open --><ol style="list-style-type: {LIST_TYPE}"><!-- END olist_open --> +<!-- BEGIN olist_close --></ol><!-- END olist_close --> + +<!-- BEGIN listitem --><li><!-- END listitem --> +<!-- BEGIN listitem_close --></li><!-- END listitem_close --> + +<!-- BEGIN quote_username_open --><blockquote><div><cite>{USERNAME} {L_WROTE}{L_COLON}</cite><!-- END quote_username_open --> +<!-- BEGIN quote_open --><blockquote class="uncited"><div><!-- END quote_open --> +<!-- BEGIN quote_close --></div></blockquote><!-- END quote_close --> + +<!-- BEGIN code_open --><div class="codebox"><p>{L_CODE}{L_COLON} <a href="#" onclick="selectCode(this); return false;">{L_SELECT_ALL_CODE}</a></p><code><!-- END code_open --> +<!-- BEGIN code_close --></code></div><!-- END code_close --> + +<!-- BEGIN inline_attachment_open --><div class="inline-attachment"><!-- END inline_attachment_open --> +<!-- BEGIN inline_attachment_close --></div><!-- END inline_attachment_close --> + +<!-- BEGIN b_open --><script><!-- END b_open --> +<!-- BEGIN b_close --></script><!-- END b_close --> + +<!-- BEGIN u_open --><span style="text-decoration: underline"><!-- END u_open --> +<!-- BEGIN u_close --></span><!-- END u_close --> + +<!-- BEGIN i_open --><em><!-- END i_open --> +<!-- BEGIN i_close --></em><!-- END i_close --> + +<!-- BEGIN color --><span style="color: {COLOR}">{TEXT}</span><!-- END color --> + +<!-- BEGIN size --><span style="font-size: {SIZE}%; line-height: 116%;">{TEXT}</span><!-- END size --> + +<!-- BEGIN img --><img src="{URL}" class="postimage" alt="{L_IMAGE}" /><!-- END img --> + +<!-- BEGIN url --><a href="{URL}" class="postlink">{DESCRIPTION}</a><!-- END url --> + +<!-- BEGIN email --><a href="mailto:{EMAIL}">{DESCRIPTION}</a><!-- END email --> + +<!-- BEGIN flash --><object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=5,0,0,0" width="{WIDTH}" height="{HEIGHT}"><param name="movie" value="{URL}" /><param name="play" value="false" /><param name="loop" value="false" /><param name="quality" value="high" /><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /><embed src="{URL}" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="{WIDTH}" height="{HEIGHT}" play="false" loop="false" quality="high" allowscriptaccess="never" allownetworking="internal"></embed></object><!-- END flash --> diff --git a/tests/text_formatter/s9e/fixtures/unsafe_default_bbcodes.xml b/tests/text_formatter/s9e/fixtures/unsafe_default_bbcodes.xml new file mode 100644 index 0000000000..06524a13cc --- /dev/null +++ b/tests/text_formatter/s9e/fixtures/unsafe_default_bbcodes.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_styles"> + <column>style_id</column> + <column>style_name</column> + <column>style_copyright</column> + <column>style_active</column> + <column>style_path</column> + <column>bbcode_bitfield</column> + <column>style_parent_id</column> + <column>style_parent_tree</column> + + <row> + <value>1</value> + <value>unsafe</value> + <value></value> + <value>1</value> + <value>unsafe</value> + <value>QA==</value> + <value>0</value> + <value></value> + </row> + </table> +</dataset> diff --git a/tests/text_processing/tickets_data/PHPBB3-10122.html b/tests/text_processing/tickets_data/PHPBB3-10122.html index f0fb6115b2..0803c895a8 100644 --- a/tests/text_processing/tickets_data/PHPBB3-10122.html +++ b/tests/text_processing/tickets_data/PHPBB3-10122.html @@ -1 +1 @@ -<ul style="list-style-type: none"><li>This is my indented text</li></ul>
\ No newline at end of file +<ul style="list-style-type:none"><li>This is my indented text</li></ul>
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-10268.html b/tests/text_processing/tickets_data/PHPBB3-10268.html index c89e63f9a3..13b71b4823 100644 --- a/tests/text_processing/tickets_data/PHPBB3-10268.html +++ b/tests/text_processing/tickets_data/PHPBB3-10268.html @@ -1,4 +1,4 @@ <blockquote><div><cite><a href="http://phpbb.com" class="postlink">http://phpbb.com</a> wrote:</cite>...</div></blockquote> <blockquote><div><cite><a href="http://phpbb.com" class="postlink"> http://phpbb.com</a> wrote:</cite>...</div></blockquote> -<span style="font-weight: bold"><a href="http://phpbb.com" class="postlink">http://phpbb.com</a></span><br> -<span style="font-weight: bold"> <a href="http://phpbb.com" class="postlink">http://phpbb.com</a></span><br> +<span style="font-weight:bold"><a href="http://phpbb.com" class="postlink">http://phpbb.com</a></span><br> +<span style="font-weight:bold"> <a href="http://phpbb.com" class="postlink">http://phpbb.com</a></span><br> diff --git a/tests/text_processing/tickets_data/PHPBB3-13641.html b/tests/text_processing/tickets_data/PHPBB3-13641.html index 1bd1c06dbb..2646bc0ea5 100644 --- a/tests/text_processing/tickets_data/PHPBB3-13641.html +++ b/tests/text_processing/tickets_data/PHPBB3-13641.html @@ -1 +1 @@ -<code>[color=#FF0000]</code> - <span style="color: #FF0000">red</span>
\ No newline at end of file +<code>[color=#FF0000]</code> - <span style="color:#FF0000">red</span>
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-13921.html b/tests/text_processing/tickets_data/PHPBB3-13921.html index 6a9dc7f504..690668ef28 100644 --- a/tests/text_processing/tickets_data/PHPBB3-13921.html +++ b/tests/text_processing/tickets_data/PHPBB3-13921.html @@ -1 +1 @@ -<span style="font-size: 200%; line-height: normal"></span><div style="text-align:center"><span style="font-size: 200%; line-height: normal">xxx</span></div>
\ No newline at end of file +<span style="font-size:200%;line-height:normal"></span><div style="text-align:center"><span style="font-size:200%;line-height:normal">xxx</span></div>
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-14706.html b/tests/text_processing/tickets_data/PHPBB3-14706.html index b8f74c9e93..23b3304485 100644 --- a/tests/text_processing/tickets_data/PHPBB3-14706.html +++ b/tests/text_processing/tickets_data/PHPBB3-14706.html @@ -1 +1 @@ -<ul><li><ol style="list-style-type: lower-alpha"><li>a</li><li>b</li><li>c</li><li>d</li><li>e</li></ol></li><li>outer</li></ul>
\ No newline at end of file +<ul><li><ol style="list-style-type:lower-alpha"><li>a</li><li>b</li><li>c</li><li>d</li><li>e</li></ol></li><li>outer</li></ul>
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-14790.html b/tests/text_processing/tickets_data/PHPBB3-14790.html index 7624b2d36c..5384098e1b 100644 --- a/tests/text_processing/tickets_data/PHPBB3-14790.html +++ b/tests/text_processing/tickets_data/PHPBB3-14790.html @@ -1,4 +1,4 @@ -<span style="color: #0000FF"></span><ul><li><span style="color: #0000FF">text</span></li> -<li><span style="color: #0000FF">text</span></li> -<li><span style="color: #0000FF">text</span></li> -<li><span style="color: #0000FF">text</span></li></ul>
\ No newline at end of file +<span style="color:#0000FF"></span><ul><li><span style="color:#0000FF">text</span></li> +<li><span style="color:#0000FF">text</span></li> +<li><span style="color:#0000FF">text</span></li> +<li><span style="color:#0000FF">text</span></li></ul>
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-14846.html b/tests/text_processing/tickets_data/PHPBB3-14846.html index 461ca25bc6..bd4455781b 100644 --- a/tests/text_processing/tickets_data/PHPBB3-14846.html +++ b/tests/text_processing/tickets_data/PHPBB3-14846.html @@ -1 +1 @@ -<div style="padding: .2em .5em; font-size: .8em; width: 200px; background: #FFD;">moderator text<div style="font-weight: bold; text-align: right">- Mickroz</div></div>
\ No newline at end of file +<div style="padding:.2em .5em;font-size:.8em;width:200px;background:#ffd">moderator text<div style="font-weight:bold;text-align:right">- Mickroz</div></div>
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-15348.html b/tests/text_processing/tickets_data/PHPBB3-15348.html index e65925ec28..5d44c07899 100644 --- a/tests/text_processing/tickets_data/PHPBB3-15348.html +++ b/tests/text_processing/tickets_data/PHPBB3-15348.html @@ -1 +1 @@ -<img class="smilies" src="phpBB/images/smilies/icon_e_surprised.gif" width="15" height="17" alt=":o" title="First half of :ok:"> <img class="smilies" src="phpBB/images/smilies/icon_lol.gif" width="15" height="17" alt="k:" title="Second half of :ok:"> <img alt=":ok:" class="emoji smilies" draggable="false" src="//cdn.jsdelivr.net/emojione/assets/svg/1f197.svg">
\ No newline at end of file +<img class="smilies" src="phpBB/images/smilies/icon_e_surprised.gif" width="15" height="17" alt=":o" title="First half of :ok:"> <img class="smilies" src="phpBB/images/smilies/icon_lol.gif" width="15" height="17" alt="k:" title="Second half of :ok:"> <img alt=":ok:" class="emoji smilies" draggable="false" src="//cdn.jsdelivr.net/emojione/assets/3.1/png/64/1f197.png">
\ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-8419.html b/tests/text_processing/tickets_data/PHPBB3-8419.html index 38df626a94..df91e9df50 100644 --- a/tests/text_processing/tickets_data/PHPBB3-8419.html +++ b/tests/text_processing/tickets_data/PHPBB3-8419.html @@ -1 +1 @@ -<span style="font-style: italic"><span style="font-weight: bold"><span style="color: #FF0000">tę </span></span></span>przykład
\ No newline at end of file +<span style="font-style:italic"><span style="font-weight:bold"><span style="color:red">tę </span></span></span>przykład
\ No newline at end of file diff --git a/tests/text_reparser/base_test.php b/tests/text_reparser/base_test.php index af2d56ea51..2c6844b063 100644 --- a/tests/text_reparser/base_test.php +++ b/tests/text_reparser/base_test.php @@ -66,4 +66,19 @@ class phpbb_textreparser_base_test extends phpbb_database_test_case $this->get_rows(array(1)) ); } + + public function test_reparse_case_insensitive() + { + $this->get_reparser()->reparse_range(2, 2); + + $this->assertEquals( + [ + [ + 'id' => '2', + 'text' => '<r><IMG src="img.png"><s>[IMG]</s>img.png<e>[/IMG]</e></IMG></r>' + ] + ], + $this->get_rows([2]) + ); + } } diff --git a/tests/text_reparser/fixtures/base.xml b/tests/text_reparser/fixtures/base.xml index a4921a8823..532a19a8a9 100644 --- a/tests/text_reparser/fixtures/base.xml +++ b/tests/text_reparser/fixtures/base.xml @@ -15,5 +15,13 @@ <value></value> <value>abcd1234</value> </row> + <row> + <value>2</value> + <value>1</value> + <value>1</value> + <value>1</value> + <value><![CDATA[<r><IMG src="img.png"><s>[IMG]</s>img.png<e>[/IMG]</e></IMG></r>]]></value> + <value></value> + </row> </table> </dataset> |