aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNicofuma <github@nicofuma.fr>2015-05-14 17:13:33 +0200
committerNicofuma <github@nicofuma.fr>2015-05-14 17:13:33 +0200
commita3e487e0f8f103f9ab2044af87cffcfbfcae45ce (patch)
tree648a4f9c852e435d136c1c8f2274ce97a490970f /tests
parentba9ac01dc0dc5297ce613ff3ca62cec9e5d1a8fc (diff)
parente5a167e6c2fb3159c1b8ac1587e39994ef4fb553 (diff)
downloadforums-a3e487e0f8f103f9ab2044af87cffcfbfcae45ce.tar
forums-a3e487e0f8f103f9ab2044af87cffcfbfcae45ce.tar.gz
forums-a3e487e0f8f103f9ab2044af87cffcfbfcae45ce.tar.bz2
forums-a3e487e0f8f103f9ab2044af87cffcfbfcae45ce.tar.xz
forums-a3e487e0f8f103f9ab2044af87cffcfbfcae45ce.zip
Merge pull request #3582 from s9e/ticket/13805
[ticket/13805] Updated generate_text_for_storage() to match message_parser
Diffstat (limited to 'tests')
-rw-r--r--tests/text_processing/generate_text_for_storage_test.php120
1 files changed, 115 insertions, 5 deletions
diff --git a/tests/text_processing/generate_text_for_storage_test.php b/tests/text_processing/generate_text_for_storage_test.php
index ffa06e4e02..474f6d8f0f 100644
--- a/tests/text_processing/generate_text_for_storage_test.php
+++ b/tests/text_processing/generate_text_for_storage_test.php
@@ -12,6 +12,7 @@
*/
require_once __DIR__ . '/../../phpBB/includes/functions.php';
+require_once __DIR__ . '/../../phpBB/includes/functions_compatibility.php';
require_once __DIR__ . '/../../phpBB/includes/functions_content.php';
require_once __DIR__ . '/../../phpBB/includes/utf/utf_tools.php';
@@ -36,7 +37,7 @@ class phpbb_text_processing_generate_text_for_storage_test extends phpbb_test_ca
/**
* @dataProvider get_text_formatter_tests
*/
- public function test_text_formatter($original, $expected, $allow_bbcode = true, $allow_urls = true, $allow_smilies = true, $setup = null)
+ public function test_text_formatter($original, $expected, $allow_bbcode, $allow_urls, $allow_smilies, $allow_img_bbcode, $allow_flash_bbcode, $allow_quote_bbcode, $allow_url_bbcode, $setup = null)
{
$actual = $original;
$uid = '';
@@ -48,7 +49,7 @@ class phpbb_text_processing_generate_text_for_storage_test extends phpbb_test_ca
$setup();
}
- generate_text_for_storage($actual, $uid, $bitfield, $flags, $allow_bbcode, $allow_urls, $allow_smilies);
+ generate_text_for_storage($actual, $uid, $bitfield, $flags, $allow_bbcode, $allow_urls, $allow_smilies, $allow_img_bbcode, $allow_flash_bbcode, $allow_quote_bbcode, $allow_url_bbcode);
$this->assertSame($expected, $actual);
}
@@ -58,15 +59,124 @@ class phpbb_text_processing_generate_text_for_storage_test extends phpbb_test_ca
return array(
array(
'Hello world',
- '<t>Hello world</t>'
+ '<t>Hello world</t>',
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
),
array(
'Hello [url=http://example.org]world[/url] :)',
- '<r>Hello <URL url="http://example.org"><s>[url=http://example.org]</s>world<e>[/url]</e></URL> <E>:)</E></r>'
+ '<r>Hello <URL url="http://example.org"><s>[url=http://example.org]</s>world<e>[/url]</e></URL> <E>:)</E></r>',
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
),
array(
'&<>"\'',
- '<t>&amp;&lt;&gt;"\'</t>'
+ '<t>&amp;&lt;&gt;"\'</t>',
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ ),
+ array(
+ '[b]..[/b] http://example.org :) [img]http://example.org/img.png[/img] [flash=123,123]http://example.org/flash.swf[/flash] [quote]...[/quote] [url]http://example.org[/url]',
+ '<t>[b]..[/b] http://example.org :) [img]http://example.org/img.png[/img] [flash=123,123]http://example.org/flash.swf[/flash] [quote]...[/quote] [url]http://example.org[/url]</t>',
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ ),
+ array(
+ '[b]..[/b] http://example.org :) [img]http://example.org/img.png[/img] [flash=123,123]http://example.org/flash.swf[/flash] [quote]...[/quote] [url]http://example.org[/url]',
+ '<r><B><s>[b]</s>..<e>[/b]</e></B> http://example.org :) [img]http://example.org/img.png[/img] [flash=123,123]http://example.org/flash.swf[/flash] [quote]...[/quote] [url]http://example.org[/url]</r>',
+ true,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ ),
+ array(
+ '[b]..[/b] http://example.org :) [img]http://example.org/img.png[/img] [flash=123,123]http://example.org/flash.swf[/flash] [quote]...[/quote] [url]http://example.org[/url]',
+ '<r>[b]..[/b] <URL url="http://example.org">http://example.org</URL> :) [img]<URL url="http://example.org/img.png">http://example.org/img.png</URL>[/img] [flash=123,123]<URL url="http://example.org/flash.swf">http://example.org/flash.swf</URL>[/flash] [quote]...[/quote] [url]<URL url="http://example.org">http://example.org</URL>[/url]</r>',
+ false,
+ true,
+ false,
+ false,
+ false,
+ false,
+ true,
+ ),
+ array(
+ '[b]..[/b] http://example.org :) [img]http://example.org/img.png[/img] [flash=123,123]http://example.org/flash.swf[/flash] [quote]...[/quote] [url]http://example.org[/url]',
+ '<r>[b]..[/b] http://example.org <E>:)</E> [img]http://example.org/img.png[/img] [flash=123,123]http://example.org/flash.swf[/flash] [quote]...[/quote] [url]http://example.org[/url]</r>',
+ false,
+ false,
+ true,
+ false,
+ false,
+ false,
+ false,
+ ),
+ array(
+ '[b]..[/b] http://example.org :) [img]http://example.org/img.png[/img] [flash=123,123]http://example.org/flash.swf[/flash] [quote]...[/quote] [url]http://example.org[/url]',
+ '<r><B><s>[b]</s>..<e>[/b]</e></B> http://example.org :) <IMG src="http://example.org/img.png"><s>[img]</s>http://example.org/img.png<e>[/img]</e></IMG> [flash=123,123]http://example.org/flash.swf[/flash] [quote]...[/quote] [url]http://example.org[/url]</r>',
+ true,
+ false,
+ false,
+ true,
+ false,
+ false,
+ false,
+ ),
+ array(
+ '[b]..[/b] http://example.org :) [img]http://example.org/img.png[/img] [flash=123,123]http://example.org/flash.swf[/flash] [quote]...[/quote] [url]http://example.org[/url]',
+ '<r><B><s>[b]</s>..<e>[/b]</e></B> http://example.org :) [img]http://example.org/img.png[/img] <FLASH height="123" url="http://example.org/flash.swf" width="123"><s>[flash=123,123]</s>http://example.org/flash.swf<e>[/flash]</e></FLASH> [quote]...[/quote] [url]http://example.org[/url]</r>',
+ true,
+ false,
+ false,
+ false,
+ true,
+ false,
+ false,
+ ),
+ array(
+ '[b]..[/b] http://example.org :) [img]http://example.org/img.png[/img] [flash=123,123]http://example.org/flash.swf[/flash] [quote]...[/quote] [url]http://example.org[/url]',
+ '<r><B><s>[b]</s>..<e>[/b]</e></B> http://example.org :) [img]http://example.org/img.png[/img] [flash=123,123]http://example.org/flash.swf[/flash] <QUOTE><s>[quote]</s>...<e>[/quote]</e></QUOTE> [url]http://example.org[/url]</r>',
+ true,
+ false,
+ false,
+ false,
+ false,
+ true,
+ false,
+ ),
+ array(
+ '[b]..[/b] http://example.org :) [img]http://example.org/img.png[/img] [flash=123,123]http://example.org/flash.swf[/flash] [quote]...[/quote] [url]http://example.org[/url]',
+ '<r><B><s>[b]</s>..<e>[/b]</e></B> http://example.org :) [img]http://example.org/img.png[/img] [flash=123,123]http://example.org/flash.swf[/flash] [quote]...[/quote] <URL url="http://example.org"><s>[url]</s>http://example.org<e>[/url]</e></URL></r>',
+ true,
+ false,
+ false,
+ false,
+ false,
+ false,
+ true,
),
);
}