Skip to main content

Test-Driven Drupal: The Book

I'm currently (in January 2022) working on this book again, and will update this page in due course.

For now, bookmark the book's page on LeanPub or take a look at the example application that I'm building on GitHub.

Having given talks and workshops, been a guest on podcasts and written articles about automated testing in Drupal, I’m currently in the planning phase of a book and potentially some accompanying screencasts about it, focussing on Drupal 8.

I’m still thinking about what use-cases to cover and examples to include, but here are some of the things I’m considering:

  • What things to test, and what not to test
  • The different types of available tests, and when to use each
  • How to write testable code
  • What happens when I run a test?
  • How to run tests in the Drupal UI
  • How to run tests with the script
  • How to install, configure and run tests with PHPUnit in Drupal 8
  • Viewing HTML from run tests
  • How to write your first test
  • Debugging tests
  • How to organise your test files
  • Selecting the right base class and using test traits
  • Writing your own base test classes, traits and assertions
  • Managing dependencies for your tests (fields, configuration)
  • Creating users, checking access with roles and permissions
  • Creating pages and blocks with Views and testing the output
  • Creating pages with routes and controllers and testing the output
  • Testing custom plugins
  • Testing queuing items and processing queues
  • Testing sending emails
  • Testing custom Twig filters and functions
  • Running tests as part of your continuous integration pipeline

I’ll most likely be publishing it via Leanpub, and will be sending free chapters, early-bird discounts and links to screencasts and blog posts as I write the book to subscribers of the mailing list.

If you have questions or would like to suggest something for me to include in the book, please contact me.

Enter your email address to subscribe to the Test-Driven Drupal mailing list and be notified of any updates.