<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kamil Kokot</title>
    <description>The latest articles on DEV Community by Kamil Kokot (@pamil).</description>
    <link>https://dev.to/pamil</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F13814%2Ff40b69a3-2960-4386-ba34-2ac7179929b3.jpeg</url>
      <title>DEV Community: Kamil Kokot</title>
      <link>https://dev.to/pamil</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pamil"/>
    <language>en</language>
    <item>
      <title>Seven Commands to Bulletproof Your Symfony Application CI Build</title>
      <dc:creator>Kamil Kokot</dc:creator>
      <pubDate>Sun, 12 Jan 2020 00:00:00 +0000</pubDate>
      <link>https://dev.to/pamil/seven-commands-to-bulletproof-your-symfony-application-ci-build-pp2</link>
      <guid>https://dev.to/pamil/seven-commands-to-bulletproof-your-symfony-application-ci-build-pp2</guid>
      <description>&lt;p&gt;This blogpost has been originally published on &lt;a href="https://kamilkokot.com/seven-commands-to-bulletproof-your-symfony-application-ci-build/"&gt;kamilkokot.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Over the course of years, I noticed there are more and more checks that are usually performed in our Symfony applications’ CI environment. This is my attempt at writing down the most useful ones.&lt;/p&gt;

&lt;p&gt;Table of contents:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Checking for security vulnerabilities&lt;/li&gt;
&lt;li&gt;Validating package configuration&lt;/li&gt;
&lt;li&gt;Linting Symfony container&lt;/li&gt;
&lt;li&gt;Linting Twig templates&lt;/li&gt;
&lt;li&gt;Linting YAML files&lt;/li&gt;
&lt;li&gt;Testing Doctrine migrations&lt;/li&gt;
&lt;li&gt;Validating Doctrine mappings&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  1. Checking for security vulnerabilities
&lt;/h3&gt;

&lt;p&gt;Security should be the most critical concern while developing any application. It should come as no surprise that there are multiple solutions for ensuring that our application does not rely on dependencies with known vulnerabilities. Although they differ in usage, they are all based on the same source - &lt;a href="https://github.com/FriendsOfPHP/security-advisories"&gt;FriendsOfPHP/security-advisories&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Symfony CLI
&lt;/h4&gt;

&lt;p&gt;It is provided together with &lt;a href="https://symfony.com/download"&gt;the Symfony binary&lt;/a&gt;, which is a recommended way to create new Symfony projects and includes a convenient local web server, which comes handy during development.&lt;/p&gt;

&lt;p&gt;If you already use it as a web server in your CI build, I would recommend using it also for security checks.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;symfony security:check
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;If you do not have it in your CI build yet, the following &lt;code&gt;.travis.yml&lt;/code&gt; configuration does the job:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cache:
    directories:
        - ~/.symfony

before_install:
    - |
        if [! -f ~/.symfony/bin/symfony]; then
            wget https://get.symfony.com/cli/installer -O - | bash
        fi

script:
    - ~/.symfony/bin/symfony security:check
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  SensioLabs Security Checker
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://github.com/sensiolabs/security-checker"&gt;SensioLabs/SecurityChecker&lt;/a&gt; is what I’ve been using before switching to Symfony CLI. It uses &lt;code&gt;security.symfony.com&lt;/code&gt; API to perform the check, which means your &lt;code&gt;composer.lock&lt;/code&gt; will be uploaded there.&lt;/p&gt;

&lt;p&gt;To use it, add &lt;code&gt;sensiolabs/security-checker&lt;/code&gt; to your &lt;code&gt;require-dev&lt;/code&gt; section in &lt;code&gt;composer.json&lt;/code&gt; and then run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vendor/bin/security-checker security:check
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Roave Security Advisories
&lt;/h4&gt;

&lt;p&gt;While the previous two tools work in a similar way, &lt;a href="https://github.com/Roave/SecurityAdvisories"&gt;Roave/SecurityAdvisories&lt;/a&gt; takes a different approach.&lt;/p&gt;

&lt;p&gt;It is a Composer package which defines vulnerable packages as its conflicts, preventing them from being installed and resulting in irresolvable dependencies. This behaviour is a double-edged sword - it does not trigger when packages dependencies are installed from the lock file.&lt;/p&gt;

