drupal

Published on Thursday 18, October 2018

Running Drupal's Nightwatch test suite on DDEV

This is the third, and final post in my series on running Drupal’s various test suites using the DDEV local development stack. Previously I covered running Drupal’s Unit, Kernel, and Functional tests and then running Chromedriver to execute the FunctionalJavascript test suite. In this post, I will talk about running the newly introduced Nightwatch.js test framework.

Published on Tuesday 16, October 2018

Running Drupal's FunctionalJavascript tests on DDEV

This is part two of a series on running Drupal’s testing suites on DDEV. We left off last time with trying to execute a FunctionalJavscript test and having every test case skipped because no browser emulator was available. In this post, we will run through getting set up to execute Drupal’s FunctionalJavascript tests inside of your DDEV web container.

Published on Friday 12, October 2018

Running Drupal's PHPUnit test suites on DDEV

DDEV is a local development stack built on top of Docker. It gives you all of your environment needs without messy configured on your host machine, without needing to know Docker or configure your own containers. Which is great, and makes life easier. Instead of just using DDEV to develop your site or application locally, why not also run your tests within it?

OK PhpStorm, what methods does my entity have? Wednesday 10, October 2018 mglaman

Working in object-oriented programming is great. You can define interfaces which specify a contract that implementers need to fulfill. You can then extend these to define your end requirement and provide the implementation. This also means you can guarantee an object that implements that interface will have a guaranteed set of known methods. In Drupal, all entities implement EntityInterface, this is how we know that an entity can return its identifier, label, language, and other common methods.

Published on Saturday 6, October 2018

Test driven development in PhpStorm with auto-testing enabled

When I work, I try to follow the principles of Test-Driven Development. I have found it to aid me in writing cleaner code, identifying odd coupling of components or crazy accidental dependencies between components. It also lets me write my API first by using mocks against interfaces I have defined. PhpStorm's auto-test functionality speeds up my test-driven development process.
Tracking changes in Migrate with dynamic row hashes Thursday 27, September 2018 mglaman

When it comes to Drupal and external data, I use Migrate. A lot. Like a lot, lot, lot. Many times this data is being imported over CSV files that are pushed to a server at some defined interval. Usually, the data can be derived directly from the CSV file itself, other times a custom process plugin derives data from other information. Drupal's Migrate system has two steps to check if new data should be imported or skipped. First, you can tell the migration source to track changes for each row. Then, if you are tracking changes, it hashes each row of data to see if it has been changed.

Xdebug over the command line with DDEV Monday 24, September 2018 mglaman

I moved over to DDEV for my local development stack back in February. One of my favorite things is the ease of using Xdebug. You can configure Xdebug to always be enabled, or turn it on and off as needed (my preferred method.) When you have Xdebug enabled, it also enables it for any PHP scripts executed over the command line. That means you can debug your Drush or Drupal Console scripts like a breeze!

This article is based on using Xdebug within PhpStorm, as it is my primary IDE.

Using multiple Solr cores with DDEV Friday 21, September 2018 mglaman

If you want to have multiple Solr indexes using Search API, you need to have a core for each index instance. For my local development stack, I use DDEV. The documentation has a basic example for setting up a Solr service, but I had quite the fun time figuring out how to ensure multiple cores.

Drupal 7, 8, and 9: deprecate the old to intake the new Monday 17, September 2018 mglaman

At Drupal Europe, Dries announced the release cycle and end of life for Drupal's current and next version. Spoiler alert: I am beyond excited, but I wish the timeline could be expedited. More on that to follow.

Here is a quick breakdown:

Filtering out invalid entity references in Drupal 8 Friday 6, July 2018 mglaman
Today I was working on a custom Drupal 8 form where I needed an option to purge existing entities and their references on a parent entity before running an import. It seemed pretty straightforward until I saw "ghost" values persisting on the parent entity's inline entity form. Here's my journey down the rabbit hole to fix broken entity reference values.