Esempio n. 1
0
 function test_preforward_non_utf8()
 {
     $controller = new Ethna_Controller_Dummy();
     $form = new Ethna_ActionForm_Dummy($controller);
     $controller->setActionForm($form);
     $backend = $controller->getBackend();
     $backend->setActionForm($form);
     $view = new Ethna_View_Json($backend, "dummy", "");
     $controller->setClientEncoding('EUC-JP');
     ob_start();
     $param = array("a", "あいうえ");
     mb_convert_variables('EUC-JP', 'UTF-8', $param);
     @$view->preforward($param);
     @$view->forward();
     $content = ob_get_clean();
     $this->assertEquals($content, '["a","\\u3042\\u3044\\u3046\\u3048"]');
 }
Esempio n. 2
0
 public function _execute_smarty_modifier_wordwrap_i18n($expected, $input_str, $width, $break = "\n", $indent = 0)
 {
     unset($GLOBALS['_Ethna_Controller_Dummy']);
     $ctl = new Ethna_Controller_Dummy();
     $actual = smarty_modifier_wordwrap_i18n($input_str, $width, $break, $indent);
     $this->assertEquals($expected, $actual);
     unset($GLOBALS['_Ethna_Controller_Dummy']);
     //     SJIS
     $ctl = new Ethna_Controller_Dummy();
     $ctl->setClientEncoding('SJIS');
     $sjis_input = mb_convert_encoding($input_str, 'SJIS', 'UTF-8');
     $sjis_expected = mb_convert_encoding($expected, 'SJIS', 'UTF-8');
     $sjis_actual = smarty_modifier_wordwrap_i18n($sjis_input, $width, $break, $indent);
     $this->assertEquals($sjis_expected, $sjis_actual);
     unset($GLOBALS['_Ethna_Controller_Dummy']);
     //     EUC-JP
     $ctl = new Ethna_Controller_Dummy();
     $ctl->setClientEncoding('EUC-JP');
     $eucjp_input = mb_convert_encoding($input_str, 'EUC-JP', 'UTF-8');
     $eucjp_expected = mb_convert_encoding($expected, 'EUC-JP', 'UTF-8');
     $eucjp_actual = smarty_modifier_wordwrap_i18n($eucjp_input, $width, $break, $indent);
     $this->assertEquals($eucjp_expected, $eucjp_actual);
 }