aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/phpbb/textformatter/s9e/factory.php2
-rw-r--r--tests/text_formatter/s9e/factory_test.php11
-rw-r--r--tests/text_formatter/s9e/fixtures/smilies_duplicate.xml33
3 files changed, 45 insertions, 1 deletions
diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php
index 8d1c0fabfe..916fdff909 100644
--- a/phpBB/phpbb/textformatter/s9e/factory.php
+++ b/phpBB/phpbb/textformatter/s9e/factory.php
@@ -309,7 +309,7 @@ class factory implements \phpbb\textformatter\cache_interface
// Load smilies
foreach ($this->data_access->get_smilies() as $row)
{
- $configurator->Emoticons->add(
+ $configurator->Emoticons->set(
$row['code'],
'<img class="smilies" src="{$T_SMILIES_PATH}/' . htmlspecialchars($row['smiley_url']) . '" alt="{.}" title="' . htmlspecialchars($row['emotion']) . '"/>'
);
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(
+ '<r><E>:)</E></r>',
+ $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 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<dataset>
+ <table name="phpbb_smilies">
+ <column>smiley_id</column>
+ <column>code</column>
+ <column>emotion</column>
+ <column>smiley_url</column>
+ <column>smiley_width</column>
+ <column>smiley_height</column>
+ <column>smiley_order</column>
+ <column>display_on_posting</column>
+ <row>
+ <value>1</value>
+ <value>:)</value>
+ <value>:)</value>
+ <value>foo.png</value>
+ <value>15</value>
+ <value>17</value>
+ <value>2</value>
+ <value>1</value>
+ </row>
+ <row>
+ <value>2</value>
+ <value>:)</value>
+ <value>:)</value>
+ <value>bar.png</value>
+ <value>15</value>
+ <value>17</value>
+ <value>2</value>
+ <value>2</value>
+ </row>
+ </table>
+</dataset>