單元測試類別(unit test)

    public function test()
    {
        $this->load->library('unit_test');
        $test = 1 + 2;
        $expected_result = $this->test_fun(1,2);
        $test_name = '測試判斷';
        $this->unit->run($test, $expected_result, $test_name);
        echo $this->unit->report();
    }

    private function test_fun($a,$b)
    {
        return $a+$b;
    }

 

 

內容出處: 單元測試類別 : CodeIgniter 使用手冊