From 85ff40631c11b8f42de36d3e378062d57001c378 Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Sat, 3 Feb 2024 18:36:47 +0000
Subject: [PATCH] Issue #3418459 by longwave: Remove withConsecutive() in
 DerivativeDiscoveryDecoratorTest

---
 core/phpstan-baseline.neon                          |  5 -----
 .../Discovery/DerivativeDiscoveryDecoratorTest.php  | 13 ++++++++-----
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/core/phpstan-baseline.neon b/core/phpstan-baseline.neon
index 93168f109e6b..4b1e5fd61f46 100644
--- a/core/phpstan-baseline.neon
+++ b/core/phpstan-baseline.neon
@@ -3346,11 +3346,6 @@ parameters:
 			count: 1
 			path: tests/Drupal/Tests/Core/Plugin/CategorizingPluginManagerTraitTest.php
 
-		-
-			message: "#^Call to deprecated method withConsecutive\\(\\) of class PHPUnit\\\\Framework\\\\MockObject\\\\Builder\\\\InvocationMocker\\.$#"
-			count: 1
-			path: tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php
-
 		-
 			message: "#^Constructor of class Drupal\\\\Tests\\\\Core\\\\Plugin\\\\Discovery\\\\TestContainerDerivativeDiscovery has an unused parameter \\$example_service\\.$#"
 			count: 1
diff --git a/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php b/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php
index d7a2c5b8256d..2e3fd33f05a0 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php
@@ -243,12 +243,15 @@ public function testSingleExistingDerivative() {
       'null_value' => NULL,
     ];
 
-    $this->discoveryMain->expects($this->exactly(2))
+    $ids = [
+      $derivative_definition['id'],
+      $base_definition['id'],
+    ];
+    $this->discoveryMain->expects($this->exactly(count($ids)))
       ->method('getDefinition')
-      ->withConsecutive(
-        ['non_container_aware_discovery:test_discovery_1'],
-        ['non_container_aware_discovery'],
-      )
+      ->with($this->callback(function (string $id) use (&$ids): bool {
+        return array_shift($ids) === $id;
+      }))
       ->willReturnOnConsecutiveCalls(
         $derivative_definition,
         $base_definition,
-- 
GitLab