resolve differing createUser() test methods

Created on 29 November 2022, over 1 year ago
Updated 21 January 2023, over 1 year ago

Problem/Motivation

This is a follow-on from #3224276: Move useful helper methods for working with entities from EntityKernelTestBase to KernelTestBase → , in the interest of keeping that issue simple.

There is a confusing mishmash of test methods called createUser():

- Drupal\Tests\user\Traits\UserCreationTrait has createUser() with 4 params, which we'll refer to as createUser4: createUser(array $permissions = [], $name = NULL, $admin = FALSE, array $values = [])
- EntityKernelTestBase has createUser() with 2 params, which we'll refer to as createUser2: createUser($values = [], $permissions = [])
- EntityKernelTestBase imports UserCreationTrait, aliasing createUser as drupalCreateUser
- some child classes of KernelTestBase import UserCreationTrait, and some of them do the same aliasing, and some don't

Proposed resolution

Figure out how to end up in a situation where KernelTestBase imports UserCreationTrait, including createUser() without aliasing.

This is going to be difficult because the methods are incompatible. See https://www.drupal.org/project/drupal/issues/3224276#comment-14681959 → for detatils.

Remaining tasks

Figure out the minimum of breakage that can happen.

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Fixed

Version

10.1 ✨

Component
PHPUnit  →

Last updated 1 minute ago

Created by

🇬🇧United Kingdom joachim

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.69.0 2024