Skip to content

Instantly share code, notes, and snippets.

@kerasai
kerasai / Search API Reindex
Last active June 27, 2017 22:58
Drupal 8, populates the Search API queue for indexing all entities. Needed in cases where the entity does not populate the index queue on its own.
<?php
$index = \Drupal\search_api\Entity\Index::load('index_name');
foreach ($index->getDatasources() as $id => $datasource) {
$index->trackItemsInserted($id, $datasource->getItemIds());
}
@kerasai
kerasai / FailureContext.php
Last active August 3, 2017 11:05
Behat context for obtaining screenshots on step failure.
<?php
use Behat\Mink\Driver\Selenium2Driver;
use Behat\Behat\Hook\Scope\AfterStepScope;
use Behat\Mink\Mink;
use Behat\MinkExtension\Context\MinkAwareContext;
/**
* Class FailureContext.
*
@kerasai
kerasai / Vagrantfile
Last active March 20, 2017 20:20
Kerasai LAMP Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.manage_guest = true
config.vm.define 'mywebsite' do |box|
box.vm.box = "kerasai/lamp"
<?php
use Behat\Behat\Context\Context;
use Behat\Behat\Context\SnippetAcceptingContext;
/**
* Defines application features from the specific context.
*/
class FeatureContext implements Context, SnippetAcceptingContext {
Feature: As a user of the drupal-extension and drupal driver
I want to properly set term references on content
So that I may reliably conduct tests
@api
Scenario: Duplicate terms in different vocabs
Given "category" terms:
| name |
| A |
| B |