I am new to Behat and YAML, and I am unable to pass large arrays of parameters to the FeatureContext constructor.
It worked fine with Behat 2:
behat.yml (short for convenience):
default:
context:
extensions:
Behat\MinkExtension\Extension:
base_url: 'http://mysite.local'
goutte: ~
selenium2: ~
...
imports:
- config/data/mydata.yml
and mydata.yml:
default:
context:
parameters:
some_long_array:
'key1': 'value1'
'key2': 'value2'
...
and I could have many such imported parameter files.
Using Behat 3 - I tried to achieve the same with the following behat.yml (shortened):
default:
suites:
default:
contexts:
- FeatureContext
extensions:
Behat\MinkExtension:
base_url: 'http://mysite.local'
goutte: ~
selenium2: ~
...
imports:
- config/data/mydata.yml
and mydata.yml:
default:
suites:
default:
contexts:
- FeatureContext:
parameters:
some_long_array:
'key1': 'value1'
'key2': 'value2'
...
This does not work, and nothing is passed to the constructor.
Recoverable fatal error: argument 1 passed to FeatureContext :: __ construct () must be from an array of types, none of those listed in FeatureContext β __ construct ()
My FeatureContext class is as follows:
class FeatureContext implements SnippetAcceptingContext
{
public function __construct(array $parameters)
{
var_dump($parameters);
}
}
If I pass inline parameters in the behat.yml file (and not in the imported file), everything works fine:
default:
suites:
default:
contexts:
- FeatureContext:
parameters:
some_long_array:
'key1': 'value1'
'key2': 'value2'
extensions:
Behat\MinkExtension:
base_url: 'http://mysite.local'
goutte: ~
selenium2: ~
...
, , . , , behat.yml.
Behat 3?