aboutsummaryrefslogtreecommitdiffstats
path: root/tests/text_formatter/s9e
diff options
context:
space:
mode:
authorTristan Darricau <tristan.darricau@sensiolabs.com>2015-07-07 09:46:36 +0200
committerTristan Darricau <tristan.darricau@sensiolabs.com>2015-07-07 09:46:36 +0200
commitd54aa190f1f955fe33342c939520c0155a860010 (patch)
treee256042bbfb5f6d21080044331d50507d34bab2f /tests/text_formatter/s9e
parentca5d4fd31031a47cc3a485457473b82660b84ed1 (diff)
parent9d364aee4a739d0a8c8b745449940a37d81c9abf (diff)
downloadforums-d54aa190f1f955fe33342c939520c0155a860010.tar
forums-d54aa190f1f955fe33342c939520c0155a860010.tar.gz
forums-d54aa190f1f955fe33342c939520c0155a860010.tar.bz2
forums-d54aa190f1f955fe33342c939520c0155a860010.tar.xz
forums-d54aa190f1f955fe33342c939520c0155a860010.zip
Merge pull request #3623 from s9e/ticket/10620
[ticket/10620] Quote improvements
Diffstat (limited to 'tests/text_formatter/s9e')
-rw-r--r--tests/text_formatter/s9e/default_formatting_test.php29
-rw-r--r--tests/text_formatter/s9e/utils_test.php40
2 files changed, 65 insertions, 4 deletions
diff --git a/tests/text_formatter/s9e/default_formatting_test.php b/tests/text_formatter/s9e/default_formatting_test.php
index 4829e9bbc8..c67976301f 100644
--- a/tests/text_formatter/s9e/default_formatting_test.php
+++ b/tests/text_formatter/s9e/default_formatting_test.php
@@ -229,13 +229,40 @@ class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case
'<blockquote><div><cite><a href="http://example.org" class="postlink">http://example.org</a> wrote:</cite>...</div></blockquote>'
),
array(
- '[quote="http://example.org"]...[/quote]',
+ '[quote=http://example.org]...[/quote]',
'<blockquote><div><cite><a href="http://example.org" class="postlink">http://example.org</a> wrote:</cite>...</div></blockquote>'
),
array(
"[quote]\nThis is a long quote that is definitely going to exceed 80 characters\n[/quote]\n\nFollowed by a reply",
"<blockquote class=\"uncited\"><div>\nThis is a long quote that is definitely going to exceed 80 characters\n</div></blockquote>\n\nFollowed by a reply"
),
+ array(
+ '[quote=Username post_id=123]...[/quote]',
+ '<blockquote><div><cite>Username wrote: <a href="phpBB/viewtopic.php?p=123#p123" data-post-id="123" onclick="if(document.getElementById(hash.substr(1)))href=hash">↑</a></cite>...</div></blockquote>'
+ ),
+ array(
+ // Users are not allowed to submit their own URL for the post
+ '[quote="Username" post_url="http://fake.example.org"]...[/quote]',
+ '<blockquote><div><cite>Username wrote:</cite>...</div></blockquote>'
+ ),
+ array(
+ '[quote=Username time=58705871]...[/quote]',
+ '<blockquote><div><cite>Username wrote:<div class="responsive-hide">1971-11-11 11:11:11</div></cite>...</div></blockquote>'
+ ),
+ array(
+ '[quote=Username user_id=123]...[/quote]',
+ '<blockquote><div><cite><a href="phpBB/memberlist.php?mode=viewprofile&amp;u=123">Username</a> wrote:</cite>...</div></blockquote>'
+ ),
+ array(
+ // Users are not allowed to submit their own URL for the profile
+ '[quote=Username profile_url=http://fake.example.org]...[/quote]',
+ '<blockquote><div><cite>Username wrote:</cite>...</div></blockquote>'
+ ),
+ array(
+ // From phpbb_textformatter_s9e_utils_test::test_generate_quote()
+ '[quote=\'[quote="foo"]\']...[/quote]',
+ '<blockquote><div><cite>[quote="foo"] wrote:</cite>...</div></blockquote>'
+ ),
);
}
}
diff --git a/tests/text_formatter/s9e/utils_test.php b/tests/text_formatter/s9e/utils_test.php
index 152c316b2e..1c03783792 100644
--- a/tests/text_formatter/s9e/utils_test.php
+++ b/tests/text_formatter/s9e/utils_test.php
@@ -98,11 +98,15 @@ class phpbb_textformatter_s9e_utils_test extends phpbb_test_case
array('foo')
),
array(
- '[quote="foo"]..[/quote] [quote="bar"]..[/quote]',
+ '[quote=foo]..[/quote] [quote]..[/quote]',
+ array('foo')
+ ),
+ array(
+ '[quote=foo]..[/quote] [quote=bar]..[/quote]',
array('foo', 'bar')
),
array(
- '[quote="foo"].[quote="baz"]..[/quote].[/quote] [quote="bar"]..[/quote]',
+ '[quote=foo].[quote=baz]..[/quote].[/quote] [quote=bar]..[/quote]',
array('foo', 'bar')
),
);
@@ -169,7 +173,37 @@ class phpbb_textformatter_s9e_utils_test extends phpbb_test_case
'post_id' => 123,
'url' => 'http://example.org'
),
- '[quote="user" post_id="123" url="http://example.org"]...[/quote]',
+ '[quote=user post_id=123 url=http://example.org]...[/quote]',
+ ),
+ array(
+ '...',
+ array('author' => ' '),
+ '[quote=" "]...[/quote]',
+ ),
+ array(
+ '...',
+ array('author' => 'foo bar'),
+ '[quote="foo bar"]...[/quote]',
+ ),
+ array(
+ '...',
+ array('author' => '\\'),
+ '[quote="\\\\"]...[/quote]',
+ ),
+ array(
+ '...',
+ array('author' => '[quote="foo"]'),
+ '[quote=\'[quote="foo"]\']...[/quote]',
+ ),
+ array(
+ '...',
+ array('author' => '""'),
+ '[quote=\'""\']...[/quote]',
+ ),
+ array(
+ '...',
+ array('author' => "''"),
+ '[quote="\'\'"]...[/quote]',
),
array(
'This is a long quote that is definitely going to exceed 80 characters',