AssetResolverTest should use ::willReturnMap() for mocking

Created on 18 August 2024, 3 months ago
Updated 5 September 2024, 2 months ago

Problem/Motivation

phpunit/phpunit released 10.5.30. (https://github.com/sebastianbergmann/phpunit/releases/tag/10.5.30)

In this release, there's a new check if willReturnOnConsecutiveCalls() has the minimum required amount of return values defined, if a not the new \PHPUnit\Framework\MockObject\NoMoreReturnValuesConfiguredException is thrown. (https://github.com/sebastianbergmann/phpunit/commit/490879817a1417fd5fa1...)

In core this happens on one on occasion:

Drupal\Tests\Core\Asset\AssetResolverTest::testGetJsAssets with data set "different libraries, same timestamps"
PHPUnit\Framework\MockObject\NoMoreReturnValuesConfiguredException: Only 6 return values have been configured for Drupal\Core\Asset\LibraryDiscovery::getLibraryByName()

core/lib/Drupal/Core/Asset/AssetResolver.php:264
core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php:230

Steps to reproduce

See first test failure on https://git.drupalcode.org/issue/drupal-3468781/-/pipelines/257385/test_...
(Other failures are being handled in ๐Ÿ“Œ sebastianbergmann/comparator:5.0.2 Introduces (for Drupal) breaking changes Fixed )

Proposed resolution

- Fix the sole occurrence of NoMoreReturnValuesConfiguredException in AssetResolverTest
- Bump version of phpunit/phpunit to latest in composer.* in a new issue.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

๐Ÿ“Œ Task
Status

Fixed

Version

10.3 โœจ

Component
PHPUnitย  โ†’

Last updated about 22 hours ago

Created by

๐Ÿ‡ณ๐Ÿ‡ฑNetherlands spokje

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