Skip to content

Instantly share code, notes, and snippets.

View mglaman's full-sized avatar

Matt Glaman mglaman

View GitHub Profile
$ ./scripts/deploy.sh
SUDO password:
PLAY [all] *********************************************************************
TASK [setup] *******************************************************************
ok: [162.243.207.46]
TASK [Define config_dir.] ******************************************************
skipping: [162.243.207.46]
testbot@drupalci:~$ cd testrunner/
testbot@drupalci:~/testrunner$ ./drupalci run build.jenkins-drupal_contrib-12490.yml
Executing build with build ID: local_c0829e9556640dd1e30512e593d2288f
Directory created at /var/lib/drupalci/workspace/local_c0829e9556640dd1e30512e593d2288f
Directory created at /var/lib/drupalci/workspace/local_c0829e9556640dd1e30512e593d2288f/artifacts
Directory created at /var/lib/drupalci/workspace/local_c0829e9556640dd1e30512e593d2288f/database
Directory created at /var/lib/drupalci/workspace/local_c0829e9556640dd1e30512e593d2288f/artifacts/xml
Directory created at /var/lib/drupalci/workspace/local_c0829e9556640dd1e30512e593d2288f/ancillary
Using build definition template: build.jenkins-drupal_contrib-12490.yml</options>
---------------- Starting codebase ----------------
build:
codebase:
assemble_codebase:
replicate:
exclude: { }
local_dir: ''
git_branch: ''
git_commit_hash: ''
checkout_core:
repositories:
@mglaman
mglaman / AjaxActionLogin.php
Created January 31, 2017 03:17
Flag action link plugin which returns login link.
<?php
namespace Drupal\forkdin_core\Plugin\ActionLink;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Url;
use Drupal\flag\FlagInterface;
use Drupal\flag\Plugin\ActionLink\AJAXactionLink;
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8; format=flowed; delsp=yes
Date: Tue, 22 Nov 2016 04:18:45 +0000
From: [email protected]
MIME-Version: 1.0
Message-ID: <[email protected]>
Received: from [127.0.0.1] by mailhog.example (MailHog)
id [email protected]; Tue, 22 Nov 2016 04:18:45 +0000
Return-Path: <[email protected]>,<[email protected]>
Sender: [email protected]
<?php
public function postSave(EntityStorageInterface $storage, $update = TRUE) {
$rating = $this->get('rating')->first()->value;
/** @var \Drupal\forkdin_restaurant\Entity\RestaurantMenuItem $menu_item */
$menu_item = $this->get('menu_item_id')->entity;
$vote = Vote::create([
'type' => 'rating',
'entity_type' => 'checkin',
'entity_id' => $menu_item->id(),
<?php
function address_test_bullshit() {
// Save a list of processed fields so that we can do clean up once the
// original data is migrated.
$processed_fields = [];
$columns_to_add = ['family_name', 'additional_name', 'given_name'];
$field_type_manager = \Drupal::getContainer()->get('plugin.manager.field.field_type');
$address_definition = $field_type_manager->getDefinition('address');
/** @var \Drupal\address\Plugin\Field\FieldType\AddressItem $class */
__has_parent_dir () {
# Utility function so we can test for things like .git/.hg without firing
# up a separate process
test -d "$1" && return 0;
current="."
while [ ! "$current" -ef "$current/.." ]; do
if [ -d "$current/$1" ]; then
return 0;
fi
@mglaman
mglaman / Drupal_Simpletest.xml
Created May 29, 2016 06:41
Drupal Simpletest runner. All options are in configuration scriptParameters
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Drupal Simpletest" type="PhpLocalRunConfigurationType" factoryName="PHP Console" singleton="true" path="$PROJECT_DIR$/www/core/scripts/run-tests.sh" scriptParameters="--url http://localhost:8080 --color --verbose --php /usr/bin/php --sqlite /tmp/.ht.sqlite commerce">
<CommandLine workingDirectory="$PROJECT_DIR$/www" />
<option name="workingDirectory" value="$PROJECT_DIR$/www" />
<method />
</configuration>
</component>
@mglaman
mglaman / Built_In.xml
Last active July 8, 2021 11:08
Configurations to run Drupal Commerce tests in PHPStorm. add to $PROJECT/.idea/runConfigurations. The compound "Commerce Test Runner" will launch PhanomJS, PHP's built in and then run Drupal Commerce's PHPUnit tests.
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Built-in" type="PhpBuiltInWebServerConfigurationType" factoryName="PHP Built-in Web Server" singleton="true" document_root="$PROJECT_DIR$/www" port="8080">
<method />
</configuration>
</component>