Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Working on PHP 8.2 compatibility I faced with direct access to mock properties #3295821-37: Ignore: patch testing issue for PHP 8.2 attributes (and previous test results)
PHPUnit Test failed to complete; Error: PHPUnit 9.5.20 �[44m#StandWith�[0m�[43mUkraine�[0m
Testing Drupal\Tests\Core\Test\TestSetupTraitTest
. 1 / 1 (100%)
Time: 00:02.858, Memory: 4.00 MB
OK (1 test, 4 assertions)
Unsilenced deprecation notices (2)
1x: Creation of dynamic property Mock_Trait_TestSetupTrait_231e7679_053ce184::$databasePrefix is deprecated
1x in TestSetupTraitTest::testChangeDatabasePrefix from Drupal\Tests\Core\Test
1x: Creation of dynamic property Mock_Trait_TestSetupTrait_231e7679_053ce184::$root is deprecated
1x in TestSetupTraitTest::testChangeDatabasePrefix from Drupal\Tests\Core\Test
Steps to reproduce
https://www.drupal.org/pift-ci-job/2432391
Proposed resolution
move properties to trait or find other solution
Remaining tasks
decide/patch/commit
User interface changes
no
API changes
TBD
Data model changes
no
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#13 | interdiff.txt | 1.02 KB | andypost |
#13 | 3298906-13-10.x.patch | 2.86 KB | andypost |
| |||
#13 | 3298906-13-9.x.patch | 2.98 KB | andypost |
Comments
Comment #2
andypostworkaround
Comment #4
andypostComment #6
andypostComment #7
borisson_Looks simple enough, this only moves code around in tests. +1
Comment #8
alexpottWe need to support PHP 8.2 on Drupal 9.5 so we should fix #2 to make the property accessible - atleast in a patch for d9.
Comment #9
andypostQueued for 9.5https://www.drupal.org/pift-ci-job/2448413
Comment #10
andypost@alexpott not clear what you mean the property moved to trait and remains protected...
Comment #11
alexpottSee the php 7.3 fails - https://www.drupal.org/pift-ci-job/2448238
Comment #12
andypostI think it should be separate patch for 9.4+ as
setAccessible()
is no-op with PHP > 8.1 #3224941: Remove usage of setAccessible() when core requires PHP 8.1Comment #13
andypostre-rolled split of patches, interdiff is between 9.x and 10.x patches
Comment #14
xjmComment #15
alexpottCommitted and pushed 471e827a09 to 10.1.x and c5e50e3fe2 to 10.0.x. Thanks!
Committed and pushed d2653f7342 to 9.5.x and 324532dcbc to 9.4.x. Thanks!
Backported to 9.4.x to keep test infrastructure inline.