Issue With Test Fixtures

Hi, I’m trying to start using unit testing in Yii 1.x.

I’ve created the config files (test.php and bootstrap.php) and one class test UserTest.php inside the test\unit\ to test a model class.

On this class, there is only one method with assertTrue(true), just to see if the objects are loading and PHPUnit and Yii is doing their jobs. :)

When I run the test, everything goes Ok. But when I try to add a fixture to the test class, using:




public $fixtures=array(

'user'=>'User'

);



I got an SQL error from PHPUnit:

  1. UserTest::testTrue

CDbException: CDbCommand fails to execute the SQL command: SQLSTATE[42P01]: Unde

fined table: 7 ERROR: relation "tb_department_user" does not exist

The problem is that I did not found any relationship between these two tables in this models.

My fixture’s name is ‘user’, and I’ve the file test\fixture\user.php.

Anyone can give me an idea on what is going on? ty.