zonuexe / phactory
PHP 单元测试数据库工厂
v0.5.0
2015-12-01 18:12 UTC
Requires
- php: >= 5.4.0
- doctrine/inflector: ^1.1
Requires (Dev)
- ext-pdo: *
- phpunit/phpunit: ^4.8.19
Suggests
- ext-mongo: Allows use of Phactory for testing against MongoDB databases
- ext-pdo: Allows use of Phactory for testing against SQL databases
- ext-pdo_mysql: Allows use of Phactory for testing against MySQL databases
- ext-pdo_sqlite: Allows use of Phactory for testing against SQLite databases
This package is not auto-updated.
Last update: 2024-09-14 17:26:42 UTC
README
这是什么?
Phactory 是一种在 PHP 单元测试中使用数据库固定数据的替代方案。你不需要维护一个单独的 XML 数据文件,而是通过 Phactory::define() 定义每个表的蓝图,然后根据需要创建尽可能多的不同对象。
Phactory 受 Factory Girl 的启发。
特性
- 使用 Phactory::define() 一次性为你的表行定义默认值,然后通过调用 Phactory::create() 轻松创建该表的对象。
- 在定义的表之间创建关联,对象在创建时会自动在数据库中建立关联。
- 使用序列为每个创建的对象生成唯一的值。
数据库支持
- MySQL
- Sqlite
- Postgresql
语言支持
- PHP >= 5.3
限制
- 每个表必须有一个整数主键以实现关联。