uuid: - value: 1579b5cf-889e-4a7b-98a7-59918359def9 langcode: - value: en type: - target_id: daily_email target_type: node_type target_uuid: 8bde1f2f-eef9-4f2d-ae9c-96921f8193d7 revision_timestamp: - value: '2025-05-13T22:58:55+00:00' revision_uid: - target_type: user target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849 revision_log: { } status: - value: true uid: - target_type: user target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849 title: - value: 'Writing tests for Tome' created: - value: '2025-05-12T22:48:21+00:00' changed: - value: '2025-05-13T22:58:55+00:00' promote: - value: false sticky: - value: false default_langcode: - value: true revision_translation_affected: - value: true path: - alias: /daily/2025/05/12/writing-tests-tome langcode: en body: - value: '
I have recently migrated my daily email archive to Drupal and Tome.
The result is the same - a static website that I can upload onto my server, but it''s created with Drupal 11 locally and exported to a static website.
Similar to being able to extend Sculpin with PHP, I get the same benefit with Tome.
I can write the same PHP code and custom Drupal modules as I would with a non-Tome Drupal website.
To count the number of sent daily emails, I created a opd_daily_emails
module with a token that generates the number of emails, and displays it on the page.
I can also write the same automated tests.
I have a functional test that confirms the token result is generated and rendered correctly using TokenTestTrait
- supported by some kernel tests and a custom DailyEmailTestTrait
that makes it easier to create daily email nodes within the tests.
I have all the power and flexibility of Drupal locally and the benefits of a static site when it''s deployed.
P.S. If you want to learn how to write automated tests in Drupal, subscribe to my free 10-day email course.
' format: basic_html processed: 'I have recently migrated my daily email archive to Drupal and Tome.
The result is the same - a static website that I can upload onto my server, but it''s created with Drupal 11 locally and exported to a static website.
Similar to being able to extend Sculpin with PHP, I get the same benefit with Tome.
I can write the same PHP code and custom Drupal modules as I would with a non-Tome Drupal website.
To count the number of sent daily emails, I created a opd_daily_emails
module with a token that generates the number of emails, and displays it on the page.
I can also write the same automated tests.
I have a functional test that confirms the token result is generated and rendered correctly using TokenTestTrait
- supported by some kernel tests and a custom DailyEmailTestTrait
that makes it easier to create daily email nodes within the tests.
I have all the power and flexibility of Drupal locally and the benefits of a static site when it''s deployed.
P.S. If you want to learn how to write automated tests in Drupal, subscribe to my free 10-day email course.
' summary: '' field_daily_email_cta: { }