From 6fa0344165432f25281f9b529ee3d73a0fc72fa1 Mon Sep 17 00:00:00 2001
From: catch <6915-catch@users.noreply.drupalcode.org>
Date: Fri, 17 Jan 2025 20:03:57 +0000
Subject: [PATCH] Issue #3500360 by plopesc, dww: Use
 PerformanceTestTrait::assertMetrics() in the navigation performance test

---
 .../FunctionalJavascript/PerformanceTest.php  | 27 ++++++++++---------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/core/modules/navigation/tests/src/FunctionalJavascript/PerformanceTest.php b/core/modules/navigation/tests/src/FunctionalJavascript/PerformanceTest.php
index 5a25d2a71eec..676eaf755e51 100644
--- a/core/modules/navigation/tests/src/FunctionalJavascript/PerformanceTest.php
+++ b/core/modules/navigation/tests/src/FunctionalJavascript/PerformanceTest.php
@@ -68,20 +68,23 @@ public function testLogin(): void {
       'SELECT "roles_target_id" FROM "user__roles" WHERE "entity_id" = "2"',
       'SELECT "name", "value" FROM "key_value" WHERE "name" IN ( "theme:stark" ) AND "collection" = "config.entity.key_store.block"',
     ];
-
     $recorded_queries = $performance_data->getQueries();
     $this->assertSame($expected_queries, $recorded_queries);
-    $this->assertSame(4, $performance_data->getQueryCount());
-    $this->assertSame(61, $performance_data->getCacheGetCount());
-    $this->assertSame(2, $performance_data->getCacheSetCount());
-    $this->assertSame(0, $performance_data->getCacheDeleteCount());
-    $this->assertSame(2, $performance_data->getCacheTagChecksumCount());
-    $this->assertSame(29, $performance_data->getCacheTagIsValidCount());
-    $this->assertSame(0, $performance_data->getCacheTagInvalidationCount());
-    $this->assertSame(1, $performance_data->getStyleSheetCount());
-    $this->assertSame(2, $performance_data->getScriptCount());
-    $this->assertLessThan(90200, $performance_data->getStylesheetBytes());
-    $this->assertLessThan(220000, $performance_data->getScriptBytes());
+
+    $expected = [
+      'QueryCount' => 4,
+      'CacheGetCount' => 61,
+      'CacheSetCount' => 2,
+      'CacheDeleteCount' => 0,
+      'CacheTagChecksumCount' => 2,
+      'CacheTagIsValidCount' => 29,
+      'CacheTagInvalidationCount' => 0,
+      'ScriptCount' => 2,
+      'ScriptBytes' => 220000,
+      'StylesheetCount' => 1,
+      'StylesheetBytes' => 90200,
+    ];
+    $this->assertMetrics($expected, $performance_data);
 
     // Check that the navigation toolbar is cached without any high-cardinality
     // cache contexts (user, route, query parameters etc.).
-- 
GitLab