[DEPRECATED] Click here for latest version
Improved CodeIgniter Unit Testing 1.0.1
Change Log
Version 1.0.1
——————-
- Now overloading the CI Unit Test class
- Removed support for testing controllers due to CI limitation
- SQL errors are now displayed in the test report if a test case fails
For new users
- Download the zip attached to this post.
- Extract the zip on top of your CI install directory if you did not change the path to your application or system folder (replace files as needed). Otherwise, extract to a temporary directory and move files as needed.
That’s it! Now you can open the test.php controller and start adding your own tests. A sample function has been provided to show you how to create your own. After you have written some tests, you can test them by accessing siteurl.com/test/.
Update procedure from 1.0 to 1.0.1
- Download the zip attached to this post.
- Extract the files in a temporary directory
- Copy the file MY_Test_unit.php from application/libraries into your application/libraries folder
- Open your original view unit_test.php and delete the line:
<input type="button" value="Controllers" onclick="window.1ocation='<?=site_url("test/controllers")?>'" />Also check that the CSS location is correctly referenced.
- Open your original test controller test.php and delete the following
case 'controllers':else if (strripos($method, 'controller') === $length - 10)
{
$this->tests['controllers'][] = $method;
}- Overwrite your /system/language/english/unit_test_lang.php with the one you extracted