ProcessEntitiesTest is allowing unexpected results to slip through

Created on 20 November 2024, about 1 month ago

Problem/Motivation

While working on 🐛 Encrypted decimal field value not saved on drupal version 10.2.x+ Active I noticed an issue with ProcessEntitiesTest. Given the bug outlined in 🐛 Encrypted decimal field value not saved on drupal version 10.2.x+ Active , one would expect changing encrypted_decimal to 'type' => 'decimal' in ProcessEntitiesTest::encryptDecryptEntityDataProvider would cause ProcessEntitiesTest::testEncryptDecryptEntity to correctly fail due to ProcessEntities::getUnencryptedPlaceholderValue returning NULL for this field instead of 0. It didn't.

In debugging the code I found that the setValue call in ProcessEntitiesTest was correctly returning NULL but MockObject::expects was allowing 0 to pass.

Steps to reproduce

  1. Configure a Drupal Site version 10.2+, with Field Encrypt version 3.2.0 installed and PHPUnit testing configured.
  2. Change encrypted_decimal DataDefinition to 'type' => 'decimal' in ProcessEntitiesTest::encryptDecryptEntityDataProvider
  3. Run ProcessEntitiesTest tests

Proposed resolution

TBD

Remaining tasks

TBD

🐛 Bug report
Status

Needs work

Version

3.2

Component

Code

Created by

🇨🇦Canada tame4tex

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @tame4tex
  • 🇨🇦Canada tame4tex

    Not sure on the best path forward here but it highlights the need for more comprehensive testing of different data types. Happy to help with this once there is a consensus on direction.

Production build 0.71.5 2024