0
我剛試圖運行yii框架的博客單元測試。但是我得到了這樣的錯誤,我無法解決問題。請隨時與我分享。先謝謝你。我得到了這樣的錯誤。在yii框架中運行phpunit測試時出錯
我需要爲phpunit設置測試數據庫嗎?如果是這樣,我該怎麼做。
C:\wamp\www\yii\demos\blog\protected\tests>phpunit --verbose unit\CommentTest
C:\wamp\www\yii\demos\blog\protected\tests/../config/test.phpPHPUnit 3.6.10 by S
ebastian Bergmann.
Configuration read from C:\wamp\www\yii\demos\blog\protected\tests\phpunit.xml
EE
Time: 0 seconds, Memory: 7.75Mb
There were 2 errors:
1) CommentTest::testFindRecentComments
CDbException: The table "{{post}}" for active record class "Post" cannot be foun
d in the database.
C:\wamp\www\yii\framework\db\ar\CActiveRecord.php:2264
C:\wamp\www\yii\framework\db\ar\CActiveRecord.php:379
C:\wamp\www\yii\framework\test\CDbFixtureManager.php:301
C:\wamp\www\yii\framework\test\CDbTestCase.php:118
C:\wamp\bin\php\php5.3.9\phpunit:46
2) CommentTest::testApprove
CException: Table 'tbl_post' does not exist.
C:\wamp\www\yii\framework\test\CDbFixtureManager.php:254
C:\wamp\www\yii\framework\test\CDbFixtureManager.php:145
C:\wamp\www\yii\framework\test\CDbFixtureManager.php:305
C:\wamp\www\yii\framework\test\CDbTestCase.php:118
C:\wamp\bin\php\php5.3.9\phpunit:46
FAILURES!
Tests: 2, Assertions: 0, Errors: 2.
你應該發佈你的解決方案作爲答案。 – 2012-05-15 21:50:26