Unit testing problem using PHPUnit for Yii 1.1.2 unit tests

I try to run unit tests in demos/blog/protected/tests using the following command:

>phpunit unit/PostTest.php

but get the following errors:

[i]

PHPUnit 3.4.12 by Sebastian Bergmann.

Fatal error: Class ‘Post’ not found in C:\xampp\htdocs\yii\framework\db\ar\CActiveRecord.php on line 341

[/i]

After run this, a new file Post.php is created in the tests directory with empty contents.

I changed the bootstrap.php to include the test.php config file and webtestcase.php to include the correct TEST_BASE_URL. But when I test the blog application in browser, it is working.

btw, the database is also configured to point to blog-test.db

Can anyone help me correct this error?

I can’t reproduce this problem from a clean checkout of trunk. Works fine on Mac with PHPUnit 3.4.13.

Thanks knut for your reply. It still does not work on my Windows XP.

Hi knut, have you tested "demos/blog/protected/tests" from the fresh downloaded yii1.1.2?

I have tried creating a new app and running the unit tests, there is no problem because there is no component in the tests yet. But after created some components, e.g. Post or Comment, the problem start to happen.