Unit Testing in CodeIgniter (Who use it?)
Using Unit tests is a best practice when developing software.
CodeIgniter has a Unit Testing class that is aimed to provide support for Unit Tests in your code.
Despite the CI Class for Unit Testing is quite simple, it may be very helpful to determine if what you are coding is exactly what you expect or not, by doing simple test cases.
I’d suggest to review their Unit Testing class.
The initialization of this library is quite simple simple, too. You just need to add the following line, and then the Unit Test object will be available using $this->unit.
$this->load->library('unit_test');
Once you loaded the library, you can start running simple tests. For each test, you specify the $test parameter (ie: 1+1), the expected result and the test name.
Also you can specify if a value is any of the available data types supported in the application, ie: is_string, is_bool, is_false, is_float, and so on, to evaluate if the result match with the expected data type.



