Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/imjoehaines/flowder-phpunit
A PHPUnit Listener for Flowder
https://github.com/imjoehaines/flowder-phpunit
fixture-loading fixtures flowder phpunit phpunit-listener testing
Last synced: about 1 month ago
JSON representation
A PHPUnit Listener for Flowder
- Host: GitHub
- URL: https://github.com/imjoehaines/flowder-phpunit
- Owner: imjoehaines
- License: unlicense
- Created: 2017-03-22T21:45:21.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-27T09:16:19.000Z (over 6 years ago)
- Last Synced: 2024-12-09T03:28:38.633Z (about 1 month ago)
- Topics: fixture-loading, fixtures, flowder, phpunit, phpunit-listener, testing
- Language: PHP
- Size: 14.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Flowder PHPUnit [![Latest Stable Version](https://poser.pugx.org/imjoehaines/flowder-phpunit/v/stable)](https://packagist.org/packages/imjoehaines/flowder-phpunit) [![Build Status](https://travis-ci.org/imjoehaines/flowder-phpunit.svg?branch=master)](https://travis-ci.org/imjoehaines/flowder-phpunit) [![codecov](https://codecov.io/gh/imjoehaines/flowder-phpunit/branch/master/graph/badge.svg)](https://codecov.io/gh/imjoehaines/flowder-phpunit)
**Flowder PHPUnit** is a PHPUnit Test Listener for integrating the [Flowder](https://github.com/imjoehaines/flowder) fixture loader into PHPUnit test suites.
## Usage
1. Install Flowder PHPUnit as a development dependency through [Composer](https://getcomposer.org/)
```sh
$ composer install imjoehaines/flowder-phpunit --dev
```2. Enable Flowder PHPUnit as a test listener in your `phpunit.xml` file ([PHPUnit documentation](https://phpunit.de/manual/current/en/appendixes.configuration.html#appendixes.configuration.test-listeners))
```xml
```3. Bootstrap Flowder PHPUnit by calling `FlowderListener::bootsrap` in your PHPUnit `bootstrap.php` file, passing in an instance of `\Imjoehaines\Flowder\Flowder` (see the [Flowder documentation](https://github.com/imjoehaines/flowder) for more information).
This is only necessary until [PHPUnit #1873](https://github.com/sebastianbergmann/phpunit/issues/1873) is fixed. After this, you can configure Flowder PHPUnit through your `phpunit.xml` file instead.
A simple SQLite example might look like this:
```php
setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);FlowderListener::bootstrap(
__DIR__ . '/_data/example.php',
new PhpFileLoader(),
new SqliteTruncator($db),
new SqlitePersister($db)
);
```4. That's it! Before any test file runs, Flowder will load your fixture data for you