/** * Renders mr_html_notify * * @param mr_html_notify $notify mr_html_notify instance * @return string */ protected function render_mr_html_notify(mr_html_notify $notify) { $output = ''; foreach ($notify->get_messages() as $message) { $output .= $this->output->notification($message[0], $message[1]); } return $output; }
public function test_messages() { global $SESSION; $notify = new mr_html_notify(); $notify->set_component('local_mr'); $notify->set_align('right'); $notify->good('mrframework'); $notify->bad('mrframework'); $expected = array(array(get_string('mrframework', 'local_mr'), 'notifysuccess', 'right'), array(get_string('mrframework', 'local_mr'), 'notifyproblem', 'right')); $this->assertIdentical($SESSION->messages, $expected); $this->assertIdentical($notify->get_messages(), $expected); $this->assertTrue(empty($SESSION->messages)); }