ddarthp / phactory
A Database Factory for PHP Unit Tests
This package's canonical repository appears to be gone and the package has been frozen as a result.
dev-master
2014-09-04 20:07 UTC
Requires
- php: >=5.3.0
Requires (Dev)
- ext-mongo: *
- ext-pdo: *
- ext-pdo_sqlite: *
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-05-07 06:26:35 UTC
README
What is it?
Phactory is an alternative to using database fixtures in your PHP unit tests. Instead of maintaining a separate XML file of data, you define a blueprint for each table, and then create as many different objects as you need.
Phactory was inspired by Factory Girl.
Features
- Define default values for your table rows once with Phactory::define(), then easily create objects in that table with a call to Phactory::create().
- Create associations between your defined tables, and the objects will automatically be associated in the database upon creation.
- Use sequences to create unique values for each successive object you create.
Database Support
- MySQL
- Sqlite
- Postgresql mechas
Language Support
- PHP >= 5.3
Limitations
- Each table must have a single integer primary key for associations to work.