Skip to content

Instantly share code, notes, and snippets.

View eliza411's full-sized avatar

Melissa Anderson eliza411

View GitHub Profile
@eliza411
eliza411 / gist:67d2aa93cfa9a31b65ad
Created December 6, 2014 17:40
Behat step for Drupal batch-api support
<?php
/**
* @Given /^I follow meta refresh$/
*/
public function iFollowMetaRefresh() {
while ($refresh = $this->getMainContext()->getSession()->getPage()->find('css', 'meta[http-equiv="Refresh"]')) {
$content = $refresh->getAttribute('content');
$url = str_replace('0; URL=', '', $content);
$this->getMainContext()->getSession()->visit($url);
}
@eliza411
eliza411 / pr-template
Created November 19, 2014 12:04
PR Template
Ticket: ... Ticket Link
* [x] Ready for review
* [ ] Ready for merge
... description
### Notes
... Notes-optional
@eliza411
eliza411 / gist:6487322
Created September 8, 2013 18:42
Test that a valid image is actually being loaded.
public function checkForImage($url) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
// get the content type
$mime_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
if (strpos($mime_type, 'image/') === FALSE) {
throw new Exception (sprintf('%s did not return an image', $url));
default:
paths:
features: 'features'
extensions:
Behat\MinkExtension\Extension:
goutte: ~
selenium2:
port: 4445
base_url: http://example.com
show_cmd: firefox %s
@eliza411
eliza411 / gist:6295203
Created August 21, 2013 14:29
Enter text in a Drupal TinyMCE WYSIWYG field
/**
* Enter text in textareas - this does not text the wysiwg functionality
*
* @When /^I enter "([^"]*)" in the "([^"]*)" text field$/
*/
public function iEnterInTheEditor($text, $field) {
$page = $this->getMainContext()->getSession()->getPage();
// Define selectors because the body field is handled differently
use Behat\MinkExtension\Context\MinkContext;
//
// Require 3rd-party libraries here:
//
// require_once 'PHPUnit/Autoload.php';
// require_once 'PHPUnit/Framework/Assert/Functions.php';
//
/**
default:
paths:
features: 'features'
extensions:
Behat\MinkExtension\Extension:
goutte: ~
selenium2: ~
base_url: http://drupal.l
show_cmd: firefox %s
Drupal\DrupalExtension\Extension:
@eliza411
eliza411 / gist:5790114
Created June 16, 2013 00:01
Step definition for TinyMCE
/**
* Use for wysiwyg fields.
*
* @When /^I enter "([^"]*)" in the "([^"]*)" text field$/
*/
public function iEnterInTheEditor($text, $field) {
$page = $this->getSession()->getPage();
if ($field == 'Body' ) {
$iframe_selector = '#edit-body-und-0-value_ifr';
PASSING - 100% PASSING
@about
@support
NO TAGS - ASK TATIANA ABOUT THE FATE OF THESE
@about_do
@learn_drupal
@login
IN PROCESS - ISSUES ARE OPEN