diff options
author | Tristan Darricau <tristan.darricau@sensiolabs.com> | 2015-05-29 15:42:14 +0200 |
---|---|---|
committer | Tristan Darricau <tristan.darricau@sensiolabs.com> | 2015-05-29 15:42:14 +0200 |
commit | f5dbc3b6f269cb3841c20ad0096fcedb3dac7492 (patch) | |
tree | 5ca32d171af32f236d82cbf11cedfe3735c5fa3d /tests/text_formatter | |
parent | 3c3b099f88471e05358fe3c01bb74caac69e89e7 (diff) | |
parent | 64e1824abdb2a9c860e049f10ecc81c051160ff5 (diff) | |
download | forums-f5dbc3b6f269cb3841c20ad0096fcedb3dac7492.tar forums-f5dbc3b6f269cb3841c20ad0096fcedb3dac7492.tar.gz forums-f5dbc3b6f269cb3841c20ad0096fcedb3dac7492.tar.bz2 forums-f5dbc3b6f269cb3841c20ad0096fcedb3dac7492.tar.xz forums-f5dbc3b6f269cb3841c20ad0096fcedb3dac7492.zip |
Merge pull request #3616 from s9e/ticket/13847
[ticket/13847] Move quote generation to text_formatter.utils
Diffstat (limited to 'tests/text_formatter')
-rw-r--r-- | tests/text_formatter/s9e/utils_test.php | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/text_formatter/s9e/utils_test.php b/tests/text_formatter/s9e/utils_test.php index b1b937709c..555f29cb38 100644 --- a/tests/text_formatter/s9e/utils_test.php +++ b/tests/text_formatter/s9e/utils_test.php @@ -109,6 +109,72 @@ class phpbb_textformatter_s9e_utils_test extends phpbb_test_case } /** + * @dataProvider get_generate_quote_tests + */ + public function test_generate_quote($text, $params, $expected) + { + $container = $this->get_test_case_helpers()->set_s9e_services(); + $utils = $container->get('text_formatter.utils'); + + $this->assertSame($expected, $utils->generate_quote($text, $params)); + } + + public function get_generate_quote_tests() + { + return array( + array( + '...', + array(), + '[quote]...[/quote]', + ), + array( + '...', + array('author' => 'Brian Kibler'), + '[quote="Brian Kibler"]...[/quote]', + ), + array( + '...', + array('author' => 'Brian "Brian Kibler" Kibler of Brian Kibler Gaming'), + '[quote=\'Brian "Brian Kibler" Kibler of Brian Kibler Gaming\']...[/quote]', + ), + array( + '...', + array('author' => "Brian Kibler Gaming's Brian Kibler"), + '[quote="Brian Kibler Gaming\'s Brian Kibler"]...[/quote]', + ), + array( + '...', + array('author' => "\\\"'"), + '[quote="\\\\\\"\'"]...[/quote]', + ), + array( + '...', + array('author' => 'Lots of doubles """ one single \' one backslash \\'), + '[quote=\'Lots of doubles """ one single \\\' one backslash \\\\\']...[/quote]', + ), + array( + '...', + array('author' => "Lots of singles ''' one double \" one backslash \\"), + '[quote="Lots of singles \'\'\' one double \\" one backslash \\\\"]...[/quote]', + ), + array( + '...', + array('author' => 'Defaults to doublequotes """\'\'\''), + '[quote="Defaults to doublequotes \\"\\"\\"\'\'\'"]...[/quote]', + ), + array( + '...', + array( + 'author' => 'user', + 'post_id' => 123, + 'url' => 'http://example.org' + ), + '[quote="user" post_id="123" url="http://example.org"]...[/quote]', + ), + ); + } + + /** * @dataProvider get_remove_bbcode_tests */ public function test_remove_bbcode($original, $name, $depth, $expected) |