Recently, I have been working on the MDPX project which uses Yii 1.1 Framework. I have already written about installing PHPUnit for Yii 1.1 in another post. Today followed the steps in the previous post. PHPUnit installed fine, but there it gives me errors when I run my unit tests. After some research, I found there are some addition packages I need to install.

The updated commands to install PHPUnit folows. This is done on Ubuntu 13.04, PHPUnit 3.7.21.

sudo pear config-set auto_discover 1
sudo pear install pear.phpunit.de/PHPUnit
sudo pear install --alldeps --force phpunit/phpunit
sudo pear install phpunit/DbUnit
sudo pear install phpunit/PHPUnit_Story

Yii testing framework requires Selenium. Install with following command

sudo pear install phpunit/PHPUnit_Selenium

Note: Selenium requires PHP cURL library. If it’s not already installed, it can be installed with

sudo apt-get install php5-curl

The follow are the error messages I received

1) UsersTest::testRead
PHP Warning:  include(PHP_Invoker.php): failed to open stream: No such file or directory in /home/wangchj/public_html/yii/framework/YiiBase.php on line 421
PHP Warning:  include(): Failed opening 'PHP_Invoker.php' for inclusion (include_path='.:/home/wangchj/public_html/mdpx/protected/components:/home/wangchj/public_html/mdpx/protected/models:/usr/share/php:/usr/share/pear') in /home/wangchj/public_html/yii/framework/YiiBase.php on line 421
PHP Warning:  include(PHPUnit_Extensions_Database_TestCase.php): failed to open stream: No such file or directory in /home/wangchj/public_html/yii/framework/YiiBase.php on line 421
PHP Warning:  include(): Failed opening 'PHPUnit_Extensions_Database_TestCase.php' for inclusion (include_path='.:/home/wangchj/public_html/mdpx/protected/components:/home/wangchj/public_html/mdpx/protected/models:/usr/share/php:/usr/share/pear') in /home/wangchj/public_html/yii/framework/YiiBase.php on line 421
PHP Warning:  include(PHPUnit_Extensions_Story_TestCase.php): failed to open stream: No such file or directory in /home/wangchj/public_html/yii/framework/YiiBase.php on line 421

References
- http://ubuntuforums.org/showthread.php?t=391313
- http://stackoverflow.com/questions/8078707/cannot-get-phpunit-working
- http://www.yiiframework.com/forum/index.php/topic/25744-phpunit-yiibasephp/
- http://stackoverflow.com/questions/13625842/phpunit-extension-warning-in-yii