diff --git a/core/modules/system/tests/modules/container_rebuild_test/src/TestController.php b/core/modules/system/tests/modules/container_rebuild_test/src/TestController.php
index 0b2fa1adcbd..bc7704eb45d 100644
--- a/core/modules/system/tests/modules/container_rebuild_test/src/TestController.php
+++ b/core/modules/system/tests/modules/container_rebuild_test/src/TestController.php
@@ -38,7 +38,7 @@ public function showModuleInfo(string $module, string $function) {
     else {
       $module_message .= 'not installed';
     }
-    $function_message = $function . ': ' . var_export(function_exists($function), TRUE);
+    $function_message = $function . ': ' . var_export(\Drupal::moduleHandler()->hasImplementations($function, $module), TRUE);
 
     return [
       '#theme' => 'item_list',
diff --git a/core/modules/system/tests/src/Functional/UpdateSystem/RebuildScriptTest.php b/core/modules/system/tests/src/Functional/UpdateSystem/RebuildScriptTest.php
index 77d15a813e5..484f520da0b 100644
--- a/core/modules/system/tests/src/Functional/UpdateSystem/RebuildScriptTest.php
+++ b/core/modules/system/tests/src/Functional/UpdateSystem/RebuildScriptTest.php
@@ -51,9 +51,9 @@ public function testRebuild(): void {
     $this->assertFalse($cache->get('rebuild_test'));
     $this->refreshVariables();
     $this->assertSame(1, \Drupal::state()->get('container_rebuild_test.count', 0));
-    $this->drupalGet('/container_rebuild_test/module_test/module_test_system_info_alter');
+    $this->drupalGet('/container_rebuild_test/module_test/system_info_alter');
     $this->assertSession()->pageTextContains('module_test: core/modules/system/tests/modules/module_test');
-    $this->assertSession()->pageTextContains('module_test_system_info_alter: true');
+    $this->assertSession()->pageTextContains('system_info_alter: true');
 
     // Move a module to ensure it does not break the rebuild.
     $file_system = new Filesystem();
@@ -63,9 +63,9 @@ public function testRebuild(): void {
     $this->assertSession()->addressEquals(new Url('<front>'));
     $this->refreshVariables();
     $this->assertSame(1, \Drupal::state()->get('container_rebuild_test.count', 0));
-    $this->drupalGet('/container_rebuild_test/module_test/module_test_system_info_alter');
+    $this->drupalGet('/container_rebuild_test/module_test/system_info_alter');
     $this->assertSession()->pageTextContains('module_test: ' . $this->siteDirectory . '/modules/module_test');
-    $this->assertSession()->pageTextContains('module_test_system_info_alter: true');
+    $this->assertSession()->pageTextContains('system_info_alter: true');
 
     // Disable a module by writing to the core.extension list.
     $this->config('core.extension')->clear('module.module_test')->save();
@@ -74,9 +74,9 @@ public function testRebuild(): void {
     $this->assertSession()->addressEquals(new Url('<front>'));
     $this->refreshVariables();
     $this->assertSame(1, \Drupal::state()->get('container_rebuild_test.count', 0));
-    $this->drupalGet('/container_rebuild_test/module_test/module_test_system_info_alter');
+    $this->drupalGet('/container_rebuild_test/module_test/system_info_alter');
     $this->assertSession()->pageTextContains('module_test: not installed');
-    $this->assertSession()->pageTextContains('module_test_system_info_alter: false');
+    $this->assertSession()->pageTextContains('system_info_alter: false');
 
     // Enable a module by writing to the core.extension list.
     $modules = $this->config('core.extension')->get('module');
@@ -87,9 +87,9 @@ public function testRebuild(): void {
     $this->assertSession()->addressEquals(new Url('<front>'));
     $this->refreshVariables();
     $this->assertSame(1, \Drupal::state()->get('container_rebuild_test.count', 0));
-    $this->drupalGet('/container_rebuild_test/module_test/module_test_system_info_alter');
+    $this->drupalGet('/container_rebuild_test/module_test/system_info_alter');
     $this->assertSession()->pageTextContains('module_test: ' . $this->siteDirectory . '/modules/module_test');
-    $this->assertSession()->pageTextContains('module_test_system_info_alter: true');
+    $this->assertSession()->pageTextContains('system_info_alter: true');
 
     // Test how many container rebuild occur when there is no cached container.
     \Drupal::state()->set('container_rebuild_test.count', 0);
