diff --git a/lib/Drupal/views/Tests/Handler/FieldTest.php b/lib/Drupal/views/Tests/Handler/FieldTest.php
index 43ffc09861f493feb163bf14ce55b048183ea213..1d85fd4e906ad1cd3bab9ca64775a9b5f85d7b41 100644
--- a/lib/Drupal/views/Tests/Handler/FieldTest.php
+++ b/lib/Drupal/views/Tests/Handler/FieldTest.php
@@ -370,7 +370,7 @@ public function testRewrite() {
     $id_field = $view->field['id'];
 
     // Don't check the rewrite checkbox, so the text shouldn't appear.
-    $id_field->options['alter']['text'] = $random_text = $this->randomString();
+    $id_field->options['alter']['text'] = $random_text = $this->randomName();
     $output = $id_field->theme($row);
     $this->assertNotSubString($output, $random_text);