firesphere/seeder

Simplified seeding of the database for testing purposes

Installs: 1 047

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:silverstripe-vendormodule

0.1 2018-02-26 22:29 UTC

This package is auto-updated.

Last update: 2024-12-16 19:35:55 UTC


README

Scrutinizer Code Quality Build Status codecov

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.

Firesphere\Seeder\Tests\Mock\Page:
  page1:
    Title: The title
    Content: "<p>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.</p>"

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