Open ockam opened 7 years ago
@ockam thanks for your message. I've looked briefly into your code snippets. At first glance I can't see the problem. The configuration looks ok it's enough for the extension to start working, the definition of your FeatureContext should also be enough.
I only wonder if the codifico/parameter-bag-extension was installed correctly, especially if you wrote that it's returning null. Could you somehow make sure that extension works correct in your environment?
The extension is installed correctly. I tried loading it directly in my behat.yml extensions but that didn’t work.
Not sure I understand how it is initialized in the first place. Where should I look?
I've taken a look into my project using that extension and in behat.yml I have also ParameterBagExtension loaded, that like:
extensions:
// ...
Codifico\ParameterBagExtension\ServiceContainer\ParameterBagExtension:
parameter_bag:
class: Codifico\ParameterBagExtension\Bag\InMemoryPlaceholderBag
// ...
You can also try adding it. You could add it my way, or the way described on that extension's documentation:
extensions:
// ...
Codifico\ParameterBagExtension\ServiceContainer\ParameterBagExtension: ~
// ...
Please inform if it helped.
I tried both, before and after the call to your extension, and still no luck.
I also tried to dd inside ParameterBagAwareInitializer and that does nothing (like it’s never triggered).
OK. I’m making some progress: ParameterBagAwareInitializer
initializeContext
fails on this condition:
if (!$context instanceof ParameterBagAwareContext && !$this->usesParameterBag($context)) {
return;
}
I’m using your package in a Laravel 5.4 project and this is my first experience with Behat.
When running Behat, I get the followiing error:
I trace it back to the
extractFromParameterBag
method in RestApiContext.$this->getParameterBag()
isnull
. If I plainly return the string (commenting out line 688), it works fine.Am I missing a configuration?
Here’s by behat.yml:
My feature:
And my FeatureContext: