This context use the nelmio/alice fixture loading system.
Warning : Alice context is compatible with Alice since this commit. For the moment, you have to follow dev-master branch of nelmio/alice.
Edit behat.yml
default:
# ...
suites:
default:
# ...
contexts:
- # ...
- Knp\FriendlyContexts\Context\AliceContext
extensions:
# ...
Knp\FriendlyContexts\Extension:
alice:
fixtures:
User: path/to/my/user/fixtures.yml
Product: path/to/my/product/fixtures.yml
dependencies: ~Load a file
@alice(User) @alice(Product)
Feature: My feature
The feature description
...Load all files
@alice(*)
Feature: My feature
The feature description
...If, for example, you have to load a "User" alice file before a "Product" alice file, you can do it directly from the feature :
@alice(User) @alice(Product)
Feature: My feature
...Or you can manage de dependence via your behat.yml
default:
# ...
suites:
default:
# ...
contexts:
- # ...
extensions:
# ...
Knp\FriendlyContexts\Extension:
alice:
fixtures:
User: path/to/my/user/fixtures.yml
Product: path/to/my/product/fixtures.yml
dependencies:
Product: [ User ]
# ...All imported fixtures can be re-used in the Entity Context as object reference.
# user.yml
App\Entity\User:
user-john:
firstname: John
lastname: Doe
user-admin:
firstname: Admin
lastname: Admin@alice(User)
Feature: My feature
The feature description
Background:
Given the following products
| name | user |
| Ball | John |
| Shoes | Admin |
...You can add a provider via a class name or a Symfony service
default:
# ...
suites:
default:
# ...
contexts:
- # ...
extensions:
# ...
Knp\FriendlyContexts\Extension:
alice:
fixtures: #...
dependencies: # ...
providers:
- App\Alice\MyProvider # from class
- @app.alice.my_provider # from serviceFiles will be loaded following the order of files declaration in your behat.yml file. Tag order have no impact.