Problem/Motivation

Menu Link Content Entity Access (Drupal\Tests\menu_link_content\Unit\MenuLinkContentEntityAccess)

⚠ Unrecognized operation
    
    1 test triggered 2 PHP deprecations:
    
    1) /builds/issue/drupal-2985400/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php:195
    Using null as an array offset is deprecated, use an empty string instead
    
    Triggered by:
    
    * Drupal\Tests\menu_link_content\Unit\MenuLinkContentEntityAccessTest::testUnrecognizedOperation
      /builds/issue/drupal-2985400/core/modules/menu_link_content/tests/src/Unit/MenuLinkContentEntityAccessTest.php:31
    
    2) /builds/issue/drupal-2985400/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php:221
    Using null as an array offset is deprecated, use an empty string instead
    
    Triggered by:
    
    * Drupal\Tests\menu_link_content\Unit\MenuLinkContentEntityAccessTest::testUnrecognizedOperation
      /builds/issue/drupal-2985400/core/modules/menu_link_content/tests/src/Unit/MenuLinkContentEntityAccessTest.php:31

Steps to reproduce

See CI-Pipeline-Step "PHPUnit Unit tests on PHP 8.5" -> find testUnrecognizedOperation.

Proposed resolution

Mock id method of account.

Remaining tasks

User interface changes

None.

Introduced terminology

None.

API changes

None.

Data model changes

None.

Release notes snippet

None.

Issue fork drupal-3555522

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

tobiasb created an issue. See original summary.

tobiasb’s picture

Issue tags: +PHP 8.5

tobiasb’s picture

Title: Fix test in \Drupal\Tests\menu_link_content\Unit\MenuLinkContentEntityAccessTest::testUnrecognizedOperation » Fix account mock in \Drupal\Tests\menu_link_content\Unit\MenuLinkContentEntityAccessTest::testUnrecognizedOperation for php 8.5
Assigned: tobiasb » Unassigned
Issue summary: View changes
Status: Active » Needs review
dcam’s picture

Status: Needs review » Reviewed & tested by the community

This looks good to me. I verified that MenuLinkContentEntityAccess is currently failing in the PHP 8.5 job, see a test run from another issue I worked on earlier today. The failing test shows that the problem occurs on line 221 of core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php. This is where id() is called. So mocking id() is an appropriate fix. And the fixed test passes in the pipeline here.

alexpott’s picture

Version: 11.x-dev » 10.6.x-dev
Status: Reviewed & tested by the community » Fixed

As a test only fix I've backported this to 10.6.x

Committed and pushed ca32fdf4d2e to 11.x and a3c5bcfcdcc to 11.3.x and 7a15b86fd48 to 11.2.x and 13d06af09f2 to 10.6.x. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • alexpott committed 13d06af0 on 10.6.x
    Issue #3555522 by tobiasb: Fix account mock in \Drupal\Tests\...

  • alexpott committed 7a15b86f on 11.2.x
    Issue #3555522 by tobiasb: Fix account mock in \Drupal\Tests\...

  • alexpott committed a3c5bcfc on 11.3.x
    Issue #3555522 by tobiasb: Fix account mock in \Drupal\Tests\...

  • alexpott committed ca32fdf4 on 11.x
    Issue #3555522 by tobiasb: Fix account mock in \Drupal\Tests\...

Status: Fixed » Closed (fixed)

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