I’m sure my config file is correct and webapp is running well. I just want to try unit test, so I made a test case like this:
<?php
class DbTest extends CTestCase
{
function testConnection(){
$this->assertNotEquals(NULL, Yii::app()->db);
}
}
?>
run: phpunit unit/DbTest
but result is:
There was 1 error:
1) DbTest::testConnection
CDbException: CDbConnection failed to open the DB connection.
/Applications/MAMP/htdocs/yii/framework/db/CDbConnection.php:293
/Applications/MAMP/htdocs/yii/framework/db/CDbConnection.php:260
/Applications/MAMP/htdocs/yii/framework/db/CDbConnection.php:238
/Applications/MAMP/htdocs/yii/framework/base/CModule.php:372
/Applications/MAMP/htdocs/yii/framework/base/CModule.php:86
/Applications/MAMP/htdocs/blog/protected/tests/unit/DbTest.php:5
FAILURES!
Tests: 1, Assertions: 0, Errors: 1.
Where I should go, can anybody give me some hints? thanks a lot!