Refactoring Drupal batch API callbacks to increase testability
Drupal's Batch API is great, it allows you to easily perform long running processes with feedback to the user.
But during Drupal 8's development processes it was one of the remaining systems that didn't get the full object oriented, service-based architecture.
Much of the batch API is largely unchanged from Drupal 7.
But that doesn't mean you can't write unit-testable callbacks.
Let's get started.