diff --git a/behat.yml.dist b/behat.yml.dist index f39711f0..2c56595b 100644 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -1,7 +1,7 @@ default: suites: default: - contexts: [Behat\MinkExtension\Context\MinkContext, Drupal\DrupalExtension\Context\DrupalContext] + contexts: [Drupal\DrupalExtension\Context\DrupalContext] filters: tags: "~@api&&~@drush" extensions: diff --git a/composer.json b/composer.json index 6663c39c..9bded144 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,8 @@ "behat/mink-goutte-driver": "*", "behat/mink-selenium2-driver": "*", "behat/behat": "~3.0,>=3.0.5", - "behat/mink-extension": "2.0.x-dev" + "behat/mink-extension": "2.0.x-dev", + "behat/chained-steps-extension": "1.0.x-dev" }, "require-dev": { "phpunit/phpunit": "3.7.*" @@ -34,5 +35,11 @@ "branch-alias": { "dev-master": "2.0.x-dev" } - } + }, + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/Behat/ChainedStepsExtension.git" + } + ] } diff --git a/src/Drupal/DrupalExtension/Context/DrupalContext.php b/src/Drupal/DrupalExtension/Context/DrupalContext.php index d4bb3b59..acc45298 100644 --- a/src/Drupal/DrupalExtension/Context/DrupalContext.php +++ b/src/Drupal/DrupalExtension/Context/DrupalContext.php @@ -14,8 +14,8 @@ use Symfony\Component\Process\Process; use Symfony\Component\EventDispatcher\EventDispatcher; -use Behat\Behat\Definition\Call\Given; -use Behat\Behat\Definition\Call\Then; +use Behat\ChainedStepsExtension\Step\Given; +use Behat\ChainedStepsExtension\Step\Then; use Behat\Behat\Context\TranslatableContext; use Behat\Gherkin\Node\PyStringNode; @@ -25,8 +25,10 @@ /** * Features context. + * + * @todo is there a way to inject a MinkContext instead? */ -class DrupalContext implements DrupalAwareInterface, TranslatableContext { +class DrupalContext extends MinkContext implements DrupalAwareInterface, TranslatableContext { private $drupal, $drupalParameters; diff --git a/src/Drupal/DrupalExtension/Context/Initializer/DrupalAwareInitializer.php b/src/Drupal/DrupalExtension/Context/Initializer/DrupalAwareInitializer.php index d44de6f2..6afc6138 100644 --- a/src/Drupal/DrupalExtension/Context/Initializer/DrupalAwareInitializer.php +++ b/src/Drupal/DrupalExtension/Context/Initializer/DrupalAwareInitializer.php @@ -2,21 +2,22 @@ namespace Drupal\DrupalExtension\Context\Initializer; -use Behat\Behat\Context\Initializer\InitializerInterface, - Behat\Behat\Context\ContextInterface, +use Behat\Behat\Context\Initializer\ContextInitializer, + Behat\Behat\Context\Context, Behat\Behat\Event\ScenarioEvent, Behat\Behat\Event\OutlineEvent; -use Drupal\Drupal, - Drupal\DrupalExtension\Context\DrupalContext, - Drupal\DrupalExtension\Context\DrupalSubContextFinderInterface; +use Drupal\Drupal; +use Drupal\DrupalExtension\Context\DrupalContext; +use Drupal\DrupalExtension\Context\DrupalAwareInterface; +use Drupal\DrupalExtension\Context\DrupalSubContextFinderInterface; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Finder\Finder; -class DrupalAwareInitializer implements InitializerInterface, EventSubscriberInterface { +class DrupalAwareInitializer implements ContextInitializer, EventSubscriberInterface { private $drupal, $parameters, $dispatcher; public function __construct(Drupal $drupal, array $parameters, EventDispatcher $dispatcher) { @@ -25,7 +26,10 @@ public function __construct(Drupal $drupal, array $parameters, EventDispatcher $ $this->dispatcher = $dispatcher; } - public function initialize(ContextInterface $context) { + /** + * {@inheritdocs} + */ + public function initializeContext(Context $context) { // Set Drupal driver manager. $context->setDrupal($this->drupal); diff --git a/src/Drupal/DrupalExtension/ServiceContainer/DrupalExtension.php b/src/Drupal/DrupalExtension/ServiceContainer/DrupalExtension.php index efd228c7..3c9b79f8 100644 --- a/src/Drupal/DrupalExtension/ServiceContainer/DrupalExtension.php +++ b/src/Drupal/DrupalExtension/ServiceContainer/DrupalExtension.php @@ -25,7 +25,7 @@ class DrupalExtension implements ExtensionInterface { * {@inheritDoc} */ public function getConfigKey() { - return SELF::DRUPAL_ID; + return self::DRUPAL_ID; } /** @@ -84,10 +84,7 @@ public function process(ContainerBuilder $container) { } /** - * Setup configuration for this extension. - * - * @param ArrayNodeDefinition $builder - * ArrayNodeDefinition instance. + * {@inheritDoc} */ public function configure(ArrayNodeDefinition $builder) { $builder-> @@ -168,13 +165,6 @@ public function configure(ArrayNodeDefinition $builder) { end(); } - /** - * Load Drupal Extension selectors handler. - */ - private function loadSelectorsHandler(ContainerBuilder $container) { - $container->setDefinition(self::SELECTORS_HANDLER_ID); - } - /** * Returns compiler passes used by mink extension. * diff --git a/src/Drupal/DrupalExtension/ServiceContainer/config/services.yml b/src/Drupal/DrupalExtension/ServiceContainer/config/services.yml index f0e747df..c2223f70 100644 --- a/src/Drupal/DrupalExtension/ServiceContainer/config/services.yml +++ b/src/Drupal/DrupalExtension/ServiceContainer/config/services.yml @@ -48,8 +48,8 @@ services: - %drupal.parameters% - @drupal.event_dispatcher tags: - - { name: behat.context.initializer } - - { name: behat.event_subscriber, priority: 0 } + - { name: context.initializer } + - { name: event_dispatcher.subscriber, priority: 0 } drupal.context.class_guesser: class: %drupal.context.class_guesser.class% tags: