From 4fa8f80b42cf5ccfd87d84ba9dc480a251b500a7 Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Mon, 29 Jan 2024 10:19:35 +0000
Subject: [PATCH] Issue #3417553 by longwave: Remove withConsecutive() in
 CacheCollectorTest

---
 core/phpstan-baseline.neon                                | 5 -----
 core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php | 8 ++++----
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/core/phpstan-baseline.neon b/core/phpstan-baseline.neon
index c30a4a8f631d..7c6cda9769ca 100644
--- a/core/phpstan-baseline.neon
+++ b/core/phpstan-baseline.neon
@@ -3272,11 +3272,6 @@ parameters:
 			count: 1
 			path: tests/Drupal/Tests/Composer/ComposerTest.php
 
-		-
-			message: "#^Call to deprecated method withConsecutive\\(\\) of class PHPUnit\\\\Framework\\\\MockObject\\\\Builder\\\\InvocationMocker\\.$#"
-			count: 1
-			path: tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php
-
 		-
 			message: """
 				#^Call to deprecated method expectError\\(\\) of class PHPUnit\\\\Framework\\\\TestCase\\:
diff --git a/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php b/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php
index 627cef0feff4..d5c6b68bce95 100644
--- a/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php
+++ b/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php
@@ -309,12 +309,12 @@ public function testUpdateCacheDelete() {
     ];
     // Set up mock expectation, on the second call the with the second argument
     // set to TRUE because we triggered a cache invalidation.
+    $allow_invalid = [FALSE, TRUE];
     $this->cacheBackend->expects($this->exactly(2))
       ->method('get')
-      ->withConsecutive(
-        [$this->cid],
-        [$this->cid, TRUE],
-      )
+      ->with($this->cid, $this->callback(function ($value) use (&$allow_invalid) {
+        return array_shift($allow_invalid) === $value;
+      }))
       ->willReturn($cache);
 
     $this->collector->delete($key);
-- 
GitLab