From 13a756bfb7f73bdbd89e178617345afa18210b69 Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Thu, 21 Jul 2016 03:37:44 +0200 Subject: [ticket/14700] Prevent an exception on duplicate smilies in text_formatter PHPBB3-14700 --- tests/text_formatter/s9e/factory_test.php | 11 ++++++++ .../s9e/fixtures/smilies_duplicate.xml | 33 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 tests/text_formatter/s9e/fixtures/smilies_duplicate.xml (limited to 'tests/text_formatter') diff --git a/tests/text_formatter/s9e/factory_test.php b/tests/text_formatter/s9e/factory_test.php index e74337decc..368b8a4f4b 100644 --- a/tests/text_formatter/s9e/factory_test.php +++ b/tests/text_formatter/s9e/factory_test.php @@ -170,6 +170,17 @@ class phpbb_textformatter_s9e_factory_test extends phpbb_database_test_case ); } + public function test_duplicate_smilies() + { + $fixture = __DIR__ . '/fixtures/smilies_duplicate.xml'; + $parser = $this->get_test_case_helpers()->set_s9e_services(null, $fixture)->get('text_formatter.parser'); + + $this->assertSame( + ':)', + $parser->parse(':)') + ); + } + /** * @testdox {INTTEXT} is supported in custom BBCodes */ diff --git a/tests/text_formatter/s9e/fixtures/smilies_duplicate.xml b/tests/text_formatter/s9e/fixtures/smilies_duplicate.xml new file mode 100644 index 0000000000..9645f3e516 --- /dev/null +++ b/tests/text_formatter/s9e/fixtures/smilies_duplicate.xml @@ -0,0 +1,33 @@ + + + + smiley_id + code + emotion + smiley_url + smiley_width + smiley_height + smiley_order + display_on_posting + + 1 + :) + :) + foo.png + 15 + 17 + 2 + 1 + + + 2 + :) + :) + bar.png + 15 + 17 + 2 + 2 + +
+
-- cgit v1.2.1