2017 © Pedro Peláez
 

package dredd-hooks-laravel

Laravel hooks for the Dredd testing tool

image

netsells/dredd-hooks-laravel

Laravel hooks for the Dredd testing tool

  • Wednesday, February 28, 2018
  • by spamoom
  • Repository
  • 1 Watchers
  • 0 Stars
  • 745 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 37 % Grown

The README.md

Laravel Hooks for Dredd API Testing Framework

Packagist Packagist license, (*1)

This package contains a PHP Dredd hook handler which provides a bridge between the Dredd API Testing Framework and PHP environment to ease implementation of testing hooks provided by Dredd. Most of the heavy lifting is provided by the ddelnano/dredd-hooks-php package., (*2)

It is created and maintained by the Netsells team, (*3)

Installation

Composer

Laravel Hooks for Dredd should be installed via composer, we recommend you put this in your require-dev section., (*4)

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)., (*5)

# 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., (*6)

<?php

namespace Tests\Dredd;

use Netsells\Dredd\Hook;
use Netsells\Dredd\Transaction;
use Illuminate\Support\Facades\Artisan;
use Netsells\Dredd\Kernel as DreddKernel;

class Kernel extends DreddKernel
{
    public function handle(Hook $hook)
    {
        $this->beforeEach(function (Transaction &$transaction) {
            Artisan::call('migrate:fresh');
            Artisan::call('passport:install');

            Artisan::call('db:seed');
        });

        $hook->group('Posts', Hooks\Posts::class);
    }
}

The Versions

28/02 2018

dev-master

9999999-dev

Laravel hooks for the Dredd testing tool

  Sources   Download

MIT

The Requires

 

by Sam Jordan