mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 13:30:25 +02:00
[ticket/13803] Added tests, fixed param order in generate_text_for_storage()
PHPBB3-13803
This commit is contained in:
@@ -12,7 +12,47 @@
|
||||
<value>1</value>
|
||||
<value>1</value>
|
||||
<value>1</value>
|
||||
<value>Plain text</value>
|
||||
<value>This post should be [b]ignored[/b]</value>
|
||||
<value>abcd1234</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>2</value>
|
||||
<value>0</value>
|
||||
<value>0</value>
|
||||
<value>0</value>
|
||||
<value>[b]Not bold[/b] :) http://example.org</value>
|
||||
<value>abcd1234</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>3</value>
|
||||
<value>1</value>
|
||||
<value>0</value>
|
||||
<value>0</value>
|
||||
<value>[b:abcd1234]Bold[/b:abcd1234] :) http://example.org</value>
|
||||
<value>abcd1234</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>4</value>
|
||||
<value>0</value>
|
||||
<value>1</value>
|
||||
<value>0</value>
|
||||
<value><![CDATA[[b]Not bold[/b] <!-- s:) --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!-- s:) --> http://example.org]]></value>
|
||||
<value>abcd1234</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>5</value>
|
||||
<value>0</value>
|
||||
<value>0</value>
|
||||
<value>1</value>
|
||||
<value><![CDATA[[b]Not bold[/b] :) <!-- m --><a class="postlink" href="http://example.org">http://example.org</a><!-- m -->]]></value>
|
||||
<value>abcd1234</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>1000</value>
|
||||
<value>1</value>
|
||||
<value>1</value>
|
||||
<value>1</value>
|
||||
<value>This post should be [b]ignored[/b]</value>
|
||||
<value>abcd1234</value>
|
||||
</row>
|
||||
</table>
|
||||
|
@@ -40,9 +40,15 @@ class phpbb_textreparser_post_text_test extends phpbb_database_test_case
|
||||
$db = $this->new_dbal();
|
||||
$reparser = new \phpbb\textreparser\plugins\post_text($db);
|
||||
$reparser->reparse_range($min_id, $max_id);
|
||||
|
||||
$post_ids = array();
|
||||
foreach ($expected as $row)
|
||||
{
|
||||
$post_ids[] = $row['post_id'];
|
||||
}
|
||||
$sql = 'SELECT post_id, post_text
|
||||
FROM ' . POSTS_TABLE . "
|
||||
WHERE post_id BETWEEN $min_id AND $max_id";
|
||||
FROM ' . POSTS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('post_id', $post_ids);
|
||||
$result = $db->sql_query($sql);
|
||||
$rows = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
@@ -53,13 +59,33 @@ class phpbb_textreparser_post_text_test extends phpbb_database_test_case
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
1,
|
||||
1,
|
||||
2,
|
||||
5,
|
||||
array(
|
||||
array(
|
||||
'post_id' => 1,
|
||||
'post_text' => '<t>Plain text</t>'
|
||||
)
|
||||
'post_text' => 'This post should be [b]ignored[/b]',
|
||||
),
|
||||
array(
|
||||
'post_id' => 2,
|
||||
'post_text' => '<t>[b]Not bold[/b] :) http://example.org</t>',
|
||||
),
|
||||
array(
|
||||
'post_id' => 3,
|
||||
'post_text' => '<r><B><s>[b]</s>Bold<e>[/b]</e></B> :) http://example.org</r>',
|
||||
),
|
||||
array(
|
||||
'post_id' => 4,
|
||||
'post_text' => '<r>[b]Not bold[/b] <E>:)</E> http://example.org</r>',
|
||||
),
|
||||
array(
|
||||
'post_id' => 5,
|
||||
'post_text' => '<r>[b]Not bold[/b] :) <URL url="http://example.org">http://example.org</URL></r>',
|
||||
),
|
||||
array(
|
||||
'post_id' => 1000,
|
||||
'post_text' => 'This post should be [b]ignored[/b]',
|
||||
),
|
||||
)
|
||||
),
|
||||
);
|
||||
|
Reference in New Issue
Block a user