Fixture Problem CException Table user does not exist

I have 2 fixture database files in protected/test/fixtures.

The first one is tbl_project.php and it works well with the test suit.

The second one is tbl_user.php. Howerver, it will not work any longer.

  1. ProjectTest::testCreate

CException: Table ‘tbl_user’ does not exist.

yii\framework\test\CDbFixtureManager.php:251

yii\framework\test\CDbFixtureManager.php:142

yii\framework\test\CDbFixtureManager.php:302

yii\framework\test\CDbTestCase.php:116

I used iis as my OS is win7. I tried all methods I could find by search engine and it does not work.

I think it does not make sense. Why does tbl_project works well tbl_user does not? Even in the same directory with same mod.

PHP version

PHP 5.3.5 (cli) (built: Jan 5 2011 20:29:28)

Copyright © 1997-2010 The PHP Group

Yii version

Version 1.1.6 January 16, 2011

PHP unit version

PHPUnit 3.5.13 by Sebastian Bergmann.

I am reading Agile version to study the framework. In Chapter 6, I have the same problem. And the user.php is created in Chapter 7. Without the user.php, can the fixture work?

Problem:

C:\inetpub\wwwroot\medappt\trackstar\protected\tests>phpunit unit\ProjectTest.ph

p

PHPUnit 3.5.13 by Sebastian Bergmann.

E

Time: 1 second, Memory: 6.25Mb

There was 1 error:

  1. ProjectTest::testGetUserOptions

include(User.php): failed to open stream: No such file or directory

C:\inetpub\wwwroot\medappt\yii\framework\YiiBase.php:396

C:\inetpub\wwwroot\medappt\yii\framework\YiiBase.php:396

C:\inetpub\wwwroot\medappt\yii\framework\YiiBase.php:291

C:\inetpub\wwwroot\medappt\yii\framework\test\CDbFixtureManager.php:297

C:\inetpub\wwwroot\medappt\yii\framework\test\CDbTestCase.php:116

FAILURES!

Tests: 1, Assertions: 0, Errors: 1.

C:\inetpub\wwwroot\medappt\trackstar\protected\tests>

Finally, I have to use Gii to creat a user model to get pass this error. I am sure that Agile’s book is missing this instruction. You can’t test a model without a model in Yii.