Drupal\Tests\migrate\Unit\destination\EntityRevisionTest uses weird mocking pattern

Created on 16 September 2024, 3 months ago

Problem/Motivation

From https://git.drupalcode.org/project/drupal/-/merge_requests/6111#note_376...

This test class uses a very odd pattern: in the setUp() method, there are lines like

    $this->accountSwitcher = $this->prophesize(AccountSwitcherInterface::class);

setting the class variable to an ObjectProphecy object, despite what the @var comment says. Then the test functions call reveal(), creating an object that implements the desired interface.

We should have a separate issue to clean this up: call reveal() in the setUp() method, so that the class variables match their @var comments.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

📌 Task
Status

Active

Version

11.0 🔥

Component
PHPUnit 

Last updated 3 days ago

Created by

🇬🇧United Kingdom joachim

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024