I first started this problem when I thought it was only an issue in the Yii book (http://www.yiiframework.com/forum/index.php?/topic/11723-chapter-3-messagetest/). It turns out it seems specific to my installation environment, so I thought I’d better repost it under the circumstances.
Yii: r2468 (1.1.5-dev)
XAMPP: 1.7.3
PHP: 5.3.1
PHPUnit: 3.4.15
SeleniumRC: 1.0.1
WebRoot: C:\www
Yii: C:\www\yii
When I run the blog demo (but any yii project I have will fail in a similar way) I receive the following output:
C:\www\yii\demos\blog\protected\tests>phpunit --verbose unit
PHPUnit 3.4.15 by Sebastian Bergmann.
unit
CommentTest
Fatal error: Class 'Post' not found in C:\www\yii\framework\db\ar\CActiveRecord.
php on line 352
It also creates and empty file "Post.php" in "C:\www\yii\demos\blog\protected\tests".
The only workaround I was able to use is manually adding the required files into WebTestCase.php. In case of unit/CommentTest.php, I have to add:
require_once('../models/Post.php');
require_once('../models/Comment.php');
At home with the same XAMPP and PHP versions, and exactly the same Yii code it is working fine.
Anyone has an idea?