I recently started playing with the new features of yii (ie: test driven development) and I encountered an interesting issue.
I created a DB and ran the yiic shell on it to create a model. everything seems fine, but when I’m trying to run the automatically generated test, I’ll get the following error:
1) testCreate(ProjectTest)
CDbException: CDbCommand failed to execute the SQL statement: CDbCommand failed to prepare the SQL statement: SQLSTATE[HY000]: General error: 1 no such table: sqlite_sequenceUPDATE sqlite_sequence SET seq='0' WHERE name='Project'
/var/www/yii-1.1b.r1504/framework/db/CDbCommand.php:227
/var/www/yii-1.1b.r1504/framework/db/schema/sqlite/CSqliteSchema.php:38
/var/www/yii-1.1b.r1504/framework/test/CDbFixtureManager.php:244
/var/www/yii-1.1b.r1504/framework/test/CDbFixtureManager.php:139
/var/www/yii-1.1b.r1504/framework/test/CDbFixtureManager.php:296
/var/www/yii-1.1b.r1504/framework/test/CDbTestCase.php:116
it looks like the table is not recognized even if it’s there. I know this, because when I purposely deleted the table, I’ll get a different error message:
1) testCreate(ProjectTest)
CDbException: The table "Project" for active record class "Project" cannot be found in the database.
/var/www/yii-1.1b.r1504/framework/db/ar/CActiveRecord.php:1897
/var/www/yii-1.1b.r1504/framework/db/ar/CActiveRecord.php:328
/var/www/yii-1.1b.r1504/framework/test/CDbFixtureManager.php:294
/var/www/yii-1.1b.r1504/framework/test/CDbTestCase.php:116