FixtureHelper for Yii Framework ¶
FixtureHelper is a command application lets you work with your fixtures outside testing. Currently what it does is just helping you to load you fixtures from your fixture files to your database, without the need to invoke PHPUnit.
Copy FixtureHelperCommand.php and place it under
protected/config/console.php, add the following to the config array under
'commandMap' => array( 'fixture' => array( 'class'=>'application.extensions.fixtureHelper.FixtureHelperCommand', ), ),
Configure your database by setting up your db under
Add the following inside
'fixture'=>array( 'class'=>'system.test.CDbFixtureManager', ),
fixture load [--alias=folderalias] --table=tablename1[,tablename2[,...]]
- load: Load fixtures into the database
- --alias: The alias to the directory that contains "models" and "tests" folders. Please note that folder "models" should contain the Model class of the fixtures to be loaded. Defaults to "application". Optional for "load".
- --tables: Name of the tables to be loaded with your defined fixtures. Name
values are comma separated. Required for "load".
yiic fixture load --alias=application.modules.mymodule --tables=fruit,transport,country