Skip to content

Instantly share code, notes, and snippets.

View cosmicdreams's full-sized avatar

Chris Weber cosmicdreams

View GitHub Profile
@cosmicdreams
cosmicdreams / ddev-testing.md
Last active March 11, 2023 18:54
Instructions for adding DDEV into your project so you can run tests.

Install DDEV so you can run tests

Steps to get tests running

  1. Install all the things
  2. Fix PHP path mappings
  3. Configure phpunit

Prerequisites

Install Colima or keep using Docker Desktop

public function cleanData($value) {
return $value == ("." || "") ? "" : $value;
}
/**
* Inheritdoc.
*/
public function createUserMap($rowData, &$userMap) {
$userMap['name'] = $this->cleanData($rowData[0]);
$userMap['field_first_name'] = $this->cleanData($rowData[1]);
in the group
source:
plugin: url
data_fetcher_plugin: http
authentication:
plugin: basic
username: bla
password: bla
data_parser_plugin: json
<?php
/**
* @file
* Contains Drupal\Console\Command\FormTrait.
*/
namespace Drupal\sammy\Command;
use Drupal\Console\Style\DrupalStyle;
protected function query() {
// Get the default query and modify it
$query = parent::query();
$query->join('users_roles', 'ur', 'u.uid = ur.uid');
$query->condition('u.uid', "sammy");
return $query;
}
<!DOCTYPE html>
<html>
<head>
<!-- 1. Load platform.js for polyfill support. -->
<script src="bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
<!-- 2. Use an HTML Import to bring in the element. -->
<link rel="import" href="bower_components/iron-ajax/iron-ajax.html">
</head>
<body>
@cosmicdreams
cosmicdreams / setupd8
Last active August 29, 2015 14:14 — forked from timplunkett/setupd8
#!/bin/bash
# Drop the existing database, if any.
drush sql-drop -y;
# Remove the files from a previous install.
sudo rm -rf sites/default;
# Restore the directories and files that are included by Drupal.
sudo git checkout -- sites/default;
# Fix permissions and ownership problems caused by sudo.
@cosmicdreams
cosmicdreams / gist:4944247
Last active December 13, 2015 16:59
Here ya go Daniel
<?php
/**
* @file
* Definition of Drupal\system\Tests\Session\SessionSymfony2Test.
*/
namespace Drupal\system\Tests\Session;
use Drupal\simpletest\DrupalUnitTestBase;