Add daily email

This commit is contained in:
Oliver Davies 2025-06-21 13:43:25 +01:00
parent 8c354f2754
commit b431389d4a
3 changed files with 131 additions and 0 deletions

View file

@ -6493,5 +6493,12 @@
],
"redirect.714cbf00-2159-46b5-893e-67dd5da6013a": [
"user.b8966985-d4b2-42a7-a319-2e94ccfbb849"
],
"node.20b8e2be-b5ec-404d-853e-55cf19327558": [
"user.b8966985-d4b2-42a7-a319-2e94ccfbb849",
"node.e3f6c728-7855-4804-8614-e2a0c08c368f"
],
"path_alias.31bdc608-36ae-4024-bfdd-afbe4ac5bbae": [
"node.20b8e2be-b5ec-404d-853e-55cf19327558"
]
}

View file

@ -0,0 +1,97 @@
{
"uuid": [
{
"value": "20b8e2be-b5ec-404d-853e-55cf19327558"
}
],
"langcode": [
{
"value": "en"
}
],
"type": [
{
"target_id": "daily_email",
"target_type": "node_type",
"target_uuid": "8bde1f2f-eef9-4f2d-ae9c-96921f8193d7"
}
],
"revision_timestamp": [
{
"value": "2025-06-21T12:44:54+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": "Exploring Drupal Test Traits"
}
],
"created": [
{
"value": "2025-06-18T12:36:14+00:00"
}
],
"changed": [
{
"value": "2025-06-21T12:44:54+00:00"
}
],
"promote": [
{
"value": false
}
],
"sticky": [
{
"value": false
}
],
"default_langcode": [
{
"value": true
}
],
"revision_translation_affected": [
{
"value": true
}
],
"path": [
{
"alias": "\/daily\/2025\/06\/18\/exploring-drupal-test-traits",
"langcode": "en"
}
],
"body": [
{
"value": "I've [given talks and workshops][3] on automated testing in Drupal.\r\n\r\nI created [a free 10-day email course][2].\r\n\r\nSomething I haven't used until recently is [Drupal Test Traits][4].\r\n\r\nThe built-in PHPUnit tests create a new installation of Drupal for each test, setting up everything from scratch and installing the specified modules and configuration for each test.\r\n\r\nThe tests don't know about the site they're running on, which is what allows them to run in Drupal CI or on any Developer's computer.\r\n\r\nEach test is responsible for creating its own environment.\r\n\r\nThis is part of the \"arrange\" step of writing an automated test - creating the situation for the test to run, such as installing configuration and creating content, before performing actions and making assertions.\r\n\r\nBut, what if you want to test an existing website?\r\n\r\nDrupal Test Traits provides an `ExistingSiteBase` class and a number of traits that allow for testing an existing Drupal website and simplifies the setup process.\r\n\r\nYou can see this in [my PresentationTest class][0] - there's no setup like recreating content type and field configuration as it knows about the \"real\" site I'm working on.\r\n\r\nSome tests like [my PresentationCounterTest][1] I've had to write differently to count for the existing content, but still work.\r\n\r\nI'm going to continue trying out Drupal Test Traits and, if it continues to go well, include it in my future talks and workshops.\r\n\r\n[0]: https:\/\/code.oliverdavies.uk\/opdavies\/oliverdavies.uk\/src\/commit\/b8c3f6d9a761f126616f0be12d3c35dffef41bbe\/modules\/opd_presentations\/tests\/src\/Functional\/PresentationTest.php\r\n[1]: https:\/\/code.oliverdavies.uk\/opdavies\/oliverdavies.uk\/src\/commit\/b8c3f6d9a761f126616f0be12d3c35dffef41bbe\/modules\/opd_presentations\/tests\/src\/Functional\/PresentationCounterTest.php\r\n[2]: \/atdc\r\n[3]: \/presentations\/tdd-test-driven-drupal\r\n[4]: https:\/\/www.drupal.org\/project\/dtt",
"format": "markdown",
"processed": "<p>I've <a href=\"http:\/\/localhost:8888\/presentations\/tdd-test-driven-drupal\">given talks and workshops<\/a> on automated testing in Drupal.<\/p>\n<p>I created <a href=\"http:\/\/localhost:8888\/atdc\">a free 10-day email course<\/a>.<\/p>\n<p>Something I haven't used until recently is <a href=\"https:\/\/www.drupal.org\/project\/dtt\">Drupal Test Traits<\/a>.<\/p>\n<p>The built-in PHPUnit tests create a new installation of Drupal for each test, setting up everything from scratch and installing the specified modules and configuration for each test.<\/p>\n<p>The tests don't know about the site they're running on, which is what allows them to run in Drupal CI or on any Developer's computer.<\/p>\n<p>Each test is responsible for creating its own environment.<\/p>\n<p>This is part of the \"arrange\" step of writing an automated test - creating the situation for the test to run, such as installing configuration and creating content, before performing actions and making assertions.<\/p>\n<p>But, what if you want to test an existing website?<\/p>\n<p>Drupal Test Traits provides an <code>ExistingSiteBase<\/code> class and a number of traits that allow for testing an existing Drupal website and simplifies the setup process.<\/p>\n<p>You can see this in <a href=\"https:\/\/code.oliverdavies.uk\/opdavies\/oliverdavies.uk\/src\/commit\/b8c3f6d9a761f126616f0be12d3c35dffef41bbe\/modules\/opd_presentations\/tests\/src\/Functional\/PresentationTest.php\">my PresentationTest class<\/a> - there's no setup like recreating content type and field configuration as it knows about the \"real\" site I'm working on.<\/p>\n<p>Some tests like <a href=\"https:\/\/code.oliverdavies.uk\/opdavies\/oliverdavies.uk\/src\/commit\/b8c3f6d9a761f126616f0be12d3c35dffef41bbe\/modules\/opd_presentations\/tests\/src\/Functional\/PresentationCounterTest.php\">my PresentationCounterTest<\/a> I've had to write differently to count for the existing content, but still work.<\/p>\n<p>I'm going to continue trying out Drupal Test Traits and, if it continues to go well, include it in my future talks and workshops.<\/p>\n",
"summary": ""
}
],
"field_daily_email_cta": [
{
"target_type": "node",
"target_uuid": "e3f6c728-7855-4804-8614-e2a0c08c368f"
}
]
}

View file

@ -0,0 +1,27 @@
{
"uuid": [
{
"value": "31bdc608-36ae-4024-bfdd-afbe4ac5bbae"
}
],
"langcode": [
{
"value": "en"
}
],
"path": [
{
"value": "\/node\/20b8e2be-b5ec-404d-853e-55cf19327558"
}
],
"alias": [
{
"value": "\/daily\/2025\/06\/18\/exploring-drupal-test-traits"
}
],
"status": [
{
"value": true
}
]
}