public function setUp() { require 'bootstrap.php'; $this->json = new Hm_Format_JSON(); $this->html5 = new Hm_Format_HTML5(); Hm_Output_Modules::add('test', 'date', false, false, 'after', true, 'core'); Hm_Output_Modules::add('test', 'blah', false, false, 'after', true, 'core'); }
/** * Add an output module to a specific page * @param string $mod name of the module to add * @param bool $logged_in true if the module should only fire when logged in * @param string $source the module set containing the module code * @param string $marker the module name used to determine where to insert * @param string $placement "before" or "after" the $marker module name * @param bool $queue true if the module should be queued and retryed on failure * @return void */ function add_output($page, $mod, $logged_in, $source = false, $marker = false, $placement = 'after', $queue = true) { Hm_Output_Modules::add($page, $mod, $logged_in, $marker, $placement, $queue, $source); }
/** * @preserveGlobalState disabled * @runInSeparateProcess */ public function test_run_output_module() { require '../modules/core/setup.php'; require '../modules/core/modules.php'; $request = new Hm_Mock_Request('HTTP'); $session = new Hm_Mock_Session(); Hm_Output_Modules::add('test', 'date', false, false, false, true, 'core'); Hm_Output_Modules::add('test', 'blah', false, false, false, true, 'core'); $this->assertEquals(array('<div class="date"></div>', array(), 'HTML5'), $this->module_exec->run_output_module(array('test' => 'foo'), array(), 'date', array(false, true), $session, 'HTML5', array())); $this->assertEquals(array(array('test' => 'foo'), array(), 'JSON'), $this->module_exec->run_output_module(array('test' => 'foo'), array(), 'blah', array(false, true), $session, 'Hm_Format_JSON', array())); $this->assertEquals(array(array('test' => 'foo'), array(), 'JSON'), $this->module_exec->run_output_module(array('test' => 'foo'), array(), 'date', array(false, true), $session, 'Hm_Format_JSON', array())); }