Merge branch '2.0'
* 2.0: Revert mink parameters autoconfiguration Fix typo
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"php": "^7.1",
|
"php": "^7.1",
|
||||||
"behat/behat": "^3.4",
|
"behat/behat": "^3.4",
|
||||||
"symfony/dependency-injection": "^3.4.10|^4.2",
|
"symfony/dependency-injection": "^3.4|^4.2",
|
||||||
"symfony/http-kernel": "^3.4|^4.2",
|
"symfony/http-kernel": "^3.4|^4.2",
|
||||||
"symfony/proxy-manager-bridge": "^3.4|^4.2"
|
"symfony/proxy-manager-bridge": "^3.4|^4.2"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ Feature: Using SymfonyExtension
|
|||||||
Then the application's kernel should use "test" environment
|
Then the application's kernel should use "test" environment
|
||||||
```
|
```
|
||||||
|
|
||||||
There are two methods to check the kernel's environment - either by calling `getEnviornment()` method on the kernel itself
|
There are two methods to check the kernel's environment - either by calling `getEnvironment()` method on the kernel itself
|
||||||
or by injecting `%kernel.environment%` parameter.
|
or by injecting `%kernel.environment%` parameter.
|
||||||
|
|
||||||
We'll need also a dummy context implementation:
|
We'll need also a dummy context implementation:
|
||||||
|
|||||||
@@ -31,5 +31,5 @@ This integration provides two services to use inside Symfony container:
|
|||||||
|
|
||||||
* **`behat.mink.default_session`** (autowired by `\Behat\Mink\Session`) - the default Mink session for the current scenario
|
* **`behat.mink.default_session`** (autowired by `\Behat\Mink\Session`) - the default Mink session for the current scenario
|
||||||
|
|
||||||
* **`behat.mink.parameters`** (autoconfigured by `$minkParameters`) - an array (`\ArrayAccess` object) containing the
|
* **`behat.mink.parameters`** (autowired by `\FriendsOfBehat\SymfonyExtension\Mink\MinkParameters`) - an object
|
||||||
configuration parameters of `MinkExtension`
|
containing the configuration parameters of `MinkExtension` (implementing `\ArrayAccess` so that it can be treated as an array)
|
||||||
|
|||||||
@@ -39,22 +39,15 @@ Feature: Mink integration with dependency injection
|
|||||||
|
|
||||||
use Behat\Behat\Context\Context;
|
use Behat\Behat\Context\Context;
|
||||||
use Behat\Mink\Session;
|
use Behat\Mink\Session;
|
||||||
|
use FriendsOfBehat\SymfonyExtension\Mink\MinkParameters;
|
||||||
use Psr\Container\ContainerInterface;
|
use Psr\Container\ContainerInterface;
|
||||||
|
|
||||||
final class SomeContext implements Context {
|
final class SomeContext implements Context {
|
||||||
private $session;
|
private $session;
|
||||||
private $parameters;
|
private $parameters;
|
||||||
|
|
||||||
public function __construct(Session $session, $minkParameters)
|
public function __construct(Session $session, MinkParameters $minkParameters)
|
||||||
{
|
{
|
||||||
if (!is_array($minkParameters) && !$minkParameters instanceof \ArrayAccess) {
|
|
||||||
throw new \InvalidArgumentException(sprintf(
|
|
||||||
'"$parameters" passed to "%s" has to be an array or implement "%s".',
|
|
||||||
self::class,
|
|
||||||
\ArrayAccess::class
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->session = $session;
|
$this->session = $session;
|
||||||
$this->parameters = $minkParameters;
|
$this->parameters = $minkParameters;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,12 +47,6 @@ final class FriendsOfBehatSymfonyExtensionExtension extends Extension implements
|
|||||||
{
|
{
|
||||||
$this->registerMinkDefaultSession($container);
|
$this->registerMinkDefaultSession($container);
|
||||||
$this->registerMinkParameters($container);
|
$this->registerMinkParameters($container);
|
||||||
|
|
||||||
$autoconfiguredContextPrototype = $container->registerForAutoconfiguration(Context::class);
|
|
||||||
$autoconfiguredContextPrototype->setBindings(array_merge(
|
|
||||||
$autoconfiguredContextPrototype->getBindings(),
|
|
||||||
['$minkParameters' => new Reference('behat.mink.parameters')]
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function registerMinkDefaultSession(ContainerBuilder $container): void
|
private function registerMinkDefaultSession(ContainerBuilder $container): void
|
||||||
|
|||||||
Reference in New Issue
Block a user