CI_Unit_test::report PHP Method

report() public method

Displays a table with the test data
public report ( array $result = [] ) : string
$result array
return string
    public function report($result = array())
    {
        if (count($result) === 0) {
            $result = $this->result();
        }
        $CI =& get_instance();
        $CI->load->language('unit_test');
        $this->_parse_template();
        $r = '';
        foreach ($result as $res) {
            $table = '';
            foreach ($res as $key => $val) {
                if ($key === $CI->lang->line('ut_result')) {
                    if ($val === $CI->lang->line('ut_passed')) {
                        $val = '<span style="color: #0C0;">' . $val . '</span>';
                    } elseif ($val === $CI->lang->line('ut_failed')) {
                        $val = '<span style="color: #C00;">' . $val . '</span>';
                    }
                }
                $table .= str_replace(array('{item}', '{result}'), array($key, $val), $this->_template_rows);
            }
            $r .= str_replace('{rows}', $table, $this->_template);
        }
        return $r;
    }