aist / aist-alice-fixtures
Alice Fixtures for ZF2.
dev-master
2015-08-22 19:52 UTC
Requires
- php: >=5.5
- bacon/bacon-string-utils: dev-master
- doctrine/doctrine-orm-module: dev-master
- fzaninotto/faker: 1.5.*@dev
- nelmio/alice: 2.0.*@dev
- zendframework/zend-modulemanager: ~2.5
Requires (Dev)
- phpunit/phpunit: 4.8.*
This package is not auto-updated.
Last update: 2024-09-14 18:09:39 UTC
README
一个将 nelmio/alice 和 fzaninotto/Faker 集成到 Zend Framework 2 模块的模块。AistAliceFixtures 允许您在开发或测试项目时创建 fixtures/fake 数据。它提供了一些基本工具,使您能够以可读和易于编辑的方式轻松生成具有约束的复杂数据。
安装
此模块的安装使用 composer。有关 composer 文档,请参阅 getcomposer.org。
-
通过运行以下命令使用 composer 安装模块
php composer.phar require aist/aist-alice-fixtures
或直接从 github 下载并将其放置在应用程序的
module/
目录中。 -
将
AistAliceFixtures
模块添加到config/application.config.php
的模块部分
格式化器
此模块提供扩展 faker 的额外格式化器。以下是捆绑格式化器的列表。
AistAliceFixtures\Faker\Provider\Internet
扩展 Faker\Provider\Internet
slug // 'aut-repellat-commodi-vel-itaque-nihil-id-saepe-nostrum'
uniDecode // 'Zazolc gesla jazn'
<slugify('some text')>
允许将参数传递给 slugifier
示例 fixture
AistUser\Entity\AistUser: AistUser_{1..10}: username: <username()> fullname: <firstName()> <lastName()> slug: <slugify(@self->fullname)> birthDate: <date()> email: <email()>
加载 fixture
bin/doctrine-module orm:fixtures:load --force
它将 fixture 添加到现有数据库中。
清单
- 添加 truncate 数据 & --append 选项
- 添加测试