Issue with fixtures

Hello,

We are in a development process for a website using Yii. So far so good with one exception: fixture for our tests never gets loaded into the database. We have updated CdbFixtureManager::getFixtures method and CDbFixtureManager::loadFixtures method with some print_r but it looks like yii never reach those methods. We have started phpunit with --verbose flag to eventually find some error related to the fixtures but without success. We have no clue why the fixtures are not loaded and we don’t know how to investigate.

We are followed step-by-step the documentation in the definitive guide. Consequently, all our fixtures are under /protected/tests/fixtures/.

Here is our /protected/config/test.php file:




return CMap::mergeArray(

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

array(

		'components'=>array(

			'fixture'=>array(

				'class'=>'system.test.CDbFixtureManager',

			),

			'db'=>array(

				'connectionString' => 'mysql:host=localhost;dbname=mydb',

				'emulatePrepare' => true,

				'username' => '***',

				'password' => '***',

				'charset' => 'utf8',

			),

		),

	)

);



The bootstrap.php file is the standard one. I can provide the main.php if it is required for investigation.

Any help would greatly be appreciated.

Greg.

Did you define the fixtures to use in your class?




class AccountSettingsTest extends CDbTestCase

{

    public $fixtures=array(

        // fixture name => model/class name

        'account' => 'Account',

        'account_profile' => 'AccountProfile',

        'account_settings'=>'AccountSettings',

    );

    

    public function testSomething()

    {

        // tests

    }

}



I can not use the fixture too.

I place a file feed.php




return array(

	'sample1'=> array(

		'ssouid'=>'bitshine@chinaacc.com',

		'message'=>'测试1',

		'url'=>'http://bbs.chinaacc.com/forum-2-13/topic-1152415.html',

		'app'=>'accbbs',

		'type'=>'topic', 

		'targetid'=>'1152415',

		'timeline'=>'2011-01-01 12:14:12',			

	),

	'sample2'=> array(

		'ssouid'=>'bitshine@chinaacc.com',

		'message'=>'测试2',

		'url'=>'http://bbs.chinaacc.com/forum-2-13/topic-1152415.html',

		'app'=>'cdelbbs',

		'type'=>'topic', 

		'targetid'=>'1152416',

		'timeline'=>'2011-01-01 21:14:56',		

	),

	'sample3'=> array(

		'ssouid'=>'bitshine@chinaacc.com',

		'message'=>'测试3',

		'url'=>'http://bbs.chinaacc.com/forum-2-13/topic-1152415.html',

		'app'=>'blog',

		'type'=>'topic', 

		'targetid'=>'1152417',

		'timeline'=>'2011-01-02 09:04:32',		

	),

	'sample4'=> array(

		'ssouid'=>'bitshine@chinaacc.com',

		'message'=>'测试4',

		'url'=>'http://bbs.chinaacc.com/forum-2-13/topic-1152415.html',

		'app'=>'accbbs',

		'type'=>'post', 

		'targetid'=>'1152418',

		'timeline'=>'2011-01-02 23:14:12',		

	),

);



but the data did not import to the database.

and the init.php never be reach.

it is ok now.

add




 public $fixtures=array( ...



to the test class.