UnitTestCaseWrapper should not override TestCase::__construct()

Created on 11 August 2023, over 1 year ago
Updated 15 August 2023, over 1 year ago

Problem/Motivation

When running a test that utilizes UnitTestCaseWrapper::getInstance() a deprecation notice is thrown which will return a non-zero exit status causing builds to fail.

Other deprecation notices (1)
1x: The "PHPUnit\Framework\TestCase::__construct()" method is considered internal This method is not covered by the backward compatibility promise for PHPUnit. It may change without further notice. You should not extend it from "Drupal\test_helpers\UnitTestCaseWrapper".

Steps to reproduce

Utilize any one of the TestHelpers methods that calls UnitTestCaseWrapper::getInstance(). Example: the TestHelpers::getRandomGenerator() method.

Proposed resolution

See attached patch. This goes against a typical Singleton pattern, but it is the only way to remove the deprecation notice.

Remaining tasks

Validate and commit patch.

πŸ› Bug report
Status

Fixed

Version

1.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States j.cowher

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

Comments & Activities

Production build 0.71.5 2024