Problem with PHPUnit - invalid directory

Hello,

I run phpunit from my ‘tests’ directory: phpunit unit

…and get the following error:

PHP Fatal error: Uncaught exception ‘CException’ with message ‘Application base path “protected” is not a valid directory.’ in /home/user/phpdev/yii/framework/base/CApplication.php:240

This error happens with other commands like: phpunit unit/MyTest.php, phpunit --bootstrap bootstrap.php unit

Configuration:

php 5.3.5

phpunit 3.5.5

What’s wrong ? Thank you,

Fabrice

I think you have a wrong path and/or a permission problem somewhere in your application configuration/environment.

Try to create a fresh yii skeleton app (test if the app is working in browser) and then write a simple test and check if it works.

Thank you for your suggestion. I didn’t experience the error with a freshly yii skeleton app.

The error was actually caused by the yii-environment extension (http://www.yiiframework.com/extension/yii-environment). Install the protected/tests/bootstrap.php file provided with this extension and the problem is solved !

Yeah ! Fabrice