Download the PHP package brunty/laravel-behat-fixtures without Composer
On this page you can find all versions of the php package brunty/laravel-behat-fixtures. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download brunty/laravel-behat-fixtures
More information about brunty/laravel-behat-fixtures
Files in brunty/laravel-behat-fixtures
Package laravel-behat-fixtures
Short Description Provides a way to load fixture data into the DB when using Behat with Laravel
License MIT
Informations about the package laravel-behat-fixtures
Data fixtures in Behat with Laravel
Installation
This package requires that you have the Laracasts: Behat Laravel Extension setup and working. Due to relying on that to load and setup Laravel for us.
composer require brunty/laravel-behat-fixtures --dev
Configuration
Include the fixture in your suite, and pass it the path to your fixtures folder:
Usage
Resetting & Refreshing the Database
This package gives access to a tag that uses the BeforeScenario
hook. It refreshes your database migrations before each scenario, use @db-refresh
either before every scenario in a feature, or individual scenarios:
Fixtures
Creating files within the fixture folder enables them to be loaded into features and scenarios. These are just plain ol' PHP files, so you can create things using Laravel's factory()
method, or using Eloquent methods on your Models:
%paths.base%/features/bootstrap/fixtures/users.base.php
You can then load these fixture files with the @fixture
tag, where the tag content is the fixture file name (minus the .php
extension):
If you wanted to load multiple fixtures for a scenario, you can do so:
These would then be loaded in the order: users.base.php
followed by users.active.php
Contributing
This started as a project of boredom one Saturday evening, if you find yourself using this, and want more features, please feel free to suggest them, or submit a PR!
Although this project is small, openness and inclusivity are taken seriously. To that end the following code of conduct has been adopted.
Contributor Code of Conduct
All versions of laravel-behat-fixtures with dependencies
behat/behat Version ^3.3
behat/mink Version ^1.7
behat/mink-extension Version ^2.2
illuminate/support Version ^5.4