1.3 KiB
date | title | permalink |
---|---|---|
2025-05-12 | Writing tests for Tome | /daily/2025/05/12/writing-tests-tome |
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.