made compatible with behat 3rc1
This commit is contained in:
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
namespace Behat\MinkExtension\Context\Initializer;
|
namespace Behat\MinkExtension\Context\Initializer;
|
||||||
|
|
||||||
use Behat\Behat\Context\Initializer\InitializerInterface,
|
use Behat\Behat\Context\Context;
|
||||||
|
use Behat\Behat\Context\Initializer\ContextInitializer,
|
||||||
Behat\Behat\Context\ContextInterface;
|
Behat\Behat\Context\ContextInterface;
|
||||||
|
|
||||||
use Behat\Mink\Mink;
|
use Behat\Mink\Mink;
|
||||||
@@ -23,7 +24,7 @@ use Behat\MinkExtension\Context\MinkAwareInterface;
|
|||||||
*
|
*
|
||||||
* @author Konstantin Kudryashov <ever.zet@gmail.com>
|
* @author Konstantin Kudryashov <ever.zet@gmail.com>
|
||||||
*/
|
*/
|
||||||
class MinkAwareInitializer implements InitializerInterface
|
class MinkAwareInitializer implements ContextInitializer
|
||||||
{
|
{
|
||||||
private $mink;
|
private $mink;
|
||||||
private $parameters;
|
private $parameters;
|
||||||
@@ -43,11 +44,11 @@ class MinkAwareInitializer implements InitializerInterface
|
|||||||
/**
|
/**
|
||||||
* Checks if initializer supports provided context.
|
* Checks if initializer supports provided context.
|
||||||
*
|
*
|
||||||
* @param ContextInterface $context
|
* @param Context $context
|
||||||
*
|
*
|
||||||
* @return Boolean
|
* @return Boolean
|
||||||
*/
|
*/
|
||||||
public function supports(ContextInterface $context)
|
public function supportsContext(Context $context)
|
||||||
{
|
{
|
||||||
// if context/subcontext implements MinkAwareInterface
|
// if context/subcontext implements MinkAwareInterface
|
||||||
if ($context instanceof MinkAwareInterface) {
|
if ($context instanceof MinkAwareInterface) {
|
||||||
@@ -68,9 +69,9 @@ class MinkAwareInitializer implements InitializerInterface
|
|||||||
/**
|
/**
|
||||||
* Initializes provided context.
|
* Initializes provided context.
|
||||||
*
|
*
|
||||||
* @param ContextInterface $context
|
* @param Context $context
|
||||||
*/
|
*/
|
||||||
public function initialize(ContextInterface $context)
|
public function initializeContext(Context $context)
|
||||||
{
|
{
|
||||||
$context->setMink($this->mink);
|
$context->setMink($this->mink);
|
||||||
$context->setMinkParameters($this->parameters);
|
$context->setMinkParameters($this->parameters);
|
||||||
|
|||||||
@@ -2,11 +2,9 @@
|
|||||||
|
|
||||||
namespace Behat\MinkExtension\Context;
|
namespace Behat\MinkExtension\Context;
|
||||||
|
|
||||||
|
use Behat\Behat\Context\TranslatableContext;
|
||||||
use Behat\Gherkin\Node\TableNode;
|
use Behat\Gherkin\Node\TableNode;
|
||||||
|
|
||||||
use Behat\Behat\Context\TranslatableContextInterface,
|
|
||||||
Behat\Behat\Event\ScenarioEvent;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of the Behat\MinkExtension.
|
* This file is part of the Behat\MinkExtension.
|
||||||
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
|
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
|
||||||
@@ -21,7 +19,7 @@ use Behat\Behat\Context\TranslatableContextInterface,
|
|||||||
*
|
*
|
||||||
* @author Konstantin Kudryashov <ever.zet@gmail.com>
|
* @author Konstantin Kudryashov <ever.zet@gmail.com>
|
||||||
*/
|
*/
|
||||||
class MinkContext extends RawMinkContext implements TranslatableContextInterface
|
class MinkContext extends RawMinkContext implements TranslatableContext
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Opens homepage.
|
* Opens homepage.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Behat\MinkExtension\Context;
|
namespace Behat\MinkExtension\Context;
|
||||||
|
|
||||||
use Behat\Behat\Context\ContextInterface;
|
use Behat\Behat\Context\Context;
|
||||||
|
|
||||||
use Behat\Mink\Mink,
|
use Behat\Mink\Mink,
|
||||||
Behat\Mink\WebAssert,
|
Behat\Mink\WebAssert,
|
||||||
@@ -22,7 +22,7 @@ use Behat\Mink\Mink,
|
|||||||
*
|
*
|
||||||
* @author Konstantin Kudryashov <ever.zet@gmail.com>
|
* @author Konstantin Kudryashov <ever.zet@gmail.com>
|
||||||
*/
|
*/
|
||||||
class RawMinkContext implements MinkAwareInterface, ContextInterface
|
class RawMinkContext implements MinkAwareInterface, Context
|
||||||
{
|
{
|
||||||
private $mink;
|
private $mink;
|
||||||
private $minkParameters;
|
private $minkParameters;
|
||||||
|
|||||||
@@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
namespace Behat\MinkExtension;
|
namespace Behat\MinkExtension;
|
||||||
|
|
||||||
|
use Behat\MinkExtension\Compiler\SelectorsPass;
|
||||||
|
use Behat\MinkExtension\Compiler\SessionsPass;
|
||||||
use Symfony\Component\Config\FileLocator,
|
use Symfony\Component\Config\FileLocator,
|
||||||
Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition,
|
Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition,
|
||||||
Symfony\Component\DependencyInjection\ContainerBuilder,
|
Symfony\Component\DependencyInjection\ContainerBuilder,
|
||||||
Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||||
|
|
||||||
use Behat\Behat\Extension\ExtensionInterface;
|
use Behat\Testwork\ServiceContainer\Extension as BaseExtension;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of the Behat\MinkExtension
|
* This file is part of the Behat\MinkExtension
|
||||||
@@ -23,15 +25,12 @@ use Behat\Behat\Extension\ExtensionInterface;
|
|||||||
*
|
*
|
||||||
* @author Konstantin Kudryashov <ever.zet@gmail.com>
|
* @author Konstantin Kudryashov <ever.zet@gmail.com>
|
||||||
*/
|
*/
|
||||||
class Extension implements ExtensionInterface
|
class Extension implements BaseExtension
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Loads a specific configuration.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param array $config Extension configuration hash (from behat.yml)
|
|
||||||
* @param ContainerBuilder $container ContainerBuilder instance
|
|
||||||
*/
|
*/
|
||||||
public function load(array $config, ContainerBuilder $container)
|
public function load(ContainerBuilder $container, array $config)
|
||||||
{
|
{
|
||||||
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/services'));
|
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/services'));
|
||||||
$loader->load('core.xml');
|
$loader->load('core.xml');
|
||||||
@@ -159,11 +158,9 @@ class Extension implements ExtensionInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setups configuration for current extension.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param ArrayNodeDefinition $builder
|
|
||||||
*/
|
*/
|
||||||
public function getConfig(ArrayNodeDefinition $builder)
|
public function configure(ArrayNodeDefinition $builder)
|
||||||
{
|
{
|
||||||
$config = $this->loadEnvironmentConfiguration();
|
$config = $this->loadEnvironmentConfiguration();
|
||||||
|
|
||||||
@@ -406,16 +403,23 @@ class Extension implements ExtensionInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns compiler passes used by mink extension.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
public function getCompilerPasses()
|
public function getConfigKey()
|
||||||
{
|
{
|
||||||
return array(
|
return 'mink';
|
||||||
new Compiler\SelectorsPass(),
|
}
|
||||||
new Compiler\SessionsPass(),
|
|
||||||
);
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function process(ContainerBuilder $container)
|
||||||
|
{
|
||||||
|
$sessionsPass = new SessionsPass();
|
||||||
|
$selectorPass = new SelectorsPass();
|
||||||
|
|
||||||
|
$sessionsPass->process($container);
|
||||||
|
$selectorPass->process($container);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function loadEnvironmentConfiguration()
|
protected function loadEnvironmentConfiguration()
|
||||||
@@ -428,8 +432,4 @@ class Extension implements ExtensionInterface
|
|||||||
return $config;
|
return $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName()
|
|
||||||
{
|
|
||||||
return 'mink';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
<service id="behat.mink.context.initializer" class="%behat.mink.context.initializer.class%">
|
<service id="behat.mink.context.initializer" class="%behat.mink.context.initializer.class%">
|
||||||
<argument type="service" id="behat.mink" />
|
<argument type="service" id="behat.mink" />
|
||||||
<argument>%behat.mink.parameters%</argument>
|
<argument>%behat.mink.parameters%</argument>
|
||||||
<tag name="context.initializer" />
|
<tag name="context.initializer" priority="0" />
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<service id="behat.mink.listener.sessions_listener" class="%behat.mink.listener.sessions_listener.class%">
|
<service id="behat.mink.listener.sessions_listener" class="%behat.mink.listener.sessions_listener.class%">
|
||||||
|
|||||||
Reference in New Issue
Block a user