From 79d30c941075f088b8ead191e2b62dee7e3f98c6 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 de163490..2c652ea7 100644 --- a/tst/I18nTest.php +++ b/tst/I18nTest.php @@ -143,6 +143,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();