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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

andypost created an issue. See original summary.

andypost’s picture

Status: Needs review » Needs work

The last submitted patch, 2: 3298906-2.patch, failed testing. View results

andypost’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 2: 3298906-2.patch, failed testing. View results

andypost’s picture

Status: Needs work » Needs review
borisson_’s picture

Status: Needs review » Reviewed & tested by the community

Looks simple enough, this only moves code around in tests. +1

alexpott’s picture

We 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.

andypost’s picture

andypost’s picture

@alexpott not clear what you mean the property moved to trait and remains protected...

alexpott’s picture

andypost’s picture

I 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.1

andypost’s picture

xjm’s picture

alexpott’s picture

Version: 10.0.x-dev » 9.4.x-dev
Status: Reviewed & tested by the community » Fixed

Committed 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.

  • alexpott committed 471e827 on 10.1.x
    Issue #3298906 by andypost, alexpott: Fix \Drupal\Tests\Core\Test\...

  • alexpott committed c5e50e3 on 10.0.x
    Issue #3298906 by andypost, alexpott: Fix \Drupal\Tests\Core\Test\...

  • alexpott committed d2653f7 on 9.5.x
    Issue #3298906 by andypost, alexpott: Fix \Drupal\Tests\Core\Test\...

  • alexpott committed 324532d on 9.4.x
    Issue #3298906 by andypost, alexpott: Fix \Drupal\Tests\Core\Test\...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.