&lt;p&gt;My recommendation is to require this package only in the CI build:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;composer install
composer require --dev roave/security-advisories
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;However, resolving dependencies in complex projects takes a lot of time, which makes me prefer the other solutions.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Validating package configuration
&lt;/h3&gt;

&lt;p&gt;Composer provides a command to validate your &lt;code&gt;composer.json&lt;/code&gt; and &lt;code&gt;composer.lock&lt;/code&gt; files. It checks whether your lock file is up-to-date, whether used constraints are not too loose or too strict and whether the package is valid to be published on Packagist.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;composer validate --strict
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;There are a few switches available for this command:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;--strict&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Makes the command return non-zero code for warnings as well as errors. For example, having overly strict dependency (&lt;code&gt;1.0.0&lt;/code&gt; instead of &lt;code&gt;^1.0&lt;/code&gt;) in &lt;code&gt;require&lt;/code&gt; section will trigger a warning.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;--no-check-all&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Disables checking for overly strict or unbound dependencies in &lt;code&gt;require&lt;/code&gt; section. Even without this switch, it does not check the dependencies defined in &lt;code&gt;require-dev&lt;/code&gt; section.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;--no-check-lock&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Disables checking whether the lock file is up-to-date.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;--no-check-publish&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Ignores errors which prevent the package from be published on Packagist. Useful for internal applications that will not be published, but required for open source packages.&lt;/p&gt;

&lt;p&gt;I would recommend you starting with the most strict check and ignoring some parts later if needed.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Linting Symfony container
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://symfony.com/blog/new-in-symfony-4-4-service-container-linter"&gt;Introduced with Symfony 4.4&lt;/a&gt;, linting the container might help in finding dead services configurations. We found &lt;a href="https://github.com/Sylius/Sylius/pull/10926"&gt;a few in Sylius&lt;/a&gt; and decided to add it to the build to prevent us from introducing them anymore.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bin/console lint:container
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  4. Linting Twig templates
&lt;/h3&gt;

&lt;p&gt;Linting your Twig templates checks their syntax and might detect unused templates if an unexisting filter or function is used in those.&lt;a href="https://github.com/Sylius/Sylius/pull/8056"&gt;After running it on Sylius codebase&lt;/a&gt;, it has found a template calling parent blocks while not extending any template itself and another template calling an unexisting filter.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bin/console lint:twig templates
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Starting from Symfony 4.4, this command also includes a way to report usages of deprecated Twig features. It helped greatly with &lt;a href="https://github.com/Sylius/Sylius/pull/10955"&gt;the upgrade to Twig 3&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bin/console lint:twig templates--show-deprecations
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;I would not recommend adding deprecation checks to your CI build as it would make it more unstable - any deprecation in next Twig version would make it fail.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Linting YAML files
&lt;/h3&gt;

&lt;p&gt;It is easy to make errors writing YAML files compared to XML. Therefore, it is essential to get feedback on those as fast as possible.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bin/console lint:yaml config src translations
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  6. Testing Doctrine migrations
&lt;/h3&gt;

&lt;p&gt;If you provide Doctrine migrations in your application, it is desirable to test them. Most applications include the following line in their CI builds:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bin/console doctrine:migrations:migrate --no-interaction
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;While this covers the most common path, it does not test reverting these migrations.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bin/console doctrine:migrations:migrate --no-interaction
bin/console doctrine:migrations:migrate first --no-interaction
bin/console doctrine:migrations:migrate --no-interaction
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;These three commands will first create the schema in the database, then revert the changes and create it once again.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Validating Doctrine mappings
&lt;/h3&gt;

&lt;p&gt;After the migrations have been run or the database schema has been synchronised in any other way, it’s worth to validate your Doctrine mappings and whether they’re correctly synchronised with the database schema.&lt;/p&gt;

&lt;p&gt;It can be done with the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bin/console doctrine:schema:validate
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Surely, this list is non-exhaustive: it completely misses static analysers, testing frameworks, coding standard fixers and automation tools, which I would like to include in another blog post in this series.&lt;/p&gt;

