Add daily email
This commit is contained in:
parent
b9a375ecc2
commit
431545bfc4
3 changed files with 131 additions and 0 deletions
|
@ -6521,5 +6521,12 @@
|
|||
],
|
||||
"path_alias.7bddd793-15e1-460a-903e-a1d1df57a0d1": [
|
||||
"node.2743d645-0679-4862-91b6-1f77f218a5fd"
|
||||
],
|
||||
"node.c337a375-7fec-45d9-ad89-60ece71c2194": [
|
||||
"user.b8966985-d4b2-42a7-a319-2e94ccfbb849",
|
||||
"node.3074e1e9-c691-4f73-a71c-cfe5920f884e"
|
||||
],
|
||||
"path_alias.4f75055d-c9c3-4f31-9a7c-12f6566d1545": [
|
||||
"node.c337a375-7fec-45d9-ad89-60ece71c2194"
|
||||
]
|
||||
}
|
97
content/node.c337a375-7fec-45d9-ad89-60ece71c2194.json
Normal file
97
content/node.c337a375-7fec-45d9-ad89-60ece71c2194.json
Normal file
|
@ -0,0 +1,97 @@
|
|||
{
|
||||
"uuid": [
|
||||
{
|
||||
"value": "c337a375-7fec-45d9-ad89-60ece71c2194"
|
||||
}
|
||||
],
|
||||
"langcode": [
|
||||
{
|
||||
"value": "en"
|
||||
}
|
||||
],
|
||||
"type": [
|
||||
{
|
||||
"target_id": "daily_email",
|
||||
"target_type": "node_type",
|
||||
"target_uuid": "8bde1f2f-eef9-4f2d-ae9c-96921f8193d7"
|
||||
}
|
||||
],
|
||||
"revision_timestamp": [
|
||||
{
|
||||
"value": "2025-06-25T07:00:48+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": "Consistency with architectural testing"
|
||||
}
|
||||
],
|
||||
"created": [
|
||||
{
|
||||
"value": "2025-06-22T06:58:19+00:00"
|
||||
}
|
||||
],
|
||||
"changed": [
|
||||
{
|
||||
"value": "2025-06-25T07:00:48+00:00"
|
||||
}
|
||||
],
|
||||
"promote": [
|
||||
{
|
||||
"value": false
|
||||
}
|
||||
],
|
||||
"sticky": [
|
||||
{
|
||||
"value": false
|
||||
}
|
||||
],
|
||||
"default_langcode": [
|
||||
{
|
||||
"value": true
|
||||
}
|
||||
],
|
||||
"revision_translation_affected": [
|
||||
{
|
||||
"value": true
|
||||
}
|
||||
],
|
||||
"path": [
|
||||
{
|
||||
"alias": "\/daily\/2025\/06\/22\/consistency-architectural-testing",
|
||||
"langcode": "en"
|
||||
}
|
||||
],
|
||||
"body": [
|
||||
{
|
||||
"value": "Yesterday, I asked whether class names should include suffixes or be named a certain way in your application.\r\n\r\nI said that [consistency is key][1].\r\n\r\nBut how do you enforce these rules to keep things consistent?\r\n\r\nIt could be done manually in a code review or pair programming session, but it would be better if it could be automated.\r\n\r\nSimilar to phpcs for code linting and automated tests that ensure functionality works as expected, architectural tests allow you to define and run your own architectural rules.\r\n\r\nFor example, I could write this to ensure Action classes don't have the `Action` suffix:\r\n\r\n```php\r\nfunction test_action_classes_are_not_suffixed(): Rule\r\n{\r\n return PHPat::rule()\r\n ->classes(Selector::inNamespace('App\\Action'))\r\n ->shouldBeNamed(\r\n fqcn: '\/^(?!.*Action$).*$\/',\r\n regex: TRUE,\r\n );\r\n}\r\n```\r\n\r\nThis is using PHPat - an extension for PHPStan - that finds all classes in an `App\\Action` namespace and checks the class name matches the given format.\r\n\r\nIf the class name is incorrect, PHPStan will return an error:\r\n\r\n> App\\Action\\DoesSomethingAction should be named matching the regex \/^(?!.*Action$).*$\/\r\n\r\nI [created more examples][0] to ensure the classes are final, read-only and don't extend or implement anything.\r\n\r\nPHPat has [an examples page][2] of potential use cases for architectural tests, and how to implement layered architectures or Model-View-Controller.\r\n\r\nPest PHP also has an architectural testing library so, if you use PHP, try both and see which works best for you.\r\n\r\n[0]: https:\/\/code.oliverdavies.uk\/opdavies\/phpat-example\/src\/commit\/cf07cec6d20bd4f6108736efdfbd2af549df2748\/tests\/Architecture\/ArchitectureTest.php\r\n[1]: \/daily\/2025\/06\/21\/consistency-key\r\n[2]: https:\/\/www.phpat.dev\/examples",
|
||||
"format": "markdown",
|
||||
"processed": "<p>Yesterday, I asked whether class names should include suffixes or be named a certain way in your application.<\/p>\n<p>I said that <a href=\"http:\/\/localhost:8888\/daily\/2025\/06\/21\/consistency-key\">consistency is key<\/a>.<\/p>\n<p>But how do you enforce these rules to keep things consistent?<\/p>\n<p>It could be done manually in a code review or pair programming session, but it would be better if it could be automated.<\/p>\n<p>Similar to phpcs for code linting and automated tests that ensure functionality works as expected, architectural tests allow you to define and run your own architectural rules.<\/p>\n<p>For example, I could write this to ensure Action classes don't have the <code>Action<\/code> suffix:<\/p>\n<pre><code>function test_action_classes_are_not_suffixed(): Rule\n{\n return PHPat::rule()\n ->classes(Selector::inNamespace('App\\Action'))\n ->shouldBeNamed(\n fqcn: '\/^(?!.*Action$).*$\/',\n regex: TRUE,\n );\n}\n<\/code><\/pre><p>This is using PHPat - an extension for PHPStan - that finds all classes in an <code>App\\Action<\/code> namespace and checks the class name matches the given format.<\/p>\n<p>If the class name is incorrect, PHPStan will return an error:<\/p>\n<blockquote><p>App\\Action\\DoesSomethingAction should be named matching the regex \/^(?!.<em>Action$).<\/em>$\/<\/p>\n<\/blockquote>\n<p>I <a href=\"https:\/\/code.oliverdavies.uk\/opdavies\/phpat-example\/src\/commit\/cf07cec6d20bd4f6108736efdfbd2af549df2748\/tests\/Architecture\/ArchitectureTest.php\">created more examples<\/a> to ensure the classes are final, read-only and don't extend or implement anything.<\/p>\n<p>PHPat has <a href=\"https:\/\/www.phpat.dev\/examples\">an examples page<\/a> of potential use cases for architectural tests, and how to implement layered architectures or Model-View-Controller.<\/p>\n<p>Pest PHP also has an architectural testing library so, if you use PHP, try both and see which works best for you.<\/p>\n",
|
||||
"summary": ""
|
||||
}
|
||||
],
|
||||
"field_daily_email_cta": [
|
||||
{
|
||||
"target_type": "node",
|
||||
"target_uuid": "3074e1e9-c691-4f73-a71c-cfe5920f884e"
|
||||
}
|
||||
]
|
||||
}
|
27
content/path_alias.4f75055d-c9c3-4f31-9a7c-12f6566d1545.json
Normal file
27
content/path_alias.4f75055d-c9c3-4f31-9a7c-12f6566d1545.json
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"uuid": [
|
||||
{
|
||||
"value": "4f75055d-c9c3-4f31-9a7c-12f6566d1545"
|
||||
}
|
||||
],
|
||||
"langcode": [
|
||||
{
|
||||
"value": "en"
|
||||
}
|
||||
],
|
||||
"path": [
|
||||
{
|
||||
"value": "\/node\/c337a375-7fec-45d9-ad89-60ece71c2194"
|
||||
}
|
||||
],
|
||||
"alias": [
|
||||
{
|
||||
"value": "\/daily\/2025\/06\/22\/consistency-architectural-testing"
|
||||
}
|
||||
],
|
||||
"status": [
|
||||
{
|
||||
"value": true
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue