CI_Unit_test::run PHP Method

run() public method

Runs the supplied tests
public run ( mixed $test, mixed $expected = TRUE, string $test_name = 'undefined', string $notes = '' ) : string
$test mixed
$expected mixed
$test_name string
$notes string
return string
    public function run($test, $expected = TRUE, $test_name = 'undefined', $notes = '')
    {
        if ($this->active === FALSE) {
            return FALSE;
        }
        if (in_array($expected, array('is_object', 'is_string', 'is_bool', 'is_true', 'is_false', 'is_int', 'is_numeric', 'is_float', 'is_double', 'is_array', 'is_null', 'is_resource'), TRUE)) {
            $expected = str_replace('is_double', 'is_float', $expected);
            $result = $expected($test);
            $extype = str_replace(array('true', 'false'), 'bool', str_replace('is_', '', $expected));
        } else {
            $result = $this->strict === TRUE ? $test === $expected : $test == $expected;
            $extype = gettype($expected);
        }
        $back = $this->_backtrace();
        $report = array('test_name' => $test_name, 'test_datatype' => gettype($test), 'res_datatype' => $extype, 'result' => $result === TRUE ? 'passed' : 'failed', 'file' => $back['file'], 'line' => $back['line'], 'notes' => $notes);
        $this->results[] = $report;
        return $this->report($this->result(array($report)));
    }