&lt;p&gt;What it mainly focuses on are commands that can be added with little effort but might be often overlooked. If you use one of those, but it wasn’t mentioned above, let me know in the comments!&lt;/p&gt;

</description>
      <category>php</category>
      <category>symfony</category>
      <category>travis</category>
      <category>ci</category>
    </item>
    <item>
      <title>Tame Behat with the Brand New Symfony Extension</title>
      <dc:creator>Kamil Kokot</dc:creator>
      <pubDate>Mon, 11 Feb 2019 00:00:00 +0000</pubDate>
      <link>https://dev.to/pamil/tame-behat-with-the-brand-new-symfony-extension-ih9</link>
      <guid>https://dev.to/pamil/tame-behat-with-the-brand-new-symfony-extension-ih9</guid>
      <description>&lt;p&gt;This blogpost has been originally published at &lt;a href="https://kamilkokot.com/tame-behat-with-the-brand-new-symfony-extension/"&gt;kamilkokot.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Over two years after the first release of this &lt;a href="https://github.com/FriendsOfBehat"&gt;Friends of Behat&lt;/a&gt;’s &lt;a href="https://github.com/FriendsOfBehat/SymfonyExtension"&gt;Symfony Extension&lt;/a&gt;, I’m happy to announce the availability of the second major version and write more about it.&lt;/p&gt;

&lt;p&gt;It is the already battle-tested solution with &lt;a href="https://github.com/Sylius/Sylius/pull/10102"&gt;Sylius&lt;/a&gt; on 1300+ scenarios containing 14000+ steps, getting traction in projects like &lt;a href="https://github.com/akeneo/pim-community-dev/pull/9416"&gt;Akeneo&lt;/a&gt; or &lt;a href="https://github.com/Monofony/SymfonyStarter/pull/103"&gt;Monofony&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The mission behind it is to simplify the process of implementing &lt;a href="http://behat.org/en/latest/"&gt;Behat&lt;/a&gt; contexts so that you can focus on the communication with stakeholders and writing down business features instead of figuring out low-level testing infrastructure details.&lt;/p&gt;

&lt;h3&gt;
  
  
  TL;DR
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Support for Symfony’s autowiring and autoconfiguration&lt;/li&gt;
&lt;li&gt;Symfony Flex contrib recipe to make installation easier&lt;/li&gt;
&lt;li&gt;Zero-configuration for most Symfony 3 and 4 based apps&lt;/li&gt;
&lt;li&gt;Unified application configuration and dotenv file handling (similar to the PHPUnit one)&lt;/li&gt;
&lt;li&gt;Integration with Mink, available out of the box&lt;/li&gt;
&lt;li&gt;Simplified usage, reduced the number of extensions from three to one&lt;/li&gt;
&lt;li&gt;Improved developer experience with more descriptive exceptions and more predictable overall behaviour&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want to try it first, &lt;a href="https://github.com/FriendsOfBehat/SymfonyExtension#documentation"&gt;dive straight into the documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I am working on an entry-level tutorial for SymfonyExtension v2, make sure to &lt;a href="https://twitter.com/intent/follow?region=follow_link&amp;amp;screen_name=pamilme&amp;amp;source=followbutton&amp;amp;variant=2.0"&gt;follow me on Twitter&lt;/a&gt;if you do not want to miss it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Support for Symfony’s autowiring and autoconfiguration
&lt;/h3&gt;

&lt;p&gt;Ever since I have started working with Behat and Symfony on more complex projects, the number of configuration changes needed to implement even simple steps was an issue and it was going worse and worse.&lt;/p&gt;

&lt;p&gt;Whether it was &lt;code&gt;Behat/Symfony2Extension&lt;/code&gt; or &lt;code&gt;FriendsOfBehat/SymfonyExtension&lt;/code&gt;, injecting a dependency into a context required too much hassle and pulled me away from the domain being modelled.&lt;/p&gt;

&lt;p&gt;The common use case is to have a context which implements a step like &lt;code&gt;Given I am a logged in customer&lt;/code&gt; that is used in every suite which does web acceptance testing.&lt;/p&gt;

