Files
friends-of-behat-symfony-ex…/docs/03_mink_integration.md
Kamil Kokot 3c6f379b0f minor #117 Mention friends-of-behat forks of Mink-related repositories in the docs (pamil)
This PR was merged into the 2.1-dev branch.

Discussion
----------



Commits
-------

3f02ad3b58 Mention friends-of-behat forks of Mink-related repositories in the docs
2020-04-04 15:50:00 +02:00

1.4 KiB

Mink integration

SymfonyExtension provides an integration with Mink and defines a dedicated, isolated driver to use for Symfony application testing.

Installation

  1. Require the packages needed for the driver using Composer:
composer require --dev friends-of-behat/mink friends-of-behat/mink-extension friends-of-behat/mink-browserkit-driver

Those friends-of-behat packages are forks of the original ones, adding support for Symfony 5 and dropping support for Symfony <4.4.

  1. Enable the bundled driver:
# behat.yml.dist / behat.yml

default:
    extensions:
        # ...
        Behat\MinkExtension:
            sessions:
                symfony:
                    symfony: ~

Usage

This integration provides the following services to use inside Symfony container:

  • behat.mink (autowired by \Behat\Mink\Mink) - the Mink service

  • behat.mink.default_session (autowired by \Behat\Mink\Session) - the default Mink session for the current scenario

  • behat.mink.parameters (autowired by \FriendsOfBehat\SymfonyExtension\Mink\MinkParameters) - an object containing the configuration parameters of MinkExtension (implementing \ArrayAccess so that it can be treated as an array)

  • behat.driver.service_container - service container used by the symfony Mink driver, useful for assertions based on application state after a request has been handled