public function setUp() { $ctl = new Ethna_Controller_Dummy(); $plugin = $ctl->getPlugin(); $config = $ctl->getConfig(); $config->set('plugin', array('cachemanager' => array('memcache' => array('host' => 'localhost', 'port' => 11211, 'use_pconnect' => false, 'retry' => 4, 'timeout' => 5, 'info' => array('namespace1' => array(0 => array('host' => 'cache1.example.com', 'port' => 11211), 1 => array('host' => 'cache2.example.com', 'port' => 11211))))))); $this->cm = $plugin->getPlugin('Cachemanager', 'Memcache'); }
function setUp() { $ctl = new Ethna_Controller_Dummy(); $plugin = $ctl->getPlugin(); $config = $ctl->getConfig(); $config->set('plugin', array('cachemanager' => array('localfile' => array('test::int_key' => 'miyazakiaoi')))); $plugin = $ctl->getPlugin(); $this->cm = $plugin->getPlugin('Cachemanager', 'Localfile'); }
public function testNotFoundView() { $controller = new Ethna_Controller_Dummy(); $form = new Ethna_ActionForm_Dummy($controller); $controller->setActionForm($form); $backend = $controller->getBackend(); $backend->setActionForm($form); $view = new Ethna_View_500($backend, "dummy", ""); ob_start(); @$view->preforward(); @$view->forward(); $content = ob_get_clean(); $this->assertEquals("error500.tpl", $controller->getRenderer()->templates[0]); }
public function testNotFoundView() { $controller = new Ethna_Controller_Dummy(); $form = new Ethna_ActionForm_Dummy($controller); $controller->setActionForm($form); $backend = $controller->getBackend(); $backend->setActionForm($form); $view = new Ethna_View_Redirect($backend, "redirect", ""); ob_start(); @$view->preforward("http://example.com/"); @$view->forward(); $content = ob_get_clean(); // MEMO(chobie):今のだとむりぽ!とりあえず出力結果がなければOKとしておこう $this->assertEquals($content, ""); }
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"]'); }
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); }
public function setUp() { $ctl = new Ethna_Controller_Dummy(); $this->cf = $ctl->getClassFactory(); }