Follow

Behat peeps:

What's the best way to organize contexts? Our API context is growing larger and larger, and I'd like to break it up.

Splitting them into child classes seems to run me into manually configuring their parameters though, which will be a pain

@dragonmantank it's hard to say something without looking at what you have, but two things that helped me with reusing contexts' behaviour were:
- not having much logic in the contexts, injecting same services into multiple contexts via DI container
- not relying on inheritance or traits but rather simply injecting the instance of a context into the dependant using the hooks system (you can fetch other contexts from the scope): behat.org/en/latest/user_guide

Sign in to participate in the conversation
PHP Community on Mastodon

Open source. Open community. We are dedicated to building and enriching the PHP community.