Add Drupal Test Traits ADR

This commit is contained in:
Oliver Davies 2025-06-10 22:12:33 +01:00
parent 7f7d551312
commit 77149e1dff

View file

@ -0,0 +1,25 @@
Use Drupal Test Traits
Date: 2025-06-10
Status: accepted
Context:
Drupal Test Traits is a module that provides a number of traits to make it easier to write automated tests for an existing website.
Decision:
Adopt Drupal Test Traits for any custom module tests that won't be contributed back to Drupal.org - e.g. the opd_presentations module.
Consequences:
Using Drupal Test Traits will make it simpler to write tests without needing to create test-specific modules that only create configuration like content types and fields.
In some cases, I will need to change the approach for a test.
For example, I can't create a single presentation node in a test and assert there is only one presentation as there will be existing presentations in the database.
Also, because Tome automatically exports content to JSON files, it will export any content created within the tests.
I'll need to reset the files within the `content` directory and run `drush tome:import` to reset the database with the required content.