Closed cordoval closed 12 years ago
This is broken. getting the doctrine registry from the behat container will not work. The context need to get it from the Symfony container (accessible thanks to the Symfony2Extension)
how then should we approach it @stof? I have read what @everzet wrote but so should I work on a custom extension? i mean is there a simpler way to get it working?
why a custom extension ? what you need is already provided by the Symfony2Extension, but it need to be used in the context. Btw, trying to use the code would have show you a failure with an invalid service id.
so i mean is very well possible, i don't have to develop but it is already possible right? just checking
yeah, you simply need to update the context totally instead of just changing the base class.
You should just implement KernelAwareInterface
and Behat with Symfony2Extension will ensure rest (that this context OR subcontext will actually recieve kernel instance).
@everzet it is implementing KernelAwareInterface, I am confused
so according to how this is done in the example here:
$doctrine = $this->kernel->getContainer()->get('doctrine'); ?
so the common context don't work anymore? I am confused
@cordoval This is exactly the reason an update is needed
i guess I copy the code inside the WebAPIContext and plug it into my own like here: https://github.com/Behat/Symfony2Extension/blob/master/testapp/src/Behat/Sf2DemoBundle/Features/Context/WebContext.php
but then how to call it from within my FeatureContext? just use it like a boss? that is amazing, or am i still confused? can you do a line of how to use it?
is this how you import the context? @web ? I mean i have a set of several contexts to which DIC passes the kernel i write my own steps in each of these contexts and on myfeat.feature i write on each @web, @specialized etc etc that is the way one uses it?
also second question is how to use a meta step in one context borrowed from another context?
oh wow i will experiment, just saw your behat.yml https://github.com/Behat/Symfony2Extension/blob/master/testapp/behat.yml amazing @everzet, cool man good job, there are hidden gems to be exposed there
I think i figured it out @everzet will you let me port at least one of the Contexts? I will go ahead and send PR
just missed switching this class as well
I am doing this now, hope it is ok with behat 2.4
also common-contexts is too small i guess to have a develop branch so I am PR'eing master