Using zend-test with Behat

I’ve been successfully using Behat with zend-test, but only by making my contexts inherit from AbstractHttpControllerTestCase. This means I can only have one context per Behat suite.

This limits my ability to organize context code.

Is there a more clever way to use the two together? Ideally I’d like to inject a shared instance of AbstractHttpControllerTestCase into each context, but as far as I can tell Behat doesn’t support this.

There are at least two answers (yay!)

And Behat’s own “helper containers”:

Note that we wrote the roave/behat-psr11extension because the built-in only works with a symfony container.

Ah, thanks for the clarification Marco.

I asked just that question in the Q&A channel on zf slack (at the risk of making a loop: )

I’m not seeing the use case for a full-fledged container with Behat - I only ever want to inject some top-level, application level object.

Maybe I’m suffering from lack of imagination.

Behat is not just an E2E scenario verification tool: you can use it in isolated portions of your service layer.