https://github.com/netsells/dredd-hooks-laravel
A clean way to add your dredd hooks when using Laravel
https://github.com/netsells/dredd-hooks-laravel
dredd dredd-hooks laravel php
Last synced: 30 days ago
JSON representation
A clean way to add your dredd hooks when using Laravel
- Host: GitHub
- URL: https://github.com/netsells/dredd-hooks-laravel
- Owner: netsells
- License: mit
- Created: 2018-02-21T19:57:52.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2021-05-28T06:24:16.000Z (almost 4 years ago)
- Last Synced: 2025-03-24T20:11:20.417Z (about 2 months ago)
- Topics: dredd, dredd-hooks, laravel, php
- Language: PHP
- Homepage:
- Size: 17.6 KB
- Stars: 4
- Watchers: 0
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Laravel Hooks for Dredd API Testing Framework
[](https://packagist.org/packages/netsells/dredd-hooks-laravel)
[](https://packagist.org/packages/netsells/dredd-hooks-laravel)
[]()This package contains a PHP Dredd hook handler which provides a bridge between the [Dredd API Testing Framework](http://dredd.readthedocs.org/en/latest/)
and PHP environment to ease implementation of testing hooks provided by [Dredd](http://dredd.readthedocs.org/en/latest/). Most of the heavy lifting is provided by the [ddelnano/dredd-hooks-php](https://github.com/ddelnano/dredd-hooks-php) package.
It is created and maintained by the [Netsells team](https://netsells.co.uk/)## Installation
### ComposerLaravel Hooks for Dredd should be installed via composer, we recommend you put this in your require-dev section.
```bash
composer require netsells/dredd-hooks-laravel --dev
```### Dredd Setup
In order to inject environment variables and use the full power of Larvel Dredd Hooks, you need to add the following to your `dredd.yml` file (or put in your console arguments).```yml
# This can be any single file which extends Netsells\Dredd\Kernel
hookfiles: 'tests/dredd/Kernel.php'language: 'vendor/bin/dredd-hooks-laravel'
server: 'php -S 127.0.0.1:3000 ./vendor/netsells/dredd-hooks-laravel/server.php -t public/'
endpoint: 'http://127.0.0.1:3000'
```## Usage
The package requires you to make a single file (named in the `hookfiles` part of dredd.yml above). This should have at least the `handle` method.
```php
beforeEach(function (Transaction &$transaction) {
Artisan::call('migrate:fresh');
Artisan::call('passport:install');Artisan::call('db:seed');
});$hook->group('Posts', Hooks\Posts::class);
}
}
```