https://github.com/firesphere/silverstripe-seeder
https://github.com/firesphere/silverstripe-seeder
hacktoberfest
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/firesphere/silverstripe-seeder
- Owner: Firesphere
- License: bsd-3-clause
- Created: 2018-02-20T07:09:20.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-27T08:42:53.000Z (over 8 years ago)
- Last Synced: 2025-02-01T14:30:00.378Z (over 1 year ago)
- Topics: hacktoberfest
- Language: PHP
- Size: 58.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://scrutinizer-ci.com/g/Firesphere/silverstripe-seeder/?branch=master)
[](https://scrutinizer-ci.com/g/Firesphere/silverstripe-seeder/build-status/master)
[](https://codecov.io/gh/Firesphere/silverstripe-seeder)
# SilverStripe Seeder
# *WARNING*
This will _not_ create a test database for you! Do not run this against a production database!
Seed your database for Acceptance testing
# Installation
`composer require firesphere/seeder`
# Usage
Create a seeder yml file somewhere in your project, with the same syntax as the standard PHPUnit tests. E.g.
```yaml
Firesphere\Seeder\Tests\Mock\Page:
page1:
Title: The title
Content: "
Well, the way they make shows is, they make one show. That show's called a pilot. Then they show that show to the people who make shows, and on the strength of that one show they decide if they're going to make more shows. Some pilots get picked and become television programs. Some don't, become nothing. She starred in one of the ones that became nothing.
"
```
Relations are defined the same way as in PHPUnit.
Then run the seeder
`vendor/bin/sake dev/tasks/seeder type=seed flush=all`
To unseed, run
`vendor/bin/sake dev/tasks/seeder type=seed flush=all`
This will destroy all data that is defined in your seeder yml.
You will need to run a database build before seeding, and after unseeding.
# todo
Integrate with Codeception/Behat to automatically seed on run