&lt;p&gt;Let’s assume we need two Behat suites using the same context depending on &lt;code&gt;kernel&lt;/code&gt; service and compare the required configuration for every Symfony extension for Behat out there.&lt;/p&gt;

&lt;h4&gt;
  
  
  Behat/Symfony2Extension
&lt;/h4&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# behat.yml
first_suite:
    contexts: - FeatureContext: kernel: '@kernel'            
second_suite:
    contexts: - FeatureContext: kernel: '@kernel'
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This snippet does not look that bad, mostly because of its size. It gets longer and longer with every new dependency or suite though. Adding a new dependency to a context requires changing the configuration of every suite.&lt;/p&gt;

&lt;h4&gt;
  
  
  FriendsOfBehat/SymfonyExtension v1
&lt;/h4&gt;

&lt;p&gt;Finding all places where a context is used and modifying its dependencies is a boring work, which I wanted to avoid in the first version of FOB’s SymfonyExtension.&lt;/p&gt;

&lt;p&gt;It was possible by registering contexts as services, which fundamentally changes the way you use them in Behat. This is why I decided to write my own extension to integrate Behat with Symfony.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# behat.yml
first_suite:
    contexts_services: - FeatureContext            
second_suite:
    contexts_services: - FeatureContext

# Symfony services file loaded by the extension
services:
    FeatureContext:
        arguments:
            - '@ __symfony__.kernel' tags: ['fob.context_service']
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The duplication is removed, but it has introduced more boilerplate code and own conventions which are hard to get at first:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;__symfony__&lt;/code&gt; prefix when referencing service from Symfony application container prevented autocomplete in IDEs from working correctly&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;fob.context_service&lt;/code&gt; tag was required by the internal infrastructure to be able to use a service as a context, but it caused bugs quite often as it was so easy to forget it&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;contexts_services&lt;/code&gt; instead of default &lt;code&gt;contexts&lt;/code&gt; has not introduced any measurable benefit, it was supposed to prevent conflicts with the default configuration if one does not use context services in every suite&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The whole process of registering contexts manually was far from pleasant.&lt;/p&gt;

&lt;h4&gt;
  
  
  FriendsOfBehat/SymfonyExtension v2
&lt;/h4&gt;

&lt;p&gt;The newest version reduces required boilerplate code by incorporating autowiring and autoconfiguration as first-class mechanisms and sticking to the already known conventions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# behat.yml
first_suite:
    contexts: - App\Tests\Behat\FeatureContext            
second_suite:
    contexts: - App\Tests\Behat\FeatureContext
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;If your context constructor has kernel argument type-hinted, this is all you need to make it work.&lt;/p&gt;

&lt;p&gt;No need to worry about duplicated configuration, weird conventions, tagging contexts or using prefixes when referring to services. And you can inject private services as well!&lt;/p&gt;

&lt;p&gt;The extension provides a dependency injection configuration which automatically finds your contexts and autowires them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# config/services_test.yaml
services:
    _defaults:
        autowire: true
        autoconfigure: true

    App\Tests\Behat\:
        resource: '../tests/Behat/*'
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The following file is loaded only in the test environment. Your production and development environments are not affected with any performance loss. However, if you prefer not to rely on autowiring, you can define the context as a service on your own - remember to make it public though:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# config/services_test.yaml
services:
    App\Tests\Behat\FeatureContext:
        arguments:
            - '@kernel'
        public: true
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Symfony Flex recipe
&lt;/h3&gt;

&lt;p&gt;If you use &lt;a href="https://symfony.com/doc/current/setup/flex.html"&gt;Symfony Flex&lt;/a&gt; to manage your Symfony application, installation and configuration of the extension could not be easier.&lt;/p&gt;

&lt;p&gt;All you need to do is to install the extension and agree for installing a contrib recipe for it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;composer install friends-of-behat/symfony-extension:^2.0 --dev
composer exec behat
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;In less than a minute you have a working setup of Behat with SymfonyExtension and you are ready to write your features.&lt;/p&gt;

&lt;p&gt;If you do not use Symfony Flex, &lt;a href="https://github.com/FriendsOfBehat/SymfonyExtension/blob/master/docs/01_installation.md#installation"&gt;follow the installation documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Zero-configuration for most Symfony 3 and 4 based apps
&lt;/h3&gt;

