YiiBase::autoload() fails to include TestCase.php

I have been using phpunit plus its related software such as code coverage in yii without a problem.

Recently, I installed phpunit pear install phpunit/PHPUnit_SkeletonGenerator since I no longer have access to this as part of phpunit. Here is my challenge…for a simple class.

<?phpclass Calculator


    public function add($a, $<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/cool.gif' class='bbc_emoticon' alt='B)' />


        return $a + $b;




On the command line, if I run the generator on the above class, you can see that it works.

seal@server:~$ phpunit-skelgen --test Calculator

PHPUnit Skeleton Generator 1.1.0 by Sebastian Bergmann.

Wrote skeleton for "CalculatorTest" to "/home/seal/CalculatorTest.php".

Now if I were to run the same class within a yii project.

/www/calculator/protected/tests$ phpunit-skelgen --bootstrap bootstrap.php --test ../models/Post.php

PHPUnit Skeleton Generator 1.1.0 by Sebastian Bergmann.

PHP Warning:  include(PHPUnit_Framework_TestCase.php): failed to open stream: No such file or directory in /home/seal/Library/yii/framework/YiiBase.php on line 423

It appears YiiBase::autoload() cannot find the path "PHPUnit/Framework/TestCase.php

Point to note:

[list=1][]I do have phpunit in the include path for both apache and CLI[]I have also tried to require TestCase directly within the bootstrap.php this works. but then more errors comes up for other files YiiBase::autoload() were unable to find. Also, phpunit have several autoload which makes this approach fruitless.[*]I have tried to register the autoload directly, but tis conflicts with yii’s autoload.[/list]

I welcome any help or suggestions or even questions I can get


Which Yii version are you using? I fixed a related thing in 1.1.11

Thanks for your time CeBe.

I am using the latest commit via git. (Yii 1.1.11)

Looking at the source for phpunit autoload, it appears the author uses independent autoload per tool.

And skeleton is not even part of the main Autoload.php

Can you open a ticket on github? Will then check whether its a yii or phpunit problem.

Issue on github - https://github.com/yiisoft/yii/issues/1110