News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Project:
Phactory - A Database Factory for Unit Tests
August 12, 2010 @ 08:46:36

Josh Butts pointed out a new tool for those creating unit tests (either in PHPUnit, SimpleTest or any other PHP unit testing framework) that work with databases that replaces fixtures - Phactory.

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 in your PHP code. By using a database factory instead of fixtures, your unit tests will be more clear and easier to write. You'll also be able to change the objects you create programmatically instead of being stuck with the same old fixtures.

The tool gives you a light-weight ORM to use in your tests and, once you define a PDO connection, lets you interact with the objects just like they were normal tables. An example is included on the main page of the site and the code for the project can be found on github.

0 comments voice your opinion now!
unittest phactory database phpunit simpletest


blog comments powered by Disqus

Similar Posts

Sebastian Bergamnn's Blog: SeleniumTestCase Improvements in PHPUnit 3.2

Damian Sromek's Blog: [How to] Run PHPUnit tests using database 10x faster

Patrick Reilly's Blog: Zend Framework Project Teams Need You

VG Tech Blog: Mocking the File System Using PHPUnit and vfsStream

Kevin Schroeder's Blog: Remote Debugging with the Zend Debugger and PHPUnit


Community Events





Don't see your event here?
Let us know!


community symfony developer release list laravel language api code zendserver deployment interview development podcast tips series framework conference threedevsandamaybe introduction

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework