yoanm/behat3-symfony-extension

This package is abandoned and no longer maintained. No replacement package was suggested.

Symfony extension for Behat V3

0.2.1 2017-01-02 22:59 UTC

This package is auto-updated.

Last update: 2022-02-21 19:19:26 UTC


README

Scrutinizer Build Status Scrutinizer Code Quality Code Coverage

Travis Build Status PHP Versions Symfony Versions

Latest Stable Version

Behat3SymfonyExtension is a layer between Behat 3.0+ and Symfony2.7+|3+, strongly inspired by Symfony2Extension.

Why

See Why ? Or rather, why not Symfony2Extension ?

Install

> composer require --dev yoanm/behat3-symfony-extension

How to use

Behat3SymfonyExtension require yoanm/behat-utils-extension, behat/behat, monolog/monolog, symfony/browser-kit and symfony/framework-bundle

Configuration

Add the following in your behat configuration file (usually behat.yml) :

default:
    extensions:
        Yoanm\BehatUtilsExtension: ~
        Yoanm\Behat3SymfonyExtension: ~

To use the behat3Symfony driver for mink (created thanks to Behat3SymfonyDriverFactory), install and configure behat/mink-extension and behat/mink-browserkit-driver. Then, add the following in your behat configuration file :

default:
    extensions:
        Behat\MinkExtension:
            sessions:
                my_session:
                    behat3Symfony: ~

In the box

Client

It will be used by the mink driver if mink installed and configured to use the behat3Symfony driver

KernelAwareInterface

Will inject your symfony app kernel instance in your behat contexts

LoggerAwareInterface

Will inject a monolog logger instance in your behat contexts

SfKernelEventLogger

Only in case where kernel.debug is set to true (see default kernel configuration below). Produce a log entry each time that your symfony application kernel will :

  • handle a request
  • catch an exception

All data are loggued in the configured file (see default logger configuration below)

Debug mode

To enable extension debug mode, add the following in your behat configuration file :

default:
    extensions:
        Yoanm\Behat3SymfonyExtension: 
            debug_mode: true

This mode allow two things :

  • Kernel bridge class file is not deleted. If you have some errors related to the bridge, it will be easier for debug.
  • Some new log entry are added, regarding Kernel bridge and Client behavior

In case you just want the log entry, just add the following in your behat configuration file :

default:
    extensions:
        Yoanm\BehatUtilsExtension:
             logger:
                level: DEBUG

Configuration reference

default:
    extensions:
        Yoanm\Behat3SymfonyExtension: 
            debug_mode: false
            kernel:
                bootstrap: app/autoload.php
                path: app/AppKernel.php
                class: AppKernel
                env: test
                debug: true
                reboot: true # If true symfony kernel will be rebooted BEFORE each scenario/example

Tests

This repository follow a custom test strategy

Contributing

See contributing note