2017 © Pedro Peláez
 

library behat3-symfony-extension

Symfony extension for Behat V3

image

yoanm/behat3-symfony-extension

Symfony extension for Behat V3

  • Monday, January 2, 2017
  • by yoanm
  • Repository
  • 0 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 1 Suggesters
  • 0 Forks
  • 2 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Behat3SymfonyExtension

Scrutinizer Build Status Scrutinizer Code Quality Code Coverage, (*1)

Travis Build Status PHP Versions Symfony Versions, (*2)

Latest Stable Version, (*3)

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

Why

See Why ? Or rather, why not Symfony2Extension ?, (*5)

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

Configuration

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

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 :, (*8)

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

KernelAwareInterface

Will inject your symfony app kernel instance in your behat contexts, (*10)

LoggerAwareInterface

Will inject a monolog logger instance in your behat contexts, (*11)

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

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

Debug mode

To enable extension debug mode, add the following in your behat configuration file :, (*14)

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

In case you just want the log entry, just add the following in your behat configuration file : yaml default: extensions: Yoanm\BehatUtilsExtension: logger: level: DEBUG, (*16)

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

Contributing

See contributing note, (*18)

The Versions