diff --git a/behat.yml.dist b/behat.yml.dist index 62a37d33..7ce1cde1 100644 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -64,6 +64,7 @@ drupal7: - Drupal\DrupalExtension\Context\DrupalContext - Drupal\DrupalExtension\Context\MinkContext - Drupal\DrupalExtension\Context\MarkupContext + - Drupal\DrupalExtension\Context\BlockContext filters: tags: "@d7" extensions: diff --git a/features/blackbox.feature b/features/blackbox.feature index 96549dd2..a688e293 100644 --- a/features/blackbox.feature +++ b/features/blackbox.feature @@ -13,7 +13,7 @@ Feature: Test DrupalContext Given I am at "community" When I click "IRC" in the "content" region Then I should see "Page status" in the "right sidebar" - And I should see the link "Drupal News" in the "footer" region + And I should see the link "Drupal News" in the "footer" region Scenario: Viewing content in a region Given I am on the homepage diff --git a/features/block.feature b/features/block.feature new file mode 100644 index 00000000..b23c2bb9 --- /dev/null +++ b/features/block.feature @@ -0,0 +1,6 @@ +@d7 +Feature: Block + Test placement of blocks + + Scenario: Test whether block placement is working + Given I place block "navigation" of module "system" at region "sidebar_first" of theme "bartik" diff --git a/src/Drupal/DrupalExtension/Context/BlockContext.php b/src/Drupal/DrupalExtension/Context/BlockContext.php new file mode 100644 index 00000000..c8360c4e --- /dev/null +++ b/src/Drupal/DrupalExtension/Context/BlockContext.php @@ -0,0 +1,30 @@ +placeBlock($delta, $module, $region, $theme); + $this->getSession()->getPage()->find("block-$module-$delta"); + } + +} diff --git a/src/Drupal/DrupalExtension/Context/RawDrupalContext.php b/src/Drupal/DrupalExtension/Context/RawDrupalContext.php index b2cdaddd..1ca1df95 100644 --- a/src/Drupal/DrupalExtension/Context/RawDrupalContext.php +++ b/src/Drupal/DrupalExtension/Context/RawDrupalContext.php @@ -603,4 +603,8 @@ public function loggedInWithRole($role) { return $this->loggedIn() && $this->getUserManager()->currentUserHasRole($role); } + public function placeBlock($delta, $module, $region, $theme) { + $this->getDriver()->placeBlock($delta, $module, $region, $theme); + } + }