camspiers/silverstripe-fixturegenerator
Composer 安装命令:
composer require camspiers/silverstripe-fixturegenerator
包简介
Allows the generation of SilverStripe unit test fixtures from existing DataObjects either programatically created or from the database
README 文档
README
Allows the generation of SilverStripe unit test fixtures from existing DataObjects either programatically created or from the database.
Creating fixtures files for unit tests is tedious at best, and this library's goal is to alleviate some of the pain.
Installation (with composer)
$ composer require camspiers/silverstripe-fixturegenerator:~0.1
Usage
Example with all relations allowed
use Camspiers\SilverStripe\FixtureGenerator; $records = //some DataObjectSet (new FixtureGenerator\Generator( new FixtureGenerator\Dumpers\Yaml( __DIR__ . '/tests/MyFixture.yml' ) ))->process($records);
Example with certain relations allowed
use Camspiers\SilverStripe\FixtureGenerator; $records = //some DataObjectSet (new FixtureGenerator\Generator( new FixtureGenerator\Dumpers\Yaml( __DIR__ . '/tests/MyFixture.yml' ), array( 'MyDataObject.SomeHasOneRelation', 'MyDataObject.SomeHasManyRelation' ) ))->process($records);
Example with certain relations excluded
use Camspiers\SilverStripe\FixtureGenerator; $records = //some DataObjectSet (new FixtureGenerator\Generator( new FixtureGenerator\Dumpers\Yaml( __DIR__ . '/tests/MyFixture.yml' ), array( 'MyDataObject.SomeHasOneRelation', 'MyDataObject.SomeHasManyRelation' ), FixtureGenerator\Generator::RELATION_MODE_EXCLUDE ))->process($records);
Unit testing
$ composer install --dev $ phpunit
统计信息
- 总下载量: 2.06k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-04-03