FeatureContext.php in Accordion Blocks 8
File
tests/features/bootstrap/FeatureContext.php
View source
<?php
use Drupal\DrupalExtension\Context\RawDrupalContext;
use Behat\Behat\Context\SnippetAcceptingContext;
use Behat\Gherkin\Node\PyStringNode;
use Behat\Gherkin\Node\TableNode;
class FeatureContext extends RawDrupalContext implements SnippetAcceptingContext {
public function __construct() {
}
public function cleanupBlocks() {
$query = Drupal::entityQuery('block_content');
$result = $query
->condition('info', 'BDD TESTING', 'STARTS_WITH')
->execute();
$eids = array_keys($result);
entity_delete_multiple('block_content', $eids);
}
public function iWaitForTheSuggestionBoxToAppear() {
$this
->getSession()
->wait(5000, "jQuery('.ui-dialog.ui-widget').length > 0");
}
public function iWaitForTheFieldItemsToAppear() {
$this
->getSession()
->wait(5000, "jQuery('input[name=\"field_blocks[2][target_id]\"]').length > 0");
}
public function iSaveBlockPlacement() {
$this
->getSession()
->wait(100, "jQuery('.ui-dialog-buttonset.form-actions button').click()");
}
}