Problem/Motivation

Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTest::testCreate does not set up entity_type->getKey() correctly triggering deprecations on PHP 8.5

Steps to reproduce

Run Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTest::testCreate

Proposed resolution

Set up the mock correctly.

Remaining tasks

User interface changes

None

Introduced terminology

N/a

API changes

None

Data model changes

None

Release notes snippet

N/a

Issue fork drupal-3555884

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

alexpott created an issue. See original summary.

alexpott’s picture

Status: Active » Needs review
smustgrave’s picture

Status: Needs review » Needs work

Upgraded by ddev to 8.5
Without the MR the test triggers 3 PHP deprecations:

1) /var/www/html/core/lib/Drupal/Core/Entity/ContentEntityBase.php:260
Using null as an array offset is deprecated, use an empty string instead

Triggered by:

* Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTest::testCreate
  /var/www/html/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php:1062

2) /var/www/html/core/lib/Drupal/Core/Entity/ContentEntityBase.php:713
Using null as an array offset is deprecated, use an empty string instead

Triggered by:

* Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTest::testCreate (2 times)
  /var/www/html/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php:1062

3) /var/www/html/core/lib/Drupal/Core/Entity/ContentEntityBase.php:803
Using null as an array offset is deprecated, use an empty string instead

Applied the MR

I still get 2

1) /var/www/html/core/lib/Drupal/Core/Entity/ContentEntityBase.php:713
Using null as an array offset is deprecated, use an empty string instead

Triggered by:

* Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTest::testCreate (2 times)
  /var/www/html/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php:1062

2) /var/www/html/core/lib/Drupal/Core/Entity/ContentEntityBase.php:803
Using null as an array offset is deprecated, use an empty string instead

Triggered by:

* Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTest::testCreate
  /var/www/html/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php:1062
alexpott’s picture

Status: Needs work » Needs review
andypost’s picture

Status: Needs review » Reviewed & tested by the community

Thank you! now the test pass

catch’s picture

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

Committed/pushed to 11.x and cherry-picked to 11.3.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.

  • catch committed dfe6669b on 11.3.x
    Issue #3555884 by alexpott, smustgrave: Drupal\Tests\Core\Entity\Sql\...

  • catch committed 51379ceb on 11.x
    Issue #3555884 by alexpott, smustgrave: Drupal\Tests\Core\Entity\Sql\...

Status: Fixed » Closed (fixed)

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