From 428ea2f34ebc1f76780e049c969f22ad9355bdd6 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sat, 1 Feb 2020 08:09:30 +0100 Subject: [PATCH] adding test that expects parameters of php translation to get HTML entities to get encoded --- tst/I18nTest.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tst/I18nTest.php b/tst/I18nTest.php index f366720a..658ceb18 100644 --- a/tst/I18nTest.php +++ b/tst/I18nTest.php @@ -155,6 +155,13 @@ class I18nTest extends PHPUnit_Framework_TestCase $this->assertEquals('some string + 1', I18n::_('some %s + %d', 'string', 1), 'browser language en'); } + public function testHtmlEntityEncoding() + { + $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'foobar'; + I18n::loadTranslations(); + $this->assertEquals('some ' . htmlentities('&<>"\'/`=', ENT_QUOTES | ENT_XHTML | ENT_DISALLOWED, 'UTF-8') . ' + 1', I18n::_('some %s + %d', '&<>"\'/`=', 1), 'browser language en'); + } + public function testMessageIdsExistInAllLanguages() { $messageIds = array();