&lt;p&gt;Whether you use Symfony 3 or Symfony 4, the new extension got you covered.&lt;/p&gt;

&lt;p&gt;It will try to guess the sensible default configuration and in most cases, you will not need to write any more configuration than the following (assuming Flex have not done it for you):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# behat.yml
default:
    extensions:
        FriendsOfBehat\SymfonyExtension: ~
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://github.com/FriendsOfBehat/SymfonyExtension/blob/master/docs/05_configuration_reference.md#configuration-reference"&gt;Learn more about the default settings&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Mink integration
&lt;/h3&gt;

&lt;p&gt;This extension provides a driver for &lt;a href="http://mink.behat.org/en/latest/"&gt;Mink&lt;/a&gt; based on BrowserKit called &lt;code&gt;symfony&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If you switch from &lt;code&gt;Behat\Symfony2Extension&lt;/code&gt;, the behaviour stays mostly the same. There is only one minor implementation detail that is worth to know.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;symfony2&lt;/code&gt; driver from the former extension uses the same kernel for both fetching application services and handling requests. This might lead to unexpected results if your code is not idempotent and relies on services state.&lt;/p&gt;

&lt;p&gt;Given the following scenario and its implementation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Please do not write scenarios like this
# It is just for demonstration purposes
Given the service state is set to 42
Then I should get 42 from the API
And I should get 42 from the API

# Context implementation
/**
 * @Given the service state is set to :state
 */
public function serviceStateIs(string $state): void
{
    $this-&amp;gt;service-&amp;gt;setState($state);
}

/**
 * @Then I should get :state from the API
 */
public function iShouldGetFromAPI(string $state): void
{
    $this-&amp;gt;minkSession-&amp;gt;visit('/api/');
    assert($state === $this-&amp;gt;minkSession-&amp;gt;getPage()-&amp;gt;getContent());
}

# Symfony controller
public function __invoke(): Response
{
    return new Response($this-&amp;gt;service-&amp;gt;getState());
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This scenario would fail on the second &lt;code&gt;Then&lt;/code&gt; step when using &lt;code&gt;Behat\Symfony2Extension&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It happens because the kernel is rebooted after each request, so that the first &lt;code&gt;Then&lt;/code&gt; step one uses the same container that is used in Behat &lt;code&gt;Given&lt;/code&gt; step before, but the second &lt;code&gt;Then&lt;/code&gt; step uses a rebooted container which does not share the same state. This might make your tests fragile, eg. when you change assertions order.&lt;/p&gt;

&lt;p&gt;When run with &lt;code&gt;FriendsOfBehat\SymfonyExtension&lt;/code&gt;, the scenario would fail on the first &lt;code&gt;Then&lt;/code&gt; step because the service state is not shared between Behat and HTTP application.&lt;/p&gt;

&lt;p&gt;If you want to learn more, check out &lt;a href="https://github.com/FriendsOfBehat/SymfonyExtension/blob/master/docs/04_bs2e_differences.md#differences-from-behatsymfony2extension"&gt;the documentation about differences between Symfony extensions&lt;/a&gt;or &lt;a href="https://github.com/FriendsOfBehat/SymfonyExtension/blob/master/docs/03_mink_integration.md#mink-integration"&gt;the documenation about Mink integration&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  What’s next?
&lt;/h3&gt;

&lt;p&gt;With all those new, shiny features mentioned above, there are still a few ideas in my mind that would be great to see in the future:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/FriendsOfBehat/SymfonyExtension/issues/61"&gt;providing Mink as a service&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/FriendsOfBehat/SymfonyExtension/issues/62"&gt;autowiring and autoconfiguration for steps definitions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/FriendsOfBehat/SymfonyExtension/issues/67"&gt;exposing BrowserKit API as complementary to Mink API (with Panther support)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I made a GitHub project which is used as a &lt;a href="https://github.com/FriendsOfBehat/SymfonyExtension/projects/1"&gt;roadmap&lt;/a&gt; for this project.&lt;/p&gt;

</description>
      <category>php</category>
      <category>bdd</category>
      <category>behat</category>
      <category>symfony</category>
    </item>
  </channel>
</rss>
