PHP Unit Testing Problems With Database connection

Hi

I am trying to write database test cases to run with phpunit and am getting the following error :-

There was 1 error:

  1. 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()

{

 &#036;this-&gt;assertNotEquals(NULL, Yii::app()-&gt;db);

My test config file is test.php

<?php

return CMap::mergeArray(

    require(dirname(__FILE__).'/main.php'),


    array(


            'components'=&gt;array(


                    'fixture'=&gt;array(


                            'class'=&gt;'system.test.CDbFixtureManager',


                    ),


                    // uncomment the following to provide test database connection


                    'db'=&gt;array(


                    'connectionString' =&gt; 'mysql:host=localhost;dbname=trackstar_dev;',


                    'emulatePrepare' =&gt; true,


                    'username' =&gt; 'root',


                    'password' =&gt; 'xxxx',


                    'charset' =&gt; 'utf8',


                    ),





            ),


    )

);

I have tried to implement suggestions but to no avail, can anyone help?

PQUL

Try to get rid of the last [b]


;

[/b]in your connection string (works fine for me, but have never seen it in docs examples). Also please check out that you definitely have database [color="#1C2837"]trackstar_dev. Also, might be you need to connect to 127.0.0.1 - depends on you mysql installation. Do you use localhost for any working site?[/color]