Open source developer, working with Drupal and building Drupal Commerce.

GitHub Actions has made continuous integration seamless. Not because it is a superior product — I am by and far a huge fan of CircleCI — but because of its ease in integration. TravisCI was a huge breakthrough in continuous integration for open source projects. Instead of running a private Jenkins server, you could connect your GitHub repo to TravisCI and start building on each commit. However, both TravisCI, CircleCI, and other continuous integration tools require a multi-step setup. GitHub Actions (for better or worse) bypasses this.

Normally you need to commit your pipeline configuration files — .travis.yml, .circleci/config.yaml, etc. – and then go to that service and turn on builds. Or, vice versa and the service would say, "Great, waiting for that new commit which has your pipeline definition!" …


Road

Five years and two months ago, I joined Commerce Guys, which was primarily focused on building Platform.sh. Not long after joining, Ryan, Bojan, and I spun Commerce Guys out of Platform.sh to refocus on Drupal Commerce. In that time, we created Drupal Commerce 2 for Drupal 8, grew from a scrappy team of three to a team of 16, rebranded the company to Centarro, and found new ways to grow the company and the open source project sustainably. After five incredible years of product and community development, I’m ready to start a new adventure.

This decision took a lot of soul-searching and contemplating. I like to think of it as taking a working sabbatical; I can’t exactly take a typical sabbatical as I am thirty-two, married, three kids (9, 5, 1 year old), have a mortgage, student debt, and medical debt. Plus-Plus to adulting, yeah? I want to take this time to run my own consulting practice to make a larger impact within my local community. …


I use DDEV-Local for my local development stack. DDEV leverages mkcert for trusted local development certificates. The mkcert tool has been a missing component in my local development stack for a long time. And, the best part, it has worked without any problems. Until this week. My coworker said that a script I wrote was not working — it kept failing saying that the remote certificate could not be validated. However, cURL had no complaints, nor did any web browser. I chalked it up as “works on my machine 🤷‍♂️.” Until today 😬.

I was working on the follow up to my blog about using ReactPHP to consume an HTTP API. I was taking the resulting data and creating entities on a Drupal site. I point the react/http client to https://drupex.ddev.site... and got an unexpected error. …


This is the first of two blogs detailing how to build a middleware leveraging ReactPHP to consume data from an API, normalize it, and then push that data into Drupal through JSON:API. In this example will be grabbing data from the PokéAPI. In the second blog post, we will take the data and create Pokémon nodes on a Drupal site.

The purpose of the middleware is to avoid putting this logic into the Drupal codebase. Drupal has an amazingly robust Migration API for consuming data and processing data to create content. Every Drupal site I have ever worked on — since Drupal 8’s beta days — has used the migration system to import content through CSVs or JSON from remote APIs. However. That means you have to be a Drupal developer to understand it, or go through the learning curve if you are not. A generic middleware means that any team can control and maintain the code. …


The other week, I was asked about how I maintain my PHPUnit config file for my Drupal projects. When running Drupal’s PHPUnit test suites, you typically copy and modify the distribution phpunit.xml.dist file which lives in the web/core subdirectory. There is just one problem. This directory is technically a vendor directory and is replaced during any updates to the drupal/core dependency of your Drupal project. Every minor version will cause your file to reset, or anytime you install dependencies if Drupal core is patched.

One thing I noticed is that since I first followed your tuts a while back, my phpunit.xml is gone. I’m guessing it gets overwritten when core is updated. Do you just keep a copy of the file and paste it in when that happens? …


Drupal has four PHPUnit test suites: Unit, Kernel, Functional, and FunctionalJavascript. Each test suite offers various levels of integration with the Drupal code base.

  • Unit tests are stateless
  • Kernel tests allow for minimal Drupal bootstrapping for stateful testing with the database
  • Functional tests perform a full Drupal installation and allow interacting with Drupal through a mocked browser
  • FunctionalJavascript tests perform a full Drupal installation and allow interacting with Drupal through WebDriver.

There are tradeoffs between each test suite. Unit tests require mocking of a lot of classes in exchange for speed and not needing a database connection. Kernel tests allow you to construct a minimal Drupal environment that allows interacting with the database. Functional tests allow for interacting with the actual site and testing as a user. …


This past Sunday I did a livestream where I tried out the new issue forks functionality on Drupal.org. The feature is currently beta and project maintainers need to opt-in for the functionality. At the moment you can create a repository fork for an issue, create a work branch, and commit to that branch. You will need to manually create a patch to be uploaded, as Merge Requests with Drupal.org issues are still being worked on (the Drupal Association Infrastructure team is hoping to have this available for DrupalCon Global!)

When you view an issue that supports issue forks, there will be a new block in the sidebar. This allows you to create an issue fork or view information about the existing fork and its branches. …


On Sunday I did my first live stream where I upgraded my personal site to Drupal 9. It was a fun experience and I learned a few things — both for streaming and upgrading.

I managed to deploy a broken version of my site because I blindly trusted Composer metadata would prevent incompatible modules from allowing Drupal 9 to install. I was wrong. I forgot to use the Upgrade Status module to check if all of my contrib modules were compatible. I forgot to test the deploy and upgrade locally. 🤦‍♂️ Oops. Everything is fine, now. …


I use the Content Moderation module on my personal site to managed my publication workflow. One of my pet peeves if when I accidentally forget to adjust a blog post’s creation timestamp once published. Sometimes it is only a few hours old, sometimes it is a week. I finally sat down to fix this small annoyance. Only to find out fixing it wasn’t as simple as I would have thought.

I am fairly used to working with the State Machine module, as it is a backbone in Drupal Commerce for order workflows. We have Workflows, States, and Transitions in State Machine, along with a field type. Whenever a state field changes, it must fit into an available transition. …


I write a lot of tests for all of my Drupal code. I try to live by Test Driven Development. It delivers cleaner code. It helps define your architecture without full implementation details. I also despise clicking and manually testing things.

However, testing in Drupal is still somewhat painful. Time. Since so many things require the database tests can get slow. Even the Kernel test suite which uses a most minimally bootstrapped environment.

Because of this, I’m a huge fan of using mocked objects. If you’re not familiar with mocking in tests, check out the Drupal.org documentation for using Prophecy and the PHPUnit documentation. …

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store