Hi
I am trying to write database test cases to run with phpunit and am getting the following error :-
There was 1 error:
- DbTest::testConnection
CDbException: CDbConnection failed to open the DB connection.
/opt/lampp/htdocs/yii_root/framework/db/CDbConnection.php:388
/opt/lampp/htdocs/yii_root/framework/db/CDbConnection.php:331
/opt/lampp/htdocs/yii_root/framework/db/CDbConnection.php:309
/opt/lampp/htdocs/yii_root/framework/base/CModule.php:388
/opt/lampp/htdocs/yii_root/framework/base/CModule.php:104
/opt/lampp/htdocs/trackstar/protected/tests/unit/DbTest.php:6
FAILURES!
Tests: 1, Assertions: 0, Errors: 1.
Additional Information:
I am running Yii on xampp under linux mint and am doing the tutorials in the book "Agile Web Application Development with Yii1.1 and PHP5.
DbTest.php
<?php
class DbTest extends CTestCase
{
public function testConnection()
{
$this->assertNotEquals(NULL, Yii::app()->db);
My test config file is test.php
<?php
return CMap::mergeArray(
require(dirname(__FILE__).'/main.php'),
array(
'components'=>array(
'fixture'=>array(
'class'=>'system.test.CDbFixtureManager',
),
// uncomment the following to provide test database connection
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=trackstar_dev;',
'emulatePrepare' => true,
'username' => 'root',
'password' => 'xxxx',
'charset' => 'utf8',
),
),
)
);
I have tried to implement suggestions but to no avail, can anyone help?
PQUL