If you're starting a new project, we recommend to use Symfony 4 with Flex as it's the most straightforward way. If you're adding this extension to an existing project, pick the method that fits it the best.
- Require this extension using Composer and allow for using contrib recipes:
composer require --dev friends-of-behat/symfony-extension:^2.0
- Require this extension using Composer:
composer require --dev friends-of-behat/symfony-extension:^2.0
- Enable it within your Behat configuration:
# behat.yml.dist / behat.yml
default:
extensions:
FriendsOfBehat\SymfonyExtension: ~
- Register a helper bundle in your kernel:
# config/bundles.php
return [
// ...
FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true],
];
- Create
tests/Behat
directory for Behat-related classes:
mkdir -p tests/Behat
- Set up autowiring and autoconfiguration for Behat-related services you'll create later:
# config/services_test.yaml
services:
_defaults:
autowire: true
autoconfigure: true
App\Tests\Behat\:
resource: '../tests/Behat/*'
- Require this extension using Composer:
composer require --dev friends-of-behat/symfony-extension:^2.0
- Enable it within your Behat configuration:
# behat.yml.dist / behat.yml
default:
extensions:
FriendsOfBehat\SymfonyExtension: ~
- Register a helper bundle in your kernel:
# app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
);
if ('test' === $this->getEnvironment()) {
$bundles[] = new \FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle();
}
}
- Create
tests/Behat
directory for Behat-related classes:
mkdir -p tests/Behat
- Set up autowiring and autoconfiguration for Behat-related services you'll create later:
# app/config/config_test.yml
# ...
services:
_defaults:
autowire: true
autoconfigure: true
Tests\Behat\:
resource: '../../tests/Behat/*'