Principles of Solitary Unit Testing

The proliferation of testing strategies outside of a broadly agreed set of definitions has not only caused confusion but has caused a waste of effort by choosing the wrong strategy for the goals to accomplish. Learning the principles of solitary unit testing will enable you to make better decisions about the testing strategies you use and save you time.

In this session, we will look at one strategy: solitary unit testing. We will start by defining solitary unit testing and show how it distinguishes itself from other strategies.

The majority of our time will be spent looking at principles of solitary unit testing using PHPUnit code examples to show how to follow these principles. This will help solidify our understanding of this strategy and allow us to look at how to write mocks and fixtures and at how to identify several test smells.

We will conclude by identifying motivations for this testing strategy and what this strategy can and cannot help you accomplish.

This session might be for you if you are unsure when to use mocks and fixtures, if your unit test suite is slow and you don’t know why, if you’re doing TDD and having trouble distinguishing between unit and integration testing, or if you simply want to know more about unit testing.

The key takeaway from this session will be a thorough understanding of solitary unit testing to help you start or improve your testing process.

Session Track


Experience level


Drupal Version

Drupal 9.x

Session Time Slot(s)

09/23/2015 - 14:15-09/23/2015 - 15:15