Drupal 9 is now end of life and unsupported. If you're stuck on Drupal 7, 8 or 9, get unstuck with a Drupal upgrade roadmap and upgrade to Drupal 10.

PHPUnit does more than unit testing

As the name suggests, PHPUnit is a unit testing framework for PHP.

It’s the defacto PHP testing framework used by the major PHP projects, such as Drupal, Symfony, Laravel.

But unit testing isn’t all that PHPUnit can do.

These frameworks extend PHPUnit to give it more functionality.

Drupal allows you to run functional/browser tests to make requests to pages, check the response codes and content, as well as integration/kernel tests to test real services instead of relying on mocking within unit tests.

Symfony does the same with its web and kernel test cases.

Here’s the thing

If you use a framework and want to more than unit testing, intsead of including another testing framework, try using some of the PHPUnit extensions that are provided by the framework.

    Was this useful? Sign up here and get more like this delivered straight to your inbox every day.