daily-email: add 2023-10-25
Automated tests prevent regressions when upgrading
This commit is contained in:
parent
6b381d047c
commit
4419520512
29
src/content/daily-email/2023-10-25.md
Normal file
29
src/content/daily-email/2023-10-25.md
Normal file
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
title: >
|
||||
Automated tests prevent regressions when upgrading
|
||||
pubDate: 2023-10-25
|
||||
permalink: >
|
||||
archive/2023/10/25/automated-tests-prevent-regressions-when-upgrading
|
||||
tags:
|
||||
- software-development
|
||||
- php
|
||||
- drupal
|
||||
- automated-testing
|
||||
- test-driven-development
|
||||
---
|
||||
|
||||
With Drupal 9 almost being end-of-life and unsupported, I've recently been doing a lot of Drupal 9 to 10 upgrade work.
|
||||
|
||||
As it's a major version update, there are breaking changes that mean you may need to change your code.
|
||||
|
||||
Here's an example of an error caused by a breaking change:
|
||||
|
||||
> 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().
|
||||
|
||||
To fix this, you need to call the `accessCheck()` method before executing a query and specify whether it should be checked.
|
||||
|
||||
But how do you know if it should be checked?
|
||||
|
||||
If you have automated tests that pass beforehand and still pass afterwards, you picked the correct option.
|
||||
|
||||
If the test passes before and fails afterwards, you found the bug and can fix it immediately to ensure the functionality works as before.
|
Loading…
Reference in a new issue