How to write tests for Drupal 8

tim.plunkett

There are now two primary testing systems in Drupal 8: Simpletest and PHPUnit. Within those systems, there are Browser tests (formerly called Web tests), Functional tests, Kernel tests, and Unit tests.

This session will discuss each of these types of tests, and provide insight into which one to use in a given situation, which can be the hardest part of writing test coverage.

Additionally, within the realm of unit testing, we will delve into the different approaches of mocking, covering the different types of "test doubles", as well as the new Prophecy mocking system in PHPUnit.

Attendees should be familiar with object-oriented code, and ideally comfortable with a CLI in order to get the most out of the talk, but anyone who is interested in learning about tests is welcome!

Session Track

Coding and Development

Experience Level

Advanced

Drupal Version