{ "uuid": [ { "value": "c18eb41a-8a26-4a5a-bf17-e1417cebb0dc" } ], "langcode": [ { "value": "en" } ], "type": [ { "target_id": "daily_email", "target_type": "node_type", "target_uuid": "8bde1f2f-eef9-4f2d-ae9c-96921f8193d7" } ], "revision_timestamp": [ { "value": "2025-05-11T09:00:30+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": "Automated tests prevent regressions when upgrading\n" } ], "created": [ { "value": "2023-10-25T00:00:00+00:00" } ], "changed": [ { "value": "2025-05-11T09:00:30+00:00" } ], "promote": [ { "value": false } ], "sticky": [ { "value": false } ], "default_langcode": [ { "value": true } ], "revision_translation_affected": [ { "value": true } ], "path": [ { "alias": "\/daily\/2023\/10\/25\/automated-tests-prevent-regressions-when-upgrading", "langcode": "en" } ], "body": [ { "value": "\n

With Drupal 9 almost being end-of-life and unsupported, I've recently been doing a lot of Drupal 9 to 10 upgrade work.<\/p>\n\n

As it's a major version update, there are breaking changes that mean you may need to change your code.<\/p>\n\n

Here's an example of an error caused by a breaking change:<\/p>\n\n

\n

Drupal\\Core\\Entity\\Query\\QueryException: Entity queries must explicitly set whether the query should be access checked or not. See Drupal\\Core\\Entity\\Query\\QueryInterface::accessCheck().<\/p>\n<\/blockquote>\n\n

To fix this, you need to call the accessCheck()<\/code> method before executing a query and specify whether it should be checked.<\/p>\n\n

But how do you know if it should be checked?<\/p>\n\n

If you have automated tests that pass beforehand and still pass afterwards, you picked the correct option.<\/p>\n\n

If the test passes before and fails afterwards, you found the bug and can fix it immediately to ensure the functionality works as before.<\/p>\n\n ", "format": "full_html", "processed": "\n

With Drupal 9 almost being end-of-life and unsupported, I've recently been doing a lot of Drupal 9 to 10 upgrade work.<\/p>\n\n

As it's a major version update, there are breaking changes that mean you may need to change your code.<\/p>\n\n

Here's an example of an error caused by a breaking change:<\/p>\n\n

\n

Drupal\\Core\\Entity\\Query\\QueryException: Entity queries must explicitly set whether the query should be access checked or not. See Drupal\\Core\\Entity\\Query\\QueryInterface::accessCheck().<\/p>\n<\/blockquote>\n\n

To fix this, you need to call the accessCheck()<\/code> method before executing a query and specify whether it should be checked.<\/p>\n\n

But how do you know if it should be checked?<\/p>\n\n

If you have automated tests that pass beforehand and still pass afterwards, you picked the correct option.<\/p>\n\n

If the test passes before and fails afterwards, you found the bug and can fix it immediately to ensure the functionality works as before.<\/p>\n\n ", "summary": null } ], "feeds_item": [ { "imported": "1970-01-01T00:33:45+00:00", "guid": null, "hash": "e6ccad714f421e19ca6bf59a5f2c224c", "target_type": "feeds_feed", "target_uuid": "90c85284-7ca8-4074-9178-97ff8384fe76" } ] }