Avoid extending internal PHPUnit constructor in S3Test unit test

Created on 19 June 2025, about 2 months ago

Problem/Motivation

When running unit tests, the following deprecation warning appears:

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\Tests\flysystem_s3\Unit\Flysystem\S3Test".
    1x in DrupalListener::endTest from Drupal\Tests\Listeners

Suggested fix:
Move any initialization logic from the constructor into the setUp() method, which is the recommended approach in PHPUnit:

protected function setUp(): void {
  parent::setUp();
  // Initialize properties here instead of the constructor
}

This will avoid relying on PHPUnit internals and ensure better forward compatibility.

šŸ› Bug report
Status

Needs work

Version

3.0

Component

Code

Created by

šŸ‡ØšŸ‡“Colombia davidlfg

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