Skip to content

Instantly share code, notes, and snippets.

View jhedstrom's full-sized avatar

Jonathan Hedstrom jhedstrom

  • Phase2
  • Portland, OR
View GitHub Profile
@jhedstrom
jhedstrom / FeatureContext.php
Last active April 5, 2019 10:25
Step-definition for complex node structure (field collection + entity reference).
<?php
/**
* @Given /^I am viewing a product with the following related products:$/
*/
public function assertRelatedProducts(TableNode $relatedProducts) {
// First, create a product.
$product = (object) array(
'title' => 'Parent Product',
'type' => 'product',
'uid' => 1,
@jhedstrom
jhedstrom / README.md
Last active December 18, 2015 01:08

Drupal Dynamic VHost Configuration

/etc/dnsmasq.d/dev

Use dnsmasq to serve up the local address for any subdomain of "dev"

Requires a working dnsmasq configuration. (May require reboot.)

sudo apt-get install dnsmasq

pre {
padding: 10px;
background-color: #4c4c4c;
color: #efefef;
}
default:
paths:
features: 'features'
extensions:
Behat\MinkExtension\Extension:
goutte: ~
selenium2: ~
base_url: http://d7.dev
show_cmd: "firefox %s"
Drupal\DrupalExtension\Extension:
default:
paths:
features: 'features'
extensions:
Behat\MinkExtension\Extension:
goutte: ~
selenium2: ~
base_url: http://local:8888/d7_dev
Drupal\DrupalExtension\Extension:
blackbox: ~
@jhedstrom
jhedstrom / gist:3645288
Created September 5, 2012 21:38
Sample HTML form indicating failed empty file uploads problem in Goutte
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="/misc/favicon.ico" type="image/x-icon" />
<title>Create Project | git6site.devdrupal.org</title>
<link type="text/css" rel="stylesheet" media="all" href="http://git6site.devdrupal.org/files/css/css_72384a9b3a77f108ecea6d7ec0b64b1
6.css" />
<script type="text/javascript" src="http://git6site.devdrupal.org/files/js/js_a7d7d8bf2ceadb7829010bc94589f34f.js"></script>
@jhedstrom
jhedstrom / gist:3170999
Created July 24, 2012 16:23
Potential composer.json for DrupalExtension
{
"name": "behat/drupal-extension",
"type": "behat-extension",
"description": "Drupal extension for Behat",
"keywords": ["drupal", "web", "test"],
"homepage": "http://drupal.org/project/drupalextension",
"license": "GPL 2",
"require": {
"behat/mink": "1.4@stable",
"behat/mink-goutte-driver": "*",
/**
* Implements hook_process_zone().
*/
function streetroots_process_zone(&$vars) {
if ($vars['elements']['#zone'] == 'content') {
$vars['breadcrumb'] = FALSE;
}
}
/**
@jhedstrom
jhedstrom / deploy.drushrc.php
Created April 13, 2012 19:45
Drush Deploy with a make file
$options['before']['deploy-symlink'][] = 'run_rebuild_task';
/**
* Run rebuild.sh.
* @task
*/
function run_rebuild_task($d) {
$d->run('cd %s/app && ./rebuild.sh', $d->release_path);
$d->run('ln -s %s/settings.php %s/sites/default/settings.php', $d->shared_path, $d->latest_release());
$d->run('ln -s %s/files %s/sites/default/files', $d->shared_path, $d->latest_release());
All necessary changes to sites/default and sites/default/settings.php have been made, so you should remove write [warning]
permissions to them now in order to avoid security risks. If you are unsure how to do so, consult the online handbook.
'all' cache was cleared [success]
No database updates required [success]
Finished performing updates. [ok]
Features Features (features) Module Enabled 83e0a6c
Testing Features Tests (features_test) Module Not installed 83e0a6c
The drush command 'fra' could not be found. Run `drush cache-clear drush` to clear the commandfile cache if