Skip to content

Commit ab64a2f

Browse files
committed
Issue #313: Step definition for placing block
1 parent 203929d commit ab64a2f

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace Drupal\DrupalExtension\Context;
4+
5+
use Behat\MinkExtension\Context\RawMinkContext;
6+
use Behat\Behat\Context\TranslatableContext;
7+
8+
/**
9+
* Extensions to the Mink Extension.
10+
*/
11+
class BlockContext extends RawDrupalContext implements TranslatableContext {
12+
13+
/**
14+
* Returns list of definition translation resources paths.
15+
*
16+
* @return array
17+
*/
18+
public static function getTranslationResources() {
19+
return glob(__DIR__ . '/../../../../i18n/*.xliff');
20+
}
21+
22+
/**
23+
* @Given I place block :delta of module :module at region :region
24+
*/
25+
public function assertPlaceBlockNew($delta, $module, $region) {
26+
$this->placeBlock($delta, $module, $region);
27+
}
28+
29+
}

src/Drupal/DrupalExtension/Context/RawDrupalContext.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,4 +603,8 @@ public function loggedInWithRole($role) {
603603
return $this->loggedIn() && $this->getUserManager()->currentUserHasRole($role);
604604
}
605605

606+
public function placeBlock($delta, $module, $region) {
607+
$this->getDriver()->placeBlock($delta, $module, $region);
608+
}
609+
606610
}

0 commit comments

Comments
 (0)