Problem with (very) basic model testing


Just starting with Yii framework. I tried to try some model testing, by the book.

Here is my test class:



class DbTest extends CDbTestCase {

public function testCRUD() {

&#036;newProject=new Project;




And executing

C:\xampp\htdocs\trackstar\protected\tests>phpunit unit/DbTest.php

PHPUnit 3.5.13 by Sebastian Bergmann.

Fatal error: Class ‘Project’ not found in C:\xampp\htdocs\trackstar\protected\te

sts\unit\DbTest.php on line 8

Any ideas?

Thanks in advance


Please post topics like that in

Are you sure that you have a file called "Project.php" in your models folder of your application? If not than this is the problem and you should create one

Yes, Project.php is created and basic CRUD is working

Also tested


class ProjectTest extends CDbTestCase {

public function testCRUD() {

//Create a new project

&#036;newProject=new Project;




with no results


Try this at the top of your testfile, although I think the Project model should have been autoloaded already.


If you still experience any problems than there is something wrong with your model class I think

That worked. Why the autoload property didn’t work?

Check the main.php in your config folder for the following lines:


If that is the case than I don’t know why it wasn’t loaded correctly.