Like most other classes in CodeIgniter, the w3coded codeigniter 1 Unit Test class is initialized in your w3coded codeigniter 1 controller using the $this->load->library w3coded codeigniter 1 function:,CodeIgniter’s Unit Test class is w3coded codeigniter 1 quite simple, consisting of an evaluation w3coded codeigniter 1 function and two result functions. It’s not w3coded codeigniter 1 intended to be a full-blown test suite but w3coded codeigniter 1 rather a simple mechanism to evaluate your code w3coded codeigniter 1 to determine if it is producing the correct data w3coded codeigniter 1 type and result.,Once loaded, the Unit Test w3coded codeigniter 1 object will be available using w3coded codeigniter 1 $this->unit,Notice the use of “is_string” in w3coded codeigniter 1 the second parameter? This tells the function to w3coded codeigniter 1 evaluate whether your test is producing a string w3coded codeigniter 1 as the result. Here is a list of allowed w3coded codeigniter 1 comparison types:
$this->load->library('unit_test');
$test = 1 + 1;
$expected_result = 2;
$test_name = 'Adds one plus one';
$this->unit->run($test, $expected_result, $test_name);
$this->unit->run('Foo', 'Foo');
$this->unit->run('Foo', 'is_string');
echo $this->unit->run($test, $expected_result);
Last Update : 2023-09-22 UTC 12:10:11 PM
Last Update : 2023-09-22 UTC 12:10:05 PM
Last Update : 2023-09-22 UTC 12:09:45 PM
Last Update : 2023-09-22 UTC 12:09:31 PM
Last Update : 2023-09-22 UTC 12:09:19 PM
Last Update : 2023-09-22 UTC 12:08:35 PM
Last Update : 2023-09-22 UTC 12:08:21 PM