Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 5 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,35 +27,18 @@ Requires the FriendsOfBehat [SymfonyExtension](https://github.com/FriendsOfBehat
extensions:
Persata\SymfonyApiExtension: ~
FriendsOfBehat\SymfonyExtension:
bootstrap: config/bootstrap.php
kernel:
bootstrap: vendor/autoload.php
class: App\Kernel
path: src/Kernel.php
environment: test
debug: true
```

## Additional Custom Contexts

This package provides a `ContextInitializer` that will set the shared `ApiClient` on any Behat Contexts that implement the `ApiClientAwareContext`. It is best to extend the `RawApiContext` as this already includes the getter & setter for the `ApiClient` instance.

## ContextServiceExtension Integration

If using the FriendsOfBehat [ContextServiceExtension](https://github.com/FriendsOfBehat/ContextServiceExtension), declare the `ApiContext` service like so:

```yaml
services:
# ...
Persata\SymfonyApiExtension\Context\ApiContext:
tags:
- { name: fob.context_service }
```

If you need additional context services with access to the same shared ApiClient instance, have them extend `RawApiContext` and then declare the service like so:

```yaml
services:
# ...
TheClass\Of\Your\CustomContext:
tags:
- { name: fob.context_service }
```

## FOSRest Form Validation

Expand Down
6 changes: 1 addition & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,11 @@
"webmozart/assert": "^1.0",
"symfony/http-kernel": "^3.0|^4.0",
"symfony/browser-kit": "^3.0|^4.0",
"friends-of-behat/symfony-extension": "^0.2.1|^1.0"
"friends-of-behat/symfony-extension": "^2.0"
},
"require-dev": {
"phpunit/phpunit": "^6"
},
"suggest": {
"friends-of-behat/cross-container-extension": "^1.0",
"friends-of-behat/context-service-extension": "^1.0"
},
"autoload": {
"psr-4": {
"Persata\\SymfonyApiExtension\\": "src/"
Expand Down
2 changes: 1 addition & 1 deletion src/ServiceContainer/SymfonyApiExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function configure(ArrayNodeDefinition $builder)
public function load(ContainerBuilder $container, array $config)
{
$container->setDefinition(self::API_CLIENT_ID, new Definition(ApiClient::class, [
new Reference(SymfonyExtension::DRIVER_KERNEL_ID),
new Reference(SymfonyExtension::KERNEL_ID),
$config['base_url']
]));

Expand Down