diff --git a/config/sync/core.extension.yml b/config/sync/core.extension.yml index 2d1d0235f..c779e8893 100644 --- a/config/sync/core.extension.yml +++ b/config/sync/core.extension.yml @@ -47,6 +47,7 @@ module: metatag_twitter_cards: 0 node: 0 opd_daily_emails: 0 + opd_presentations: 0 options: 0 page_cache: 0 path: 0 diff --git a/content/meta/index.json b/content/meta/index.json index a41ad4893..bd62f9315 100644 --- a/content/meta/index.json +++ b/content/meta/index.json @@ -3440,6 +3440,9 @@ "node.1579b5cf-889e-4a7b-98a7-59918359def9": [ "user.b8966985-d4b2-42a7-a319-2e94ccfbb849" ], + "node.45636e82-61b1-4298-a28c-34f139b9a559": [ + "user.b8966985-d4b2-42a7-a319-2e94ccfbb849" + ], "path_alias.62494a5c-320b-4aa8-8d42-b1727a8d3b1d": [ "node.63032bf4-8a96-4e14-93b2-92f5b057184e" ], @@ -6296,6 +6299,9 @@ "path_alias.987be1d9-1ccd-4a4e-898e-207172cd39a0": [ "node.1579b5cf-889e-4a7b-98a7-59918359def9" ], + "path_alias.6f154ca6-12e7-47fc-893e-a5c094487f21": [ + "node.45636e82-61b1-4298-a28c-34f139b9a559" + ], "shortcut.8cd79370-99a8-45fc-89a8-639ffc00bd1c": [], "shortcut.fd457304-bed3-4d38-926b-e190a05c37d3": [], "shortcut.0cabd243-2f9c-48ac-b0d9-f536d1cf1eaa": [], diff --git a/content/node.45636e82-61b1-4298-a28c-34f139b9a559.json b/content/node.45636e82-61b1-4298-a28c-34f139b9a559.json new file mode 100644 index 000000000..9a3f8c050 --- /dev/null +++ b/content/node.45636e82-61b1-4298-a28c-34f139b9a559.json @@ -0,0 +1,92 @@ +{ + "uuid": [ + { + "value": "45636e82-61b1-4298-a28c-34f139b9a559" + } + ], + "langcode": [ + { + "value": "en" + } + ], + "type": [ + { + "target_id": "daily_email", + "target_type": "node_type", + "target_uuid": "8bde1f2f-eef9-4f2d-ae9c-96921f8193d7" + } + ], + "revision_timestamp": [ + { + "value": "2025-05-14T01:19:06+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 your own test traits" + } + ], + "created": [ + { + "value": "2025-05-13T01:08:34+00:00" + } + ], + "changed": [ + { + "value": "2025-05-14T01:19:06+00:00" + } + ], + "promote": [ + { + "value": false + } + ], + "sticky": [ + { + "value": false + } + ], + "default_langcode": [ + { + "value": true + } + ], + "revision_translation_affected": [ + { + "value": true + } + ], + "path": [ + { + "alias": "\/daily\/2025\/05\/13\/writing-your-own-test-traits", + "langcode": "en" + } + ], + "body": [ + { + "value": "

In Drupal, there are different types of automated tests we can write.<\/p>

The most common I use are Functional, Kernel and Unit - which I explain about in my Test Driven Drupal talk<\/a>.<\/p>

If I'm writing multiple of the same type, I'll often create my own base test class that extends BrowserTestCase<\/code>, KernelTestCase<\/code> or whatever base class I need rather than extending it directly.<\/p>

This allows me to write custom helper functions and share behaviour between the tests.<\/p>

An example is the createDailyEmailNode<\/code> method I wrote to simplify creating daily emails in my tests since migrating to Tome<\/a>.<\/p>

But, what if you want to do this for different types of test?<\/p>

Enter, traits.<\/p>

Traits are a way of reusing code without inheritance - meaning without extending a base class.<\/p>

I can use a trait in my functional and kernel tests whilst both extend their required base classes.<\/p>

I did this with my createDailyEmailNode<\/code> method so I could re-use it in both types of tests when counting the number of sent daily emails.<\/p>

To see this, you can look at the code<\/a> on my Forgejo instance.<\/p>

P.S. If you want to learn how to write automated tests in Drupal, subscribe to my free 10-day email course<\/a>.<\/p>", + "format": "basic_html", + "processed": "

In Drupal, there are different types of automated tests we can write.<\/p>

The most common I use are Functional, Kernel and Unit - which I explain about in my Test Driven Drupal talk<\/a>.<\/p>

If I'm writing multiple of the same type, I'll often create my own base test class that extends BrowserTestCase<\/code>, KernelTestCase<\/code> or whatever base class I need rather than extending it directly.<\/p>

This allows me to write custom helper functions and share behaviour between the tests.<\/p>

An example is the createDailyEmailNode<\/code> method I wrote to simplify creating daily emails in my tests since migrating to Tome<\/a>.<\/p>

But, what if you want to do this for different types of test?<\/p>

Enter, traits.<\/p>

Traits are a way of reusing code without inheritance - meaning without extending a base class.<\/p>

I can use a trait in my functional and kernel tests whilst both extend their required base classes.<\/p>

I did this with my createDailyEmailNode<\/code> method so I could re-use it in both types of tests when counting the number of sent daily emails.<\/p>

To see this, you can look at the code<\/a> on my Forgejo instance.<\/p>

P.S. If you want to learn how to write automated tests in Drupal, subscribe to my free 10-day email course<\/a>.<\/p>", + "summary": "" + } + ], + "feeds_item": [] +} \ No newline at end of file diff --git a/content/path_alias.6f154ca6-12e7-47fc-893e-a5c094487f21.json b/content/path_alias.6f154ca6-12e7-47fc-893e-a5c094487f21.json new file mode 100644 index 000000000..3e7084999 --- /dev/null +++ b/content/path_alias.6f154ca6-12e7-47fc-893e-a5c094487f21.json @@ -0,0 +1,27 @@ +{ + "uuid": [ + { + "value": "6f154ca6-12e7-47fc-893e-a5c094487f21" + } + ], + "langcode": [ + { + "value": "en" + } + ], + "path": [ + { + "value": "\/node\/45636e82-61b1-4298-a28c-34f139b9a559" + } + ], + "alias": [ + { + "value": "\/daily\/2025\/05\/13\/writing-your-own-test-traits" + } + ], + "status": [ + { + "value": true + } + ] +} \ No newline at end of file diff --git a/content/user.b8966985-d4b2-42a7-a319-2e94ccfbb849.json b/content/user.b8966985-d4b2-42a7-a319-2e94ccfbb849.json index fde8e8a0b..37a4dca11 100644 --- a/content/user.b8966985-d4b2-42a7-a319-2e94ccfbb849.json +++ b/content/user.b8966985-d4b2-42a7-a319-2e94ccfbb849.json @@ -52,7 +52,7 @@ ], "access": [ { - "value": "2025-05-13T23:01:56+00:00" + "value": "2025-05-14T01:16:53+00:00" } ], "login": [