When you create PHPUnit tests for your models in Yii using netbeans you may encounter this problem PHP Fatal error: Class ‘CActiveRecord’ not found.. The easiest solution is to include the following at the top of the model class, for example if the class is User then your code should look like $yii=’/opt/lampp/htdocs/yii/framework/yii.php’; require_once($yii); class