Thanks for trying to help
My default test.php looks like this:
<?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'=>'DSN for test database',
),
*/
),
)
);
I changed it to this, but it didn’t help:
<?php
return CMap::mergeArray(
require(dirname(__FILE__).'/main.php'),
array(
'components'=>array(
'fixture'=>array(
'class'=>'system.test.CDbFixtureManager',
),
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=trackstar_dev;port=3306',
'emulatePrepare' => true,
'username' => 'root',
'password' => '',
'charset' => 'utf8',
),
/* uncomment the following to provide test database connection
'db'=>array(
'connectionString'=>'DSN for test database',
),
*/
),
)
);
I get the same error:
C:\Program Files\EasyPHP-5.3.3\www\trackstar\protected\tests>phpunit unit/DbTest.php
PHP Notice: Please no longer include "PHPUnit/Framework.php". in C:\Program Files\EasyPHP-5.3.3\php\PEAR\PHPUnit\Framework.php on line 50
Notice: Please no longer include "PHPUnit/Framework.php". in C:\Program Files\EasyPHP-5.3.3\php\PEAR\PHPUnit\Framework.php on line 50
PHPUnit 3.5.0 by Sebastian Bergmann.
E
Time: 1 second, Memory: 4.75Mb
There was 1 error:
1) DbTest::testConnection
CDbException: CDbConnection failed to open the DB connection.
C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\db\CDbConnection.php:275
C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\db\CDbConnection.php:242
C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\db\CDbConnection.php:221
C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\base\CModule.php:363
C:\Program Files\EasyPHP-5.3.3\www\yii-1.1.4.r2429\framework\base\CModule.php:86
C:\Program Files\EasyPHP-5.3.3\www\trackstar\protected\tests\unit\DbTest.php:7
FAILURES!
Tests: 1, Assertions: 0, Errors: 1.
Plus I know it’s reading the db key in main.php because if I force a syntax error I get this:
C:\Program Files\EasyPHP-5.3.3\www\trackstar\protected\tests>phpunit unit/DbTest.php
PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in C:\Program Files\EasyPHP-5.3.3\www\trackstar\protected\config\main.php on line 59
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in C:\Program Files\EasyPHP-5.3.3\www\trackstar\protected\config\main.php on line 59