Write Your First PHPUnit Test

While automated testing offers a lot of benefits, helping to save time and cost, not everyone is familiar with the methods involved. But getting started with automated testing is easy. This session aims to provide beginners with a quick introduction to automated testing methods.

PHPUnit is great addition to Drupal 8 core, till Drupal 7 we were using SimpleTest testing framework. We will cover what all different types of test coverage that you can providing using PHPUnit. We will talk about the philosophy behind writing unit tests, what kind of coverage do they provide and what type of errors, issues, defects they help you catch.

 

What will we cover?

  1. Unit & automated tests

  2. Setup & installation

  3. Writing PHPUnit tests

  4. Different PHPUnit base classes. (eg. UnitTestCase, KernelTestBase, BrowserTestBase, JavascriptTestBase)

  5. Running PHPUnit tests

  6. Integrating tests with your CI

  7. Other ways to boost code acceptance & quality

What will you learn?

  1. Learn about PHPUnit

  2. Best practices & conventions for writing tests in Drupal 8 modules