diff --git a/composer.json b/composer.json index 9516f04..eccefa7 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "require": { "php": ">=5.3.2", - "behat/behat": "~3@dev", + "behat/behat": "~3.0-RC1@dev", "behat/mink": ">=1.4.3,<1.6-dev", "symfony/config": "~2.2" }, diff --git a/src/Behat/MinkExtension/Context/Initializer/MinkAwareInitializer.php b/src/Behat/MinkExtension/Context/Initializer/MinkAwareInitializer.php index 184b8a0..9b8d7d1 100644 --- a/src/Behat/MinkExtension/Context/Initializer/MinkAwareInitializer.php +++ b/src/Behat/MinkExtension/Context/Initializer/MinkAwareInitializer.php @@ -2,11 +2,10 @@ namespace Behat\MinkExtension\Context\Initializer; -use Behat\Behat\Context\Initializer\InitializerInterface, - Behat\Behat\Context\ContextInterface; +use Behat\Behat\Context\Context; +use Behat\Behat\Context\Initializer\ContextInitializer; use Behat\Mink\Mink; - use Behat\MinkExtension\Context\MinkAwareInterface; /* @@ -23,7 +22,7 @@ use Behat\MinkExtension\Context\MinkAwareInterface; * * @author Konstantin Kudryashov */ -class MinkAwareInitializer implements InitializerInterface +class MinkAwareInitializer implements ContextInitializer { private $mink; private $parameters; @@ -43,11 +42,11 @@ class MinkAwareInitializer implements InitializerInterface /** * Checks if initializer supports provided context. * - * @param ContextInterface $context + * @param Context $context * * @return Boolean */ - public function supports(ContextInterface $context) + public function supportsContext(Context $context) { // if context/subcontext implements MinkAwareInterface if ($context instanceof MinkAwareInterface) { @@ -68,9 +67,9 @@ class MinkAwareInitializer implements InitializerInterface /** * Initializes provided context. * - * @param ContextInterface $context + * @param Context $context */ - public function initialize(ContextInterface $context) + public function initializeContext(Context $context) { $context->setMink($this->mink); $context->setMinkParameters($this->parameters); diff --git a/src/Behat/MinkExtension/Context/MinkContext.php b/src/Behat/MinkExtension/Context/MinkContext.php index f8c4435..7f5edb1 100644 --- a/src/Behat/MinkExtension/Context/MinkContext.php +++ b/src/Behat/MinkExtension/Context/MinkContext.php @@ -2,11 +2,9 @@ namespace Behat\MinkExtension\Context; +use Behat\Behat\Context\TranslatableContext; use Behat\Gherkin\Node\TableNode; -use Behat\Behat\Context\TranslatableContextInterface, - Behat\Behat\Event\ScenarioEvent; - /* * This file is part of the Behat\MinkExtension. * (c) Konstantin Kudryashov @@ -21,7 +19,7 @@ use Behat\Behat\Context\TranslatableContextInterface, * * @author Konstantin Kudryashov */ -class MinkContext extends RawMinkContext implements TranslatableContextInterface +class MinkContext extends RawMinkContext implements TranslatableContext { /** * Opens homepage. diff --git a/src/Behat/MinkExtension/Context/RawMinkContext.php b/src/Behat/MinkExtension/Context/RawMinkContext.php index 8291d0e..cb23cdb 100644 --- a/src/Behat/MinkExtension/Context/RawMinkContext.php +++ b/src/Behat/MinkExtension/Context/RawMinkContext.php @@ -2,7 +2,7 @@ namespace Behat\MinkExtension\Context; -use Behat\Behat\Context\ContextInterface; +use Behat\Behat\Context\Context; use Behat\Mink\Mink, Behat\Mink\WebAssert, @@ -22,7 +22,7 @@ use Behat\Mink\Mink, * * @author Konstantin Kudryashov */ -class RawMinkContext implements MinkAwareInterface, ContextInterface +class RawMinkContext implements MinkAwareInterface, Context { private $mink; private $minkParameters; diff --git a/src/Behat/MinkExtension/Extension.php b/src/Behat/MinkExtension/Extension.php index a8e209a..92a5480 100644 --- a/src/Behat/MinkExtension/Extension.php +++ b/src/Behat/MinkExtension/Extension.php @@ -2,12 +2,14 @@ namespace Behat\MinkExtension; +use Behat\MinkExtension\Compiler\SelectorsPass; +use Behat\MinkExtension\Compiler\SessionsPass; use Symfony\Component\Config\FileLocator, Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition, Symfony\Component\DependencyInjection\ContainerBuilder, 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 @@ -23,15 +25,12 @@ use Behat\Behat\Extension\ExtensionInterface; * * @author Konstantin Kudryashov */ -class Extension implements ExtensionInterface +class Extension implements BaseExtension { /** - * Loads a specific configuration. - * - * @param array $config Extension configuration hash (from behat.yml) - * @param ContainerBuilder $container ContainerBuilder instance + * {@inheritDoc} */ - public function load(array $config, ContainerBuilder $container) + public function load(ContainerBuilder $container, array $config) { $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/services')); $loader->load('core.xml'); @@ -159,11 +158,9 @@ class Extension implements ExtensionInterface } /** - * Setups configuration for current extension. - * - * @param ArrayNodeDefinition $builder + * {@inheritDoc} */ - public function getConfig(ArrayNodeDefinition $builder) + public function configure(ArrayNodeDefinition $builder) { $config = $this->loadEnvironmentConfiguration(); @@ -406,16 +403,23 @@ class Extension implements ExtensionInterface } /** - * Returns compiler passes used by mink extension. - * - * @return array + * {@inheritDoc} */ - public function getCompilerPasses() + public function getConfigKey() { - return array( - new Compiler\SelectorsPass(), - new Compiler\SessionsPass(), - ); + return 'mink'; + } + + /** + * {@inheritDoc} + */ + public function process(ContainerBuilder $container) + { + $sessionsPass = new SessionsPass(); + $selectorPass = new SelectorsPass(); + + $sessionsPass->process($container); + $selectorPass->process($container); } protected function loadEnvironmentConfiguration() @@ -428,8 +432,4 @@ class Extension implements ExtensionInterface return $config; } - public function getName() - { - return 'mink'; - } -} +} \ No newline at end of file diff --git a/src/Behat/MinkExtension/services/core.xml b/src/Behat/MinkExtension/services/core.xml index 7ed4a3d..e22a8a5 100644 --- a/src/Behat/MinkExtension/services/core.xml +++ b/src/Behat/MinkExtension/services/core.xml @@ -43,7 +43,7 @@ %behat.mink.parameters% - +