PHPackages                             hi-media/pdo-tools - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. hi-media/pdo-tools

ActiveLibrary[Testing &amp; Quality](/categories/testing)

hi-media/pdo-tools
==================

Simplifies the build of a database for testing purposes and allows you to easily verify the contents of a database after operations.

v1.1.1(11y ago)31.6k2[1 PRs](https://github.com/Hi-Media/pdo-tools/pulls)LGPL-3.0+PHPPHP &gt;=5.3.3

Since Dec 2Pushed 10y agoCompare

[ Source](https://github.com/Hi-Media/pdo-tools)[ Packagist](https://packagist.org/packages/hi-media/pdo-tools)[ RSS](/packages/hi-media-pdo-tools/feed)WikiDiscussions stable Synced 3w ago

READMEChangelogDependencies (7)Versions (4)Used By (0)

pdo-tools
=========

[](#pdo-tools)

pdo-tools simplifies the build of a database for testing purposes and allows you to easily verify the contents of a database after operations.

Specifically pdo-tools is a small PHP class extending `PHPUnit_Framework_TestCase` (see [PHPUnit](https://phpunit.de/)) allowing to dynamically build entirely new test databases, with:

- no database, schema or privileges prerequisites,
- keep the last `N` built databases (customizable, for monitoring and debugging),
- easy fixtures,
- additional specific assertions,
- powerful combination of `PDO`/`PDOStatement` mock objects and callbacks, *e.g.* to mock a third-party database,
- ready-to-use with [Jenkins](http://jenkins-ci.org/) and local PHPUnit.

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Usage](#usage)
    - [Instantiation](#instantiation)
    - [Simple test](#simple-test)
    - [Mocking a third-party database](#mocking-a-third-party-database)
- [Documentation](#documentation)
- [Change log](#change-log)
- [Contributions](#contributions)
- [Versioning &amp; Git branching model](#versioning--git-branching-model)
- [Copyrights &amp; licensing](#copyrights--licensing)

Installation
------------

[](#installation)

1. Class autoloading and dependencies are managed by [Composer](http://getcomposer.org/)so install it following the instructions on [Composer: Installation - \*nix](http://getcomposer.org/doc/00-intro.md#installation-nix)or just run the following command:

    ```
    $ curl -sS https://getcomposer.org/installer | php
    ```
2. Add dependency to `Himedia\PDOTools` into require section of your `composer.json`:

    ```
    {
        "require": {
            "hi-media/pdo-tools": "1.*"
        }
    }
    ```

    and run `php composer.phar install` from the terminal into the root folder of your project.
3. Include Composer's autoloader:

    ```
