Issue #15 new

Fatal error: Class 'CIUnit_TestCase' not found

Anonymous created an issue

Hi kenjis, I used codeigniter 2.1.0 and phpunit 3.6.12. I tested phpunit using a php file(not codeigniter file), everything is ok there.

Now I tried to integrate phpunit with codeigniter. I copy "tests" folder into "programmerz"(my project name) top dirctory and copy "third_party" into application directory.

Then I changed the parent classes below two files - application/third_party/CIUnit/core/CIU_Controller.php - application/third_party/CIUnit/core/CIU_Loader.php

Because I used two core file(MY_Controller.php and MY_Loader.php) in my application/core directory.

Thats it. Nothing I changed. now I used the following command line to test a file into tests/model folder

D:\xampp\php>phpunit D:\xampp\htdocs\programmerz\tests\models\PhoneCarrierModelT est.php

Then I got following error.

Fatal error: Class 'CIUnit_TestCase' not found in D:\xampp\htdocs\programmerz\te sts\models\PhoneCarrierModelTest.php on line 9

I don't understand in your tests folder where you load the phpunit.xml file and also where you used generate.php file.

I understand that somehow ../application/third_party/CIUnit/bootstrap_phpunit.php this file not included.

Please give me clear declaration, I tried last three days by your CIUnit.

Comments (3)

  1. yijie li

    Just luckily found out that I have to run the command phpunit under Tests folder, not in its subfolders. for example:

    instead of

    tests/model/  phpnuit sometest.php
    

    use

    tests/ phpunit model/sometest.php
    

    Hope this helps.

  2. Log in to comment