[PHPUnit 10] Provide a static viable alternative to $this->prophesize() in data providers

Created on 15 April 2023, over 1 year ago
Updated 19 February 2024, 10 months ago

Problem/Motivation

PHPUnit 10 deprecates use of non-static @dataProvider methods. This means that @dataProvider methods can no longer make calls to non-static methods. Any non-static call ($this->someMethod()) needs to be replaced by a call to a static alternative (static::someOtherMethod()), that would have to be implemented if not available.

In this issue, focus on replacing $this->prophesize()

Proposed resolution

In the data providers, replace $this->prophesize() with (new Prophet())->prophesize() or similar so to get the mock object directly from Prophecy and not via the trait that is meant to be included in test objects.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Fixed

Version

10.1

Component
PHPUnit 

Last updated about 7 hours ago

Created by

🇮🇹Italy mondrake 🇮🇹

Live updates comments and jobs are added and updated live.
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.

Production build 0.71.5 2024