Explorar o código

adding test that expects parameters of php translation to get HTML entities to get encoded

El RIDO %!s(int64=6) %!d(string=hai) anos
pai
achega
79d30c9410
Modificáronse 1 ficheiros con 7 adicións e 0 borrados
  1. 7 0
      tst/I18nTest.php

+ 7 - 0
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();