firesphere/seeder

简化数据库测试用例的播种

安装数: 1,046

依赖项: 0

建议者: 0

安全性: 0

星星: 0

关注者: 2

分支: 0

开放问题: 0

类型:silverstripe-vendormodule

0.1 2018-02-26 22:29 UTC

This package is auto-updated.

Last update: 2024-09-16 19:10:47 UTC


README

Scrutinizer Code Quality Build Status codecov

SilverStripe Seeder

警告

这不会为您创建测试数据库!请不要在生产数据库上运行此操作!

为验收测试播种数据库

安装

composer require firesphere/seeder

使用方法

在项目的某个位置创建一个seeder yml文件,其语法与标准PHPUnit测试相同。例如。

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>"

关系定义方式与PHPUnit中相同。

然后运行播种器

vendor/bin/sake dev/tasks/seeder type=seed flush=all

要取消播种,运行

vendor/bin/sake dev/tasks/seeder type=seed flush=all

这将销毁在您的seeder yml中定义的所有数据。

您需要在播种之前运行数据库构建,并在取消播种后运行。

待办事项

与Codeception/Behat集成,以便在运行时自动播种