Provide documentation for SymfonyExtension v2

This commit is contained in:
Kamil Kokot
2019-01-18 17:28:31 +01:00
parent 237cbac77e
commit b5e6348a3a
7 changed files with 388 additions and 3 deletions

115
docs/installation.md Normal file
View File

@@ -0,0 +1,115 @@
## Installation
### Symfony 4 (with Flex)
1. Require this extension using *Composer* and allow for using contrib recipes:
```bash
composer require --dev friends-of-behat/symfony-extension:^2.0
```
### Symfony 4 (without Flex)
1. Require this extension using *Composer*:
```bash
composer require --dev friends-of-behat/symfony-extension:^2.0
```
2. Enable it within your Behat configuration:
```yaml
# behat.yml.dist / behat.yml
default:
extensions:
FriendsOfBehat\SymfonyExtension: ~
```
3. Register a helper bundle in your kernel:
```php
# config/bundles.php
return [
// ...
FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true],
];
```
4. Create `tests/Behat` directory for Behat-related classes:
```bash
mkdir -p tests/Behat
```
5. Set up autowiring and autoconfiguration for Behat-related services you'll create later:
```yaml
# config/services_test.yaml
services:
_defaults:
autowire: true
autoconfigure: true
App\Tests\Behat\:
resource: '../tests/Behat/*'
```
### Symfony 3 (old directory structure)
1. Require this extension using *Composer*:
```bash
composer require --dev friends-of-behat/symfony-extension:^2.0
```
2. Enable it within your Behat configuration:
```yaml
# behat.yml.dist / behat.yml
default:
extensions:
FriendsOfBehat\SymfonyExtension: ~
```
3. Register a helper bundle in your kernel:
```php
# app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
);
if ('test' === $this->getEnvironment()) {
$bundles[] = new \FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle();
}
}
```
4. Create `tests/Behat` directory for Behat-related classes:
```bash
mkdir -p tests/Behat
```
5. Set up autowiring and autoconfiguration for Behat-related services you'll create later:
```yaml
# app/config/config_test.yml
# ...
services:
_defaults:
autowire: true
autoconfigure: true
Tests\Behat\:
resource: '../../tests/Behat/*'
```