From 77149e1dff3931a8fa4aee47aa0dae4bd571eb8d Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 10 Jun 2025 22:12:33 +0100 Subject: [PATCH] Add Drupal Test Traits ADR --- .../003-drupal-test-traits.txt | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 docs/architecture-decisions/003-drupal-test-traits.txt diff --git a/docs/architecture-decisions/003-drupal-test-traits.txt b/docs/architecture-decisions/003-drupal-test-traits.txt new file mode 100644 index 000000000..f28c2d2a1 --- /dev/null +++ b/docs/architecture-decisions/003-drupal-test-traits.txt @@ -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.