The method being used to add a value to the entity is private.

Created on 17 April 2023, over 1 year ago
Updated 19 April 2023, over 1 year ago

Problem/Motivation

When running the PHPunit test suite against the telephone module it provides the following error

ERRORS!
Tests: 13, Assertions: 120, Errors: 1.

Issue.
The method being used to add a value to the entity is private.

core/modules/telephone/tests/src/Kernel/TelephoneItemTest.php
$entity->name->value = $this->randomMachineName();

Solution.
Use entity method setName() instead
$entity->setName($this->randomMachineName());

Steps to reproduce

Run the following tests on a clean installation of Drupal 10

 ./vendor/bin/phpunit -c core core/modules/telephone

Proposed resolution

Update code with the following patch to see the results below match.

$ ./vendor/bin/phpunit -c core core/modules/telephone
PHPUnit 9.5.28 by Sebastian Bergmann and contributors.

Testing /app/build/core/modules/telephone
.............                                                     13 / 13 (100%)

Time: 02:14.438, Memory: 10.00 MB

OK (13 tests, 131 assertions)

πŸ› Bug report
Status

Closed: cannot reproduce

Version

10.1 ✨

Component
TelephoneΒ  β†’

Last updated 24 days ago

Created by

πŸ‡¦πŸ‡ΊAustralia Purencool

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024