_localization = new Localization(); } function stringsProvider() { return array( array( '7cvU3iDI5d7L7O3TIOUg1cfU7N0g3c4g5ezR1NPd5eHU3csg287a', 'يثشق بهقثىيس ه صاشىف فخ هىرشسفهلشفث غخع', 'windows-1256' ), array( '7cjT7cjU0+3IwcbExNE=', 'يبسيبشسيبءئؤؤر', 'windows-1256' ), array( // params related to 45059 ticket 'GyRCJWYhPCU2TD4bKEI=', 'ユーザ名', 'ISO-2022-JP' ), array ( 'RnJvbTog6eXh7CD55eTt', 'From: יובל שוהם', 'ISO-8859-8' ), array ( 'srvSqtaxytPEsMn6yMu1xNHbvqYK', "不要直视陌生人的眼睛\n", 'GB2312' ), //Not a good test case /* array ( // what happens when we post a dummy charset? base64_encode("12345"), "12345", " " ) */ ); } /** * Test convert base64 $source to string and convert string from $encoding to utf8. It has to return $utf8string. * * @dataProvider stringsProvider * @ticket 35413, 45059 * @param string $source base64 encoded string in native charset * @param string $utf8string previous string in utf8 * @param string $encoding encoding of native string */ public function testEncodings($source, $utf8string, $encoding) { $source = base64_decode($source); $translateCharsetResult = $this->_localization->translateCharset($source, $encoding, 'UTF-8'); $this->assertEquals($utf8string, $translateCharsetResult, 'Strings have to be the same'); } }