When:
to to -
Room:
Room 325
Track:
SVG
development & coding

Drupal Unit testing has never been easier, with Test Helpers!

Drupal Unit testing has never been easier, with Test Helpers!

Problem: “Unit testing takes time”, “Unit testing is difficult”, “Unit testing requires high skills”, “Let’s release the feature already and postpone unit tests”.

Does your organization, your team or even yourself recognize any of the above? If the answer is yes, then this session is for you.

Unit testing your code is a practice every project should have! But they are hard to write, especially for Drupal with its services and entities, therefore very often writing a unit test takes much more time and produces a lot more code than the tested function itself!

And you need a lot of skills and time, good knowledge of all the services you need to mock, initialize, inject… The way they interact with each other for something as simple as loading a Drupal node.

Fear no more! That was before the “Test Helpers” contrib module.

"Test Helpers" allows you to significantly reduce your time and the amount of code when writing unit tests!

You can easily get a working stub of an Entity together with EntityType, EntityStorage, save(), delete(), load(), loadMultiple(), loadByUuid(), loadByProperties() and other related functions, just via a single line of code!

Join me in this session, so you can master the no-longer dark art of writing unit tests.  Be a hero and save your team, client, and organization from the unexpected headaches of untested releases! 😉

Learning Objectives

• Apply Test Helpers API to make unit tests more compact and easy to understand.
• Perform getting a working stub of a fieldable Entity and EntityStorage via a single line of code.
• Easily assert crucial conditions in EntityQuery and Database Query calls via a helper comparison function.

Prerequisites

Will be good to be a little familiar with unit testing base concepts.

Synopsis

Drupal Unit testing is difficult, takes a lot of time, efforts and high skills - that’s the true reality. But things are changing! Feel relieved and productive when writing unit tests with “Test Helpers” API!