This is the second part of a series of blog posts about automated testing for Drupal. Its mission is to take you from zero testing experience to confidence in testing your custom Drupal work, from the ground up. Last time, in Testing for the Brave and True: Part Zero we defined exactly what automated testing is and discussed some of the common vocabulary of testing. It also introduced the two primary tools used by the Drupal community to test their work, PHPUnit and Behat.
I recently migrated content from a Drupal 7 site to a new Drupal 8 install using core’s Migrate, Migrate Drupal and Migrate Drupal UI modules. A few months after the initial migration, I decided to enable core Content Moderation for use with one of my migrated content types. No beuno.
Just saving any content for which I had enabled Content Moderation resulted in this tasteless error:
When building an event management application recently, we ran into a number of time zone related issues. For example: two logged in users could see different times for the same event. Here's how we fixed it (and all the other annoying bugs we found along the way).
Creating comments programmatically in Drupal 8 is incredibly easy once you know just which fields are required and why. In Drupal 8, comments are now full-featured, fieldable entities — just like nodes or taxonomy terms. In addition to unifying the way we create content, comments, and other entities, this has made Drupal’s commenting system much more robust and flexible.