PHPackages                             pavlakis/slim-behat-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. [Testing &amp; Quality](/categories/testing)
4. /
5. pavlakis/slim-behat-extension

ActiveBehat-extension[Testing &amp; Quality](/categories/testing)

pavlakis/slim-behat-extension
=============================

Slim 3 extension for Behat

1.0.2(8y ago)511.8k↓70.6%2MITPHPPHP &gt;=5.4

Since Jan 11Pushed 8y ago1 watchersCompare

[ Source](https://github.com/pavlakis/slim-behat-extension)[ Packagist](https://packagist.org/packages/pavlakis/slim-behat-extension)[ RSS](/packages/pavlakis-slim-behat-extension/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (7)Versions (6)Used By (0)

A Behat 3 extension for Slim 3
==============================

[](#a-behat-3-extension-for-slim-3)

### This extension was written based on the [Behat Laravel Extension](https://github.com/laracasts/Behat-Laravel-Extension)

[](#this-extension-was-written-based-on-the-behat-laravel-extension)

Can install it with composer through packagist
----------------------------------------------

[](#can-install-it-with-composer-through-packagist)

```
 composer require --dev pavlakis/slim-behat-extension

```

On your behat.yml file add the extension within the *extensions* section
------------------------------------------------------------------------

[](#on-your-behatyml-file-add-the-extension-within-the-extensions-section)

```
    Pavlakis\Slim\Behat: ~

```

The above is the minimum setup as long as you are using [Akrabat's Slim 3 Skeleton](https://github.com/akrabat/slim3-skeleton) with the default location for `settings.php` at `app/settings.php` and `behat.yml` inside `tests/behat`.

This is the expected directory structure for the default configuration:

```
- my_app_dir
|___ app
    |_______ settings.php
    |_______ dependencies.php
|___ tests
    |_________ behat
    	       |_____ behat.yml

```

If `behat.yml` is in the root folder, use the following:

```
default:
  suites:
    default:
      contexts:
        - FeatureContext

  extensions:
    Pavlakis\Slim\Behat:
      config_file: app/settings.php
      dependencies_file: app/dependencies.php

```

Apart from the config (settings.php) all other parameters are optional, however you can also pass:

```
      config_file: ../../app/configs/settings_test.php
      dependencies_file: ../../app/dependencies.php
      middleware_file: ../../middleware.php
      routes_file: ../../routes.php

```

In your *FeatureContext* file
-----------------------------

[](#in-your-featurecontext-file)

- Include the *KernelAwareContext* interface
- Include the *Pavlakis\\Slim\\Behat\\Context\\App* trait
- Access the Slim 3 app using `$this->app`

### Feature Context example

[](#feature-context-example)

Use the `logger` to log some text to ensure the extension works.

> FeatureContext.php

```
