PHPackages                             arrow-web-sol/behat-laravel-extension - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. arrow-web-sol/behat-laravel-extension

ActiveBehat-extension

arrow-web-sol/behat-laravel-extension
=====================================

Laravel extension for Behat. Forked from laracasts/behat-laravel-extension

v1.1.3(7y ago)019MITPHPPHP &gt;=5.4

Since Feb 28Pushed 7y ago1 watchersCompare

[ Source](https://github.com/ArrowWebSolutions/Behat-Laravel-Extension)[ Packagist](https://packagist.org/packages/arrow-web-sol/behat-laravel-extension)[ RSS](/packages/arrow-web-sol-behat-laravel-extension/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (5)Versions (7)Used By (0)

This extension offers an incredibly simple (and fast) way to begin testing and driving your Laravel applications with Behat. Some benefits include:

- **Fast:** It doesn't depend on anything like Goutte, so it offers a super-fast way to test your UI. You don't even need to setup a host to run your tests.
- **Refresh:** Laravel is automatically rebooted after each scenario (so nothing like user sessions will be persisted).
- **Environments:** Specifying custom environment files (like the `.env` one) for different app environments is a little tricky in Laravel 5. This extension handles that for you automatically. By default, it'll look for a `.env.behat` file in your project root.
- **Access Laravel:** You instantly have access to Laravel (things like facades and such) from your `FeatureContext` file.
- **Workflow:** A number of useful traits are available, which will speed up your workflow.

To get started, you only need to follow a few steps:

> Prefer a video walk-through? [See this lesson from Laracasts](https://laracasts.com/lessons/laravel-5-and-behat-bffs).

1. Install Dependencies
=======================

[](#1-install-dependencies)

As always, we need to pull in some dependencies through Composer.

```
composer require behat/behat behat/mink behat/mink-extension laracasts/behat-laravel-extension symfony/dependency-injection:"3.*" --dev

```

This will give us access to Behat, Mink, and, of course, the Laravel extension.

2. Create the Behat.yml Configuration File
==========================================

[](#2-create-the-behatyml-configuration-file)

Next, within your project root, create a `behat.yml` file, and add:

```
default:
    extensions:
        Laracasts\Behat:
            # env_path: .env.behat
        Behat\MinkExtension:
            default_session: laravel
            laravel: ~

```

Here, is where we reference the Laravel extension, and tell Behat to use it as our default session. You may pass an optional parameter, `env_path` (currently commented out above) to specify the name of the environment file that should be referenced from your tests. By default, it'll look for a `.env.behat` file.

This file should, like the standard `.env` file in your project root, contain any special environment variables for your tests (such as a special acceptance test-specific database).

3. Setting up FeatureContext
============================

[](#3-setting-up-featurecontext)

Run, from the root of your app

```
vendor/bin/behat --init

```

It should set

```
features/bootstrap/FeatureContext.php

```

At this point you should set it to extend MinkContext.

```
