imjoehaines / flowdception
A Codeception Extension for Flowder
Installs: 180 144
Dependents: 0
Suggesters: 1
Security: 0
Stars: 0
Watchers: 2
Forks: 3
Open Issues: 0
Requires
- codeception/codeception: ^4.1
- imjoehaines/flowder: ^2.0
Requires (Dev)
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-11-29 04:52:22 UTC
README
Flowdception is a Codeception Extension for integrating the Flowder fixture loader into Codeception test suites.
Usage
-
Install Flowdception as a development dependency through Composer
$ composer install imjoehaines/flowdception --dev
-
Enable Flowdception as an extension in your main
codeception.yml
, or a specific suite's YAML configuration file (e.g.integration.suite.yml
)extensions: enabled: - \Imjoehaines\Flowder\Codeception\Flowdception
-
Bootstrap Flowdception by calling
Flowdception::bootsrap
in one of your_bootstrap.php
Codeception files, passing in an instance of\Imjoehaines\Flowder\Flowder
(see the Flowder documentation for more information).A simple SQLite example might look like this:
<?php require __DIR__ . '/../vendor/autoload.php'; use Imjoehaines\Flowder\Codeception\Flowdception; use Imjoehaines\Flowder\Loader\PhpFileLoader; use Imjoehaines\Flowder\Truncator\SqliteTruncator; use Imjoehaines\Flowder\Persister\SqlitePersister; $db = new PDO(...); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); Flowdception::bootstrap( __DIR__ . '/_data/example.php', new PhpFileLoader(), new SqliteTruncator($db), new SqlitePersister($db) );
-
That's it! Before any Codeception test file runs, Flowder will load your fixture data for you