Testing methodologies in Drupal 9
Drupal's PHP tests are all run by PHPUnit, which covers more testing methodologies than just those mentioned earlier. So, let's see what these are.
Drupal 9 comes with the following types of PHP-level testing:
- Unit: Low-level class testing with minimal dependencies (usually mocked)
- Kernel: Functional testing with the kernel bootstrapped, access to the database, and only a few loaded modules
- Functional: Functional testing with a bootstrapped Drupal instance, a few installed modules, and using a Mink-based browser emulator (Goutte driver)
- Functional JavaScript: Functional testing using the Selenium driver for Mink, allowing the testing of JavaScript-powered functionality
As mentioned, all of these test suites are built on top of PHPUnit and are, consequently, run by it. Based on the namespace the test classes reside in, as well as the directory placement, Drupal can discover these tests and know what type they...