2017 © Pedro Peláez
 

behat-extension behat-lumen-extension

Lumen extension for Behat

image

chimerarocks/behat-lumen-extension

Lumen extension for Behat

  • Thursday, March 29, 2018
  • by chimerarocks
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 16 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

THIS IS A FORK OF arisro/behat-lumen-extension

This version (v2.0.1) is compatible with Lumen 5.2; for older versions use v1.0.0.

This is an adaptation for Lumen of the Laravel Behat Extension package (https://github.com/laracasts/Behat-Laravel-Extension)., (*1)

It's a custom Behat / Mink driver which extends the BrowserKit driver., (*2)

This will allow you to write functional tests using Behat (boot the Lumen application in a custom environment, mock components from the FeatureContext, requests are done directly on the application - no external requests)., (*3)

To get started, you only need to follow a few steps:, (*4)

1. Install Dependencies

As always, we need to pull in some dependencies through Composer., (*5)

composer require behat/behat behat/mink behat/mink-extension arisro/behat-lumen-extension --dev

This will give us access to Behat, Mink, and, of course, the Lumen extension., (*6)

If you want to use a custom .env file for the Behat tests you will need to modify bootstrap/app.php like this:, (*7)

try {
    (new Dotenv\Dotenv(__DIR__.'/../', isset($dotEnvFile) ?: '.env'))->load();
} catch (Dotenv\Exception\InvalidPathException $e) {
    //
}

2. Create the behat.yml configuration file

Next, within your project root, create a behat.yml file, and add:, (*8)

default:
  autoload: [ %paths.base%/tests/functional/contexts ]
  extensions:
    Arisro\Behat\ServiceContainer\LumenExtension:
      # env_file: .env.behat
    Behat\MinkExtension:
      default_session: lumen
      lumen: ~
  suites:
    default:
      paths: [ %paths.base%/tests/functional/features ]
      filters:
      contexts:
        - FeatureContext

Optinally, you can specify a different .env file for your functional tests (with a test DB for example)., (*9)

3. Write Some Features

You have a very small example here https://github.com/arisro/behat-lumen-example., (*10)

Note: if you want to leverage some of the Mink helpers in your FeatureContext file, then be sure to extend Behat\MinkExtension\Context\MinkContext., (*11)

The Versions

29/03 2018

dev-master

9999999-dev

Lumen extension for Behat

  Sources   Download

MIT

The Requires

 

The Development Requires

by Aris Buzachis

bdd extension lumen behat

29/03 2018

v3.0.0

3.0.0.0

Lumen extension for Behat

  Sources   Download

MIT

The Requires

 

The Development Requires

by Aris Buzachis

bdd extension lumen behat

24/03 2016

v2.0.1

2.0.1.0

Lumen extension for Behat

  Sources   Download

MIT

The Requires

 

The Development Requires

by Aris Buzachis

bdd extension lumen behat

11/02 2016

v2.0.0

2.0.0.0

Lumen extension for Behat

  Sources   Download

MIT

The Requires

 

The Development Requires

by Aris Buzachis

bdd extension lumen behat

09/07 2015

v1.0.0

1.0.0.0

Lumen extension for Behat

  Sources   Download

MIT

The Requires

 

The Development Requires

by Aris Buzachis

bdd extension lumen behat