Kernel Testing Deprecations

Created on 5 March 2024, 4 months ago
Updated 1 April 2024, 3 months ago

Problem/Motivation

I've started running kernel tests against modules and got these deprecation warnings in the profile module:

OK (9 tests, 149 assertions)

Remaining self deprecation notices (5)

  4x: Calling createUser() with $permissions as the second parameter is deprecated in drupal:10.1.0 and will be removed from drupal:11.0.0. Use createUser(array $permissions = [], $name = NULL, $admin = FALSE, array $values = []) instead. See https://www.drupal.org/node/3330762
    3x in ProfileRoleAccessTest::testProfileOperations from Drupal\Tests\profile\Kernel
    1x in ProfileRoleAccessTest::testProfileCreate from Drupal\Tests\profile\Kernel

  1x: The Drupal\Tests\field\Traits\EntityReferenceTestTrait is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Instead, use \Drupal\Tests\field\Traits\EntityReferenceFieldCreationTrait. See https://www.drupal.org/node/3401941
    1x in KernelTestSuite::suite from Drupal\Tests\TestSuites

Steps to reproduce

Run the tests in profile. The way I am doing it is with:

phpunit testsuite="kernel" --group="profile"

Proposed resolution

Follow the suggestions to replace the function and class.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇨🇦Canada ryanrobinson_wlu

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

Comments & Activities

Production build 0.69.0 2024