camspiers/silverstripe-fixturegenerator
Allows the generation of SilverStripe unit test fixtures from existing DataObjects either programatically created or from the database
Maintainers
Package info
github.com/camspiers/silverstripe-fixturegenerator
pkg:composer/camspiers/silverstripe-fixturegenerator
0.1.7
2014-08-14 10:36 UTC
Requires
- symfony/yaml: ~2.2
Requires (Dev)
- silverstripe/framework: ~2.4
- symfony/class-loader: ~2.2
Suggests
None
Provides
None
Conflicts
None
Replaces
None
MIT 0fc7b5f3c01d83d8f2111bf255b46986b78e6a08
- Cam Spiers <camspiers.woop@gmail.com>
README
👁 Build Status
against 2.2 and 3.0
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
