Unit tests in Drupal: The road to test-driven development
Test-driven development requires short development cycles in which we write tests describing our software and then write the code that will make the tests pass.
Short develoment cycles require fast tests, and unit tests are the fastest in our arsenal.
Unit tests in Drupal might seem like an impossibility, given that most of our code lives inside the world that Drupal has constructed for us (Hooks/Events, Entities, Plugins, etc).
With unit tests alone, we have managed to maintain ~100% test coverage in our complex Drupal 8 systems, and would like to share how we accomplished this with you.
Learning Objectives
At the end of this session, attendees will:
- Understand different techniques to make their code more unit testable
- Be able to effectively implement true unit tests in Drupal
- Know of tools that can help them write unit tests
Target Audience
Anyone interested in unit tests.
Prerequisites
Some familiarity with phpunit, sevices, and dependency injection in Drupal 8 can be helpful.
Track
Experience Level
When & Where
If no timezone is set on your profile, time is displayed in UTC.
Update your profile's timezone