diff --git a/core/modules/action/lib/Drupal/action/Tests/ConfigurationTest.php b/core/modules/action/lib/Drupal/action/Tests/ConfigurationTest.php
index 97448ae..b04e2ac 100644
--- a/core/modules/action/lib/Drupal/action/Tests/ConfigurationTest.php
+++ b/core/modules/action/lib/Drupal/action/Tests/ConfigurationTest.php
@@ -46,7 +46,7 @@ function testActionConfiguration() {
 
     // Make a POST request to the individual action configuration page.
     $edit = array();
-    $action_label = $this->randomName();
+    $action_label = $this->randomMachineName();
     $edit['label'] = $action_label;
     $edit['id'] = strtolower($action_label);
     $edit['url'] = 'admin';
@@ -62,7 +62,7 @@ function testActionConfiguration() {
     preg_match('|admin/config/system/actions/configure/(.+)|', $this->getUrl(), $matches);
     $aid = $matches[1];
     $edit = array();
-    $new_action_label = $this->randomName();
+    $new_action_label = $this->randomMachineName();
     $edit['label'] = $new_action_label;
     $edit['url'] = 'admin';
     $this->drupalPostForm(NULL, $edit, t('Save'));
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorTestBase.php b/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorTestBase.php
index 6a85657..445a4ac 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorTestBase.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorTestBase.php
@@ -85,7 +85,7 @@ function deleteFeed(FeedInterface $feed) {
    *   A feed array.
    */
   function getFeedEditArray($feed_url = NULL, array $edit = array()) {
-    $feed_name = $this->randomName(10);
+    $feed_name = $this->randomMachineName(10);
     if (!$feed_url) {
       $feed_url = url('rss.xml', array(
         'query' => array('feed' => $feed_name),
@@ -113,7 +113,7 @@ function getFeedEditArray($feed_url = NULL, array $edit = array()) {
    *   A feed object.
    */
   function getFeedEditObject($feed_url = NULL, array $values = array()) {
-    $feed_name = $this->randomName(10);
+    $feed_name = $this->randomMachineName(10);
     if (!$feed_url) {
       $feed_url = url('rss.xml', array(
         'query' => array('feed' => $feed_name),
@@ -326,8 +326,8 @@ function createSampleNodes($count = 5) {
     // Post $count article nodes.
     for ($i = 0; $i < $count; $i++) {
       $edit = array();
-      $edit['title[0][value]'] = $this->randomName();
-      $edit['body[0][value]'] = $this->randomName();
+      $edit['title[0][value]'] = $this->randomMachineName();
+      $edit['body[0][value]'] = $this->randomMachineName();
       $this->drupalPostForm('node/add/article', $edit, t('Save'));
     }
   }
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Tests/FeedParserTest.php b/core/modules/aggregator/lib/Drupal/aggregator/Tests/FeedParserTest.php
index 96ee61f..fd64dac 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/Tests/FeedParserTest.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/Tests/FeedParserTest.php
@@ -101,7 +101,7 @@ function testRedirectFeed() {
   function testInvalidFeed() {
     // Simulate a typo in the URL to force a curl exception.
     $invalid_url = 'http:/www.drupal.org';
-    $feed = entity_create('aggregator_feed', array('url' => $invalid_url, 'title' => $this->randomName()));
+    $feed = entity_create('aggregator_feed', array('url' => $invalid_url, 'title' => $this->randomMachineName()));
     $feed->save();
 
     // Update the feed. Use the UI to be able to check the message easily.
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Tests/Views/IntegrationTest.php b/core/modules/aggregator/lib/Drupal/aggregator/Tests/Views/IntegrationTest.php
index 3f4d7b5..de4b976 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/Tests/Views/IntegrationTest.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/Tests/Views/IntegrationTest.php
@@ -72,10 +72,10 @@ public function testAggregatorItemView() {
     for ($i = 0; $i < 10; $i++) {
       $values = array();
       $values['timestamp'] = mt_rand(REQUEST_TIME - 10, REQUEST_TIME + 10);
-      $values['title'] = $this->randomName();
-      $values['description'] = $this->randomName();
+      $values['title'] = $this->randomMachineName();
+      $values['description'] = $this->randomMachineName();
       // Add a image to ensure that the sanitizing can be tested below.
-      $values['author'] = $this->randomName() . '<img src="http://example.com/example.png" \>"';
+      $values['author'] = $this->randomMachineName() . '<img src="http://example.com/example.png" \>"';
       $values['link'] = 'http://drupal.org/node/' . mt_rand(1000, 10000);
       $values['guid'] = $this->randomString();
 
diff --git a/core/modules/basic_auth/lib/Drupal/basic_auth/Tests/Authentication/BasicAuthTest.php b/core/modules/basic_auth/lib/Drupal/basic_auth/Tests/Authentication/BasicAuthTest.php
index 134ddb2..1af2b3b 100644
--- a/core/modules/basic_auth/lib/Drupal/basic_auth/Tests/Authentication/BasicAuthTest.php
+++ b/core/modules/basic_auth/lib/Drupal/basic_auth/Tests/Authentication/BasicAuthTest.php
@@ -40,7 +40,7 @@ public function testBasicAuth() {
     $this->assertResponse('200', 'HTTP response is OK');
     $this->curlClose();
 
-    $this->basicAuthGet('router_test/test11', $account->getUsername(), $this->randomName());
+    $this->basicAuthGet('router_test/test11', $account->getUsername(), $this->randomMachineName());
     $this->assertNoText($account->getUsername(), 'Bad basic auth credentials do not authenticate the user.');
     $this->assertResponse('403', 'Access is not granted.');
     $this->curlClose();
diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockCreationTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockCreationTest.php
index 167014e..385cb70 100644
--- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockCreationTest.php
+++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockCreationTest.php
@@ -61,7 +61,7 @@ public function testCustomBlockCreation() {
     // Create a block.
     $edit = array();
     $edit['info[0][value]'] = 'Test Block';
-    $edit['body[0][value]'] = $this->randomName(16);
+    $edit['body[0][value]'] = $this->randomMachineName(16);
     $this->drupalPostForm('block/add/basic', $edit, t('Save'));
 
     // Check that the Basic block has been created.
@@ -105,8 +105,8 @@ public function testCustomBlockCreation() {
    */
   public function testDefaultCustomBlockCreation() {
     $edit = array();
-    $edit['info[0][value]'] = $this->randomName(8);
-    $edit['body[0][value]'] = $this->randomName(16);
+    $edit['info[0][value]'] = $this->randomMachineName(8);
+    $edit['body[0][value]'] = $this->randomMachineName(16);
     // Don't pass the custom block type in the url so the default is forced.
     $this->drupalPostForm('block/add', $edit, t('Save'));
 
@@ -165,8 +165,8 @@ public function testFailedBlockCreation() {
   public function testBlockDelete() {
     // Create a block.
     $edit = array();
-    $edit['info[0][value]'] = $this->randomName(8);
-    $body = $this->randomName(16);
+    $edit['info[0][value]'] = $this->randomMachineName(8);
+    $body = $this->randomMachineName(16);
     $edit['body[0][value]'] = $body;
     $this->drupalPostForm('block/add/basic', $edit, t('Save'));
 
@@ -198,8 +198,8 @@ public function testBlockDelete() {
 
     // Create another block and force the plugin cache to flush.
     $edit2 = array();
-    $edit2['info[0][value]'] = $this->randomName(8);
-    $body2 = $this->randomName(16);
+    $edit2['info[0][value]'] = $this->randomMachineName(8);
+    $body2 = $this->randomMachineName(16);
     $edit2['body[0][value]'] = $body2;
     $this->drupalPostForm('block/add/basic', $edit2, t('Save'));
 
@@ -208,8 +208,8 @@ public function testBlockDelete() {
     // Create another block with no instances, and test we don't get a
     // confirmation message about deleting instances.
     $edit3 = array();
-    $edit3['info[0][value]'] = $this->randomName(8);
-    $body = $this->randomName(16);
+    $edit3['info[0][value]'] = $this->randomMachineName(8);
+    $body = $this->randomMachineName(16);
     $edit3['body[0][value]'] = $body;
     $this->drupalPostForm('block/add/basic', $edit3, t('Save'));
 
diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockFieldTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockFieldTest.php
index 5c7d46b..81c26f0 100644
--- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockFieldTest.php
+++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockFieldTest.php
@@ -65,7 +65,7 @@ public function testBlockFields() {
 
     // Create a field with settings to validate.
     $this->field = entity_create('field_config', array(
-      'name' => drupal_strtolower($this->randomName()),
+      'name' => drupal_strtolower($this->randomMachineName()),
       'entity_type' => 'custom_block',
       'type' => 'link',
       'cardinality' => 2,
@@ -95,7 +95,7 @@ public function testBlockFields() {
     // Create a block.
     $this->drupalGet('block/add/link');
     $edit = array(
-      'info[0][value]' => $this->randomName(8),
+      'info[0][value]' => $this->randomMachineName(8),
       $this->field->getName() . '[0][url]' => 'http://example.com',
       $this->field->getName() . '[0][title]' => 'Example.com'
     );
diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockListTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockListTest.php
index 82bcb44..3a9dad1 100644
--- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockListTest.php
+++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockListTest.php
@@ -64,7 +64,7 @@ public function testListing() {
     $this->assertResponse(200);
     $edit = array();
     $edit['info[0][value]'] = $label;
-    $edit['body[0][value]'] = $this->randomName(16);
+    $edit['body[0][value]'] = $this->randomMachineName(16);
     $this->drupalPostForm(NULL, $edit, t('Save'));
 
     // Confirm that once the user returns to the listing, the text of the label
diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockRevisionsTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockRevisionsTest.php
index 75f19aa..90a3653 100644
--- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockRevisionsTest.php
+++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockRevisionsTest.php
@@ -55,7 +55,7 @@ protected function setUp() {
     $revision_count = 3;
     for ($i = 0; $i < $revision_count; $i++) {
       $block->setNewRevision(TRUE);
-      $block->setRevisionLog($this->randomName(32));
+      $block->setRevisionLog($this->randomMachineName(32));
       $logs[] = $block->getRevisionLog();
       $block->save();
       $blocks[] = $block->getRevisionId();
@@ -89,7 +89,7 @@ public function testRevisions() {
     // Save this as a non-default revision.
     $loaded->setNewRevision();
     $loaded->isDefaultRevision(FALSE);
-    $loaded->body = $this->randomName(8);
+    $loaded->body = $this->randomMachineName(8);
     $loaded->save();
 
     $this->drupalGet('block/' . $loaded->id());
diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockSaveTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockSaveTest.php
index ff0192e..b303efd 100644
--- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockSaveTest.php
+++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockSaveTest.php
@@ -48,10 +48,10 @@ public function testImport() {
     // Custom block ID must be a number that is not in the database.
     $max_id = db_query('SELECT MAX(id) FROM {custom_block}')->fetchField();
     $test_id = $max_id + mt_rand(1000, 1000000);
-    $info = $this->randomName(8);
+    $info = $this->randomMachineName(8);
     $block_array = array(
       'info' => $info,
-      'body' => array('value' => $this->randomName(32)),
+      'body' => array('value' => $this->randomMachineName(32)),
       'type' => 'basic',
       'id' => $test_id
     );
diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTestBase.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTestBase.php
index cf731fc..d7ef2d8 100644
--- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTestBase.php
+++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTestBase.php
@@ -63,7 +63,7 @@ protected function setUp() {
    *   Created custom block.
    */
   protected function createCustomBlock($title = FALSE, $bundle = 'basic') {
-    $title = ($title ? : $this->randomName());
+    $title = ($title ? : $this->randomMachineName());
     if ($custom_block = entity_create('custom_block', array(
       'info' => $title,
       'type' => $bundle,
diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTranslationUITest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTranslationUITest.php
index 761936e..c08bac8 100644
--- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTranslationUITest.php
+++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTranslationUITest.php
@@ -50,7 +50,7 @@ public static function getInfo() {
   public function setUp() {
     $this->entityTypeId = 'custom_block';
     $this->bundle = 'basic';
-    $this->name = drupal_strtolower($this->randomName());
+    $this->name = drupal_strtolower($this->randomMachineName());
     $this->testLanguageSelector = FALSE;
     parent::setUp();
   }
@@ -81,7 +81,7 @@ public function getTranslatorPermissions() {
    *   Created custom block.
    */
   protected function createCustomBlock($title = FALSE, $bundle = FALSE) {
-    $title = ($title ? : $this->randomName());
+    $title = ($title ? : $this->randomMachineName());
     $bundle = ($bundle ? : $this->bundle);
     $custom_block = entity_create('custom_block', array(
       'info' => $title,
@@ -118,7 +118,7 @@ protected function getEditValues($values, $langcode, $new = FALSE) {
    */
   public function testDisabledBundle() {
     // Create a bundle that does not have translation enabled.
-    $disabled_bundle = $this->randomName();
+    $disabled_bundle = $this->randomMachineName();
     $bundle = entity_create('custom_block_type', array(
       'id' => $disabled_bundle,
       'label' => $disabled_bundle,
diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTypeTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTypeTest.php
index 739f234..d1943c1 100644
--- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTypeTest.php
+++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTypeTest.php
@@ -178,7 +178,7 @@ public function testsCustomBlockAddTypes() {
           $this->clickLink('foo');
         }
         // Create a new block.
-        $edit = array('info[0][value]' => $this->randomName(8));
+        $edit = array('info[0][value]' => $this->randomMachineName(8));
         $this->drupalPostForm(NULL, $edit, t('Save'));
         $blocks = $storage->loadByProperties(array('info' => $edit['info[0][value]']));
         if (!empty($blocks)) {
@@ -199,7 +199,7 @@ public function testsCustomBlockAddTypes() {
     $this->drupalGet('admin/structure/block/custom-blocks');
     $this->clickLink(t('Add custom block'));
     $this->clickLink('foo');
-    $edit = array('info[0][value]' => $this->randomName(8));
+    $edit = array('info[0][value]' => $this->randomMachineName(8));
     $this->drupalPostForm(NULL, $edit, t('Save'));
     $blocks = $storage->loadByProperties(array('info' => $edit['info[0][value]']));
     if (!empty($blocks)) {
diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/PageEditTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/PageEditTest.php
index 7feb2c0..1e43626 100644
--- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/PageEditTest.php
+++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/PageEditTest.php
@@ -35,8 +35,8 @@ public function testPageEdit() {
     $body_key = 'body[0][value]';
     // Create block to edit.
     $edit = array();
-    $edit['info[0][value]'] = drupal_strtolower($this->randomName(8));
-    $edit[$body_key] = $this->randomName(16);
+    $edit['info[0][value]'] = drupal_strtolower($this->randomMachineName(8));
+    $edit[$body_key] = $this->randomMachineName(16);
     $this->drupalPostForm('block/add/basic', $edit, t('Save'));
 
     // Check that the block exists in the database.
@@ -51,16 +51,16 @@ public function testPageEdit() {
 
     // Edit the content of the block.
     $edit = array();
-    $edit[$title_key] = $this->randomName(8);
-    $edit[$body_key] = $this->randomName(16);
+    $edit[$title_key] = $this->randomMachineName(8);
+    $edit[$body_key] = $this->randomMachineName(16);
     // Stay on the current page, without reloading.
     $this->drupalPostForm(NULL, $edit, t('Save'));
 
     // Edit the same block, creating a new revision.
     $this->drupalGet("block/" . $block->id());
     $edit = array();
-    $edit['info[0][value]'] = $this->randomName(8);
-    $edit[$body_key] = $this->randomName(16);
+    $edit['info[0][value]'] = $this->randomMachineName(8);
+    $edit[$body_key] = $this->randomMachineName(16);
     $edit['revision'] = TRUE;
     $this->drupalPostForm(NULL, $edit, t('Save'));
 
diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockCacheTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockCacheTest.php
index ce78720..7315786 100644
--- a/core/modules/block/lib/Drupal/block/Tests/BlockCacheTest.php
+++ b/core/modules/block/lib/Drupal/block/Tests/BlockCacheTest.php
@@ -70,7 +70,7 @@ function testCachePerRole() {
     ));
 
     // Enable our test block. Set some content for it to display.
-    $current_content = $this->randomName();
+    $current_content = $this->randomMachineName();
     \Drupal::state()->set('block_test.content', $current_content);
     $this->drupalLogin($this->normal_user);
     $this->drupalGet('');
@@ -78,7 +78,7 @@ function testCachePerRole() {
 
     // Change the content, but the cached copy should still be served.
     $old_content = $current_content;
-    $current_content = $this->randomName();
+    $current_content = $this->randomMachineName();
     \Drupal::state()->set('block_test.content', $current_content);
     $this->drupalGet('');
     $this->assertText($old_content, 'Block is served from the cache.');
@@ -91,7 +91,7 @@ function testCachePerRole() {
 
     // Test whether the cached data is served for the correct users.
     $old_content = $current_content;
-    $current_content = $this->randomName();
+    $current_content = $this->randomMachineName();
     \Drupal::state()->set('block_test.content', $current_content);
     $this->drupalLogout();
     $this->drupalGet('');
@@ -118,14 +118,14 @@ function testCacheGlobal() {
       'max_age' => 600,
     ));
 
-    $current_content = $this->randomName();
+    $current_content = $this->randomMachineName();
     \Drupal::state()->set('block_test.content', $current_content);
 
     $this->drupalGet('');
     $this->assertText($current_content, 'Block content displays.');
 
     $old_content = $current_content;
-    $current_content = $this->randomName();
+    $current_content = $this->randomMachineName();
     \Drupal::state()->set('block_test.content', $current_content);
 
     $this->drupalLogout();
@@ -141,7 +141,7 @@ function testNoCache() {
       'max_age' => 0,
     ));
 
-    $current_content = $this->randomName();
+    $current_content = $this->randomMachineName();
     \Drupal::state()->set('block_test.content', $current_content);
 
     // If max_age = 0 has no effect, the next request would be cached.
@@ -149,7 +149,7 @@ function testNoCache() {
     $this->assertText($current_content, 'Block content displays.');
 
     // A cached copy should not be served.
-    $current_content = $this->randomName();
+    $current_content = $this->randomMachineName();
     \Drupal::state()->set('block_test.content', $current_content);
     $this->drupalGet('');
     $this->assertText($current_content, 'Maximum age of zero prevents blocks from being cached.');
@@ -164,7 +164,7 @@ function testCachePerUser() {
       'contexts' => array('cache_context.user'),
     ));
 
-    $current_content = $this->randomName();
+    $current_content = $this->randomMachineName();
     \Drupal::state()->set('block_test.content', $current_content);
     $this->drupalLogin($this->normal_user);
 
@@ -172,7 +172,7 @@ function testCachePerUser() {
     $this->assertText($current_content, 'Block content displays.');
 
     $old_content = $current_content;
-    $current_content = $this->randomName();
+    $current_content = $this->randomMachineName();
     \Drupal::state()->set('block_test.content', $current_content);
 
     $this->drupalGet('');
@@ -196,14 +196,14 @@ function testCachePerPage() {
       'contexts' => array('cache_context.url'),
     ));
 
-    $current_content = $this->randomName();
+    $current_content = $this->randomMachineName();
     \Drupal::state()->set('block_test.content', $current_content);
 
     $this->drupalGet('node');
     $this->assertText($current_content, 'Block content displays on the node page.');
 
     $old_content = $current_content;
-    $current_content = $this->randomName();
+    $current_content = $this->randomMachineName();
     \Drupal::state()->set('block_test.content', $current_content);
 
     $this->drupalGet('user');
diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockHookOperationTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockHookOperationTest.php
index 52120f1..93420b5 100644
--- a/core/modules/block/lib/Drupal/block/Tests/BlockHookOperationTest.php
+++ b/core/modules/block/lib/Drupal/block/Tests/BlockHookOperationTest.php
@@ -48,7 +48,7 @@ public function setUp() {
   public function testBlockOperationAlter() {
     // Add a test block, any block will do.
     // Set the machine name so the test_operation link can be built later.
-    $block_id = Unicode::strtolower($this->randomName(16));
+    $block_id = Unicode::strtolower($this->randomMachineName(16));
     $this->drupalPlaceBlock('system_powered_by_block', array('id' => $block_id));
 
     // Get the Block listing.
diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockHtmlTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockHtmlTest.php
index 63579b9..18ff012 100644
--- a/core/modules/block/lib/Drupal/block/Tests/BlockHtmlTest.php
+++ b/core/modules/block/lib/Drupal/block/Tests/BlockHtmlTest.php
@@ -36,7 +36,7 @@ function setUp() {
 
     // Enable the test_html block, to test HTML ID and attributes.
     \Drupal::state()->set('block_test.attributes', array('data-custom-attribute' => 'foo'));
-    \Drupal::state()->set('block_test.content', $this->randomName());
+    \Drupal::state()->set('block_test.content', $this->randomMachineName());
     $this->drupalPlaceBlock('test_html', array('id' => 'test_html_block'));
 
     // Enable a menu block, to test more complicated HTML.
diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockLanguageCacheTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockLanguageCacheTest.php
index 5fec407..096906b 100644
--- a/core/modules/block/lib/Drupal/block/Tests/BlockLanguageCacheTest.php
+++ b/core/modules/block/lib/Drupal/block/Tests/BlockLanguageCacheTest.php
@@ -71,7 +71,7 @@ public function testBlockLinks() {
     }
 
     // Create a menu in the default language.
-    $edit['label'] = $this->randomName();
+    $edit['label'] = $this->randomMachineName();
     $edit['id'] = Unicode::strtolower($edit['label']);
     $this->drupalPostForm('admin/structure/menu/add', $edit, t('Save'));
     $this->assertText(t('Menu @label has been added.', array('@label' => $edit['label'])));
diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockLanguageTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockLanguageTest.php
index 246e92c..7ce16d3 100644
--- a/core/modules/block/lib/Drupal/block/Tests/BlockLanguageTest.php
+++ b/core/modules/block/lib/Drupal/block/Tests/BlockLanguageTest.php
@@ -62,7 +62,7 @@ public function testLanguageBlockVisibility() {
     // Enable a standard block and set the visibility setting for one language.
     $edit = array(
       'visibility[language][langcodes][en]' => TRUE,
-      'id' => strtolower($this->randomName(8)),
+      'id' => strtolower($this->randomMachineName(8)),
       'region' => 'sidebar_first',
     );
     $this->drupalPostForm('admin/structure/block/add/system_powered_by_block' . '/' . $default_theme, $edit, t('Save block'));
diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php
index 37074cc..c5accb5 100644
--- a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php
+++ b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php
@@ -29,11 +29,11 @@ public static function getInfo() {
   function testBlockVisibility() {
     $block_name = 'system_powered_by_block';
     // Create a random title for the block.
-    $title = $this->randomName(8);
+    $title = $this->randomMachineName(8);
     // Enable a standard block.
     $default_theme = \Drupal::config('system.theme')->get('default');
     $edit = array(
-      'id' => strtolower($this->randomName(8)),
+      'id' => strtolower($this->randomMachineName(8)),
       'region' => 'sidebar_first',
       'settings[label]' => $title,
     );
@@ -70,11 +70,11 @@ function testBlockVisibility() {
   function testBlockVisibilityListedEmpty() {
     $block_name = 'system_powered_by_block';
     // Create a random title for the block.
-    $title = $this->randomName(8);
+    $title = $this->randomMachineName(8);
     // Enable a standard block.
     $default_theme = \Drupal::config('system.theme')->get('default');
     $edit = array(
-      'id' => strtolower($this->randomName(8)),
+      'id' => strtolower($this->randomMachineName(8)),
       'region' => 'sidebar_first',
       'settings[label]' => $title,
       'visibility[path][visibility]' => BLOCK_VISIBILITY_LISTED,
@@ -103,7 +103,7 @@ function testBlock() {
     // Select the 'Powered by Drupal' block to be configured and moved.
     $block = array();
     $block['id'] = 'system_powered_by_block';
-    $block['settings[label]'] = $this->randomName(8);
+    $block['settings[label]'] = $this->randomMachineName(8);
     $block['theme'] = \Drupal::config('system.theme')->get('default');
     $block['region'] = 'header';
 
@@ -166,7 +166,7 @@ public function testBlockThemeSelector() {
       $this->assertTitle(t('Block layout') . ' | Drupal');
       // Select the 'Powered by Drupal' block to be placed.
       $block = array();
-      $block['id'] = strtolower($this->randomName());
+      $block['id'] = strtolower($this->randomMachineName());
       $block['theme'] = $theme;
       $block['region'] = 'content';
       $this->drupalPostForm('admin/structure/block/add/system_powered_by_block', $block, t('Save block'));
@@ -187,8 +187,8 @@ public function testBlockThemeSelector() {
   function testHideBlockTitle() {
     $block_name = 'system_powered_by_block';
     // Create a random title for the block.
-    $title = $this->randomName(8);
-    $id = strtolower($this->randomName(8));
+    $title = $this->randomMachineName(8);
+    $id = strtolower($this->randomMachineName(8));
     // Enable a standard block.
     $default_theme = \Drupal::config('system.theme')->get('default');
     $edit = array(
diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockTitleXSSTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockTitleXSSTest.php
index f185f58..ac6fc51 100644
--- a/core/modules/block/lib/Drupal/block/Tests/BlockTitleXSSTest.php
+++ b/core/modules/block/lib/Drupal/block/Tests/BlockTitleXSSTest.php
@@ -39,7 +39,7 @@ protected function setUp() {
    * Test XSS in title.
    */
   function testXSSInTitle() {
-    \Drupal::state()->set('block_test.content', $this->randomName());
+    \Drupal::state()->set('block_test.content', $this->randomMachineName());
     $this->drupalGet('');
     $this->assertNoRaw('<script>alert("XSS label");</script>', 'The block title was properly sanitized when rendered.');
 
diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockViewBuilderTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockViewBuilderTest.php
index d4066b0..cfaadd0 100644
--- a/core/modules/block/lib/Drupal/block/Tests/BlockViewBuilderTest.php
+++ b/core/modules/block/lib/Drupal/block/Tests/BlockViewBuilderTest.php
@@ -227,7 +227,7 @@ public function testBlockViewBuilderAlter() {
     $this->setBlockCacheConfig(array(
       'max_age' => 600,
     ));
-    $alter_add_key = $this->randomName();
+    $alter_add_key = $this->randomMachineName();
     \Drupal::state()->set('block_test_view_alter_cache_key', $alter_add_key);
     $expected_keys = array_merge($default_keys, array($alter_add_key));
     $build = $this->getBlockRenderArray();
@@ -241,7 +241,7 @@ public function testBlockViewBuilderAlter() {
     $this->container->get('cache.render')->delete($cid);
 
     // Advanced: cached block, but an alter hook adds an additional cache tag.
-    $alter_add_tag = $this->randomName();
+    $alter_add_tag = $this->randomMachineName();
     \Drupal::state()->set('block_test_view_alter_cache_tag', $alter_add_tag);
     $expected_tags = NestedArray::mergeDeep($default_tags, array($alter_add_tag => TRUE));
     $build = $this->getBlockRenderArray();
diff --git a/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php b/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php
index c544960..17df694 100644
--- a/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php
+++ b/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php
@@ -37,15 +37,15 @@ function testNewDefaultThemeBlocks() {
 
     // Add two instances of the user login block.
     $this->drupalPlaceBlock('user_login_block', array(
-      'id' => $default_theme . '_' . strtolower($this->randomName(8)),
+      'id' => $default_theme . '_' . strtolower($this->randomMachineName(8)),
     ));
     $this->drupalPlaceBlock('user_login_block', array(
-      'id' => $default_theme . '_' . strtolower($this->randomName(8)),
+      'id' => $default_theme . '_' . strtolower($this->randomMachineName(8)),
     ));
 
     // Add an instance of a different block.
     $this->drupalPlaceBlock('system_powered_by_block', array(
-      'id' => $default_theme . '_' . strtolower($this->randomName(8)),
+      'id' => $default_theme . '_' . strtolower($this->randomMachineName(8)),
     ));
 
     // Enable a different theme.
diff --git a/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php b/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php
index ca906ea..5c3c50d 100644
--- a/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php
+++ b/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php
@@ -59,7 +59,7 @@ public function testBlockCategory() {
     // Create a new view in the UI.
     $edit = array();
     $edit['label'] = $this->randomString();
-    $edit['id'] = strtolower($this->randomName());
+    $edit['id'] = strtolower($this->randomMachineName());
     $edit['show[wizard_key]'] = 'standard:views_test_data';
     $edit['description'] = $this->randomString();
     $edit['block[create]'] = TRUE;
diff --git a/core/modules/block/tests/Drupal/block/Tests/BlockConfigEntityUnitTest.php b/core/modules/block/tests/Drupal/block/Tests/BlockConfigEntityUnitTest.php
index 98d8d6d..9db3a81 100644
--- a/core/modules/block/tests/Drupal/block/Tests/BlockConfigEntityUnitTest.php
+++ b/core/modules/block/tests/Drupal/block/Tests/BlockConfigEntityUnitTest.php
@@ -62,7 +62,7 @@ public static function getInfo() {
    * {@inheritdoc}
    */
   public function setUp() {
-    $this->entityTypeId = $this->randomName();
+    $this->entityTypeId = $this->randomMachineName();
 
     $this->entityType = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
     $this->entityType->expects($this->any())
@@ -94,7 +94,7 @@ public function testCalculateDependencies() {
       ->setMethods(array('getPluginBag'))
       ->getMock();
     // Create a configurable plugin that would add a dependency.
-    $instance_id = $this->randomName();
+    $instance_id = $this->randomMachineName();
     $instance = new TestConfigurablePlugin(array(), $instance_id, array('provider' => 'test'));
 
     // Create a plugin bag to contain the instance.
diff --git a/core/modules/book/lib/Drupal/book/Tests/BookTest.php b/core/modules/book/lib/Drupal/book/Tests/BookTest.php
index cfd7559..f08a5f8 100644
--- a/core/modules/book/lib/Drupal/book/Tests/BookTest.php
+++ b/core/modules/book/lib/Drupal/book/Tests/BookTest.php
@@ -261,8 +261,8 @@ function createBookNode($book_nid, $parent = NULL) {
     static $number = 0; // Used to ensure that when sorted nodes stay in same order.
 
     $edit = array();
-    $edit['title[0][value]'] = $number . ' - SimpleTest test node ' . $this->randomName(10);
-    $edit['body[0][value]'] = 'SimpleTest test body ' . $this->randomName(32) . ' ' . $this->randomName(32);
+    $edit['title[0][value]'] = $number . ' - SimpleTest test node ' . $this->randomMachineName(10);
+    $edit['body[0][value]'] = 'SimpleTest test body ' . $this->randomMachineName(32) . ' ' . $this->randomMachineName(32);
     $edit['book[bid]'] = $book_nid;
 
     if ($parent !== NULL) {
diff --git a/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointAPITest.php b/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointAPITest.php
index e132280..2e6a374 100644
--- a/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointAPITest.php
+++ b/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointAPITest.php
@@ -31,7 +31,7 @@ public static function getInfo() {
   public function testConfigName() {
     // Try an invalid sourceType.
     $breakpoint = entity_create('breakpoint', array(
-      'label' => drupal_strtolower($this->randomName()),
+      'label' => drupal_strtolower($this->randomMachineName()),
       'source' => 'custom_module',
       'sourceType' => 'oops',
     ));
@@ -62,7 +62,7 @@ public function testConfigName() {
     // Try an invalid name (make sure there is at least once capital letter).
     $breakpoint = $breakpoint->createDuplicate();
     $breakpoint->source = 'custom_module';
-    $breakpoint->name = drupal_ucfirst($this->randomName());
+    $breakpoint->name = drupal_ucfirst($this->randomMachineName());
 
     $exception = FALSE;
     try {
@@ -75,7 +75,7 @@ public function testConfigName() {
 
     // Try a valid breakpoint.
     $breakpoint = $breakpoint->createDuplicate();
-    $breakpoint->name = drupal_strtolower($this->randomName());
+    $breakpoint->name = drupal_strtolower($this->randomMachineName());
     $breakpoint->mediaQuery = 'all';
 
     $exception = FALSE;
diff --git a/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointCRUDTest.php b/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointCRUDTest.php
index 4358869..0890fc2 100644
--- a/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointCRUDTest.php
+++ b/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointCRUDTest.php
@@ -28,7 +28,7 @@ public static function getInfo() {
   public function testBreakpointCRUD() {
     // Add a breakpoint with minimum data only.
     $breakpoint = entity_create('breakpoint', array(
-      'label' => drupal_strtolower($this->randomName()),
+      'label' => drupal_strtolower($this->randomMachineName()),
       'mediaQuery' => '(min-width: 600px)',
     ));
     $breakpoint->save();
diff --git a/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointGroupAPITest.php b/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointGroupAPITest.php
index 7a563f6..d7a0d08 100644
--- a/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointGroupAPITest.php
+++ b/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointGroupAPITest.php
@@ -31,7 +31,7 @@ public static function getInfo() {
    */
   public function testConfigName() {
     // Try an invalid sourceType.
-    $label = $this->randomName();
+    $label = $this->randomMachineName();
     $breakpoint_group = entity_create('breakpoint_group', array(
       'label' => $label,
       'name' => drupal_strtolower($label),
diff --git a/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointGroupCRUDTest.php b/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointGroupCRUDTest.php
index e9eeb00..d056402 100644
--- a/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointGroupCRUDTest.php
+++ b/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointGroupCRUDTest.php
@@ -32,7 +32,7 @@ public function testBreakpointGroupCRUD() {
     for ($i = 0; $i <= 3; $i++) {
       $width = ($i + 1) * 200;
       $breakpoint = entity_create('breakpoint', array(
-        'name' => drupal_strtolower($this->randomName()),
+        'name' => drupal_strtolower($this->randomMachineName()),
         'weight' => $i,
         'mediaQuery' => "(min-width: {$width}px)",
       ));
@@ -40,7 +40,7 @@ public function testBreakpointGroupCRUD() {
       $breakpoints[$breakpoint->id()] = $breakpoint;
     }
     // Add a breakpoint group with minimum data only.
-    $label = $this->randomName();
+    $label = $this->randomMachineName();
 
     $group = entity_create('breakpoint_group', array(
       'label' => $label,
diff --git a/core/modules/breakpoint/tests/Drupal/breakpoint/Tests/BreakpointConfigEntityUnitTest.php b/core/modules/breakpoint/tests/Drupal/breakpoint/Tests/BreakpointConfigEntityUnitTest.php
index 68ff25a..d2fff92 100644
--- a/core/modules/breakpoint/tests/Drupal/breakpoint/Tests/BreakpointConfigEntityUnitTest.php
+++ b/core/modules/breakpoint/tests/Drupal/breakpoint/Tests/BreakpointConfigEntityUnitTest.php
@@ -70,7 +70,7 @@ public static function getInfo() {
    * {@inheritdoc}
    */
   public function setUp() {
-    $this->entityTypeId = $this->randomName();
+    $this->entityTypeId = $this->randomMachineName();
 
     $this->entityType = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
     $this->entityType->expects($this->any())
diff --git a/core/modules/breakpoint/tests/Drupal/breakpoint/Tests/BreakpointGroupConfigEntityUnitTest.php b/core/modules/breakpoint/tests/Drupal/breakpoint/Tests/BreakpointGroupConfigEntityUnitTest.php
index 6587e90..9a6ff9a 100644
--- a/core/modules/breakpoint/tests/Drupal/breakpoint/Tests/BreakpointGroupConfigEntityUnitTest.php
+++ b/core/modules/breakpoint/tests/Drupal/breakpoint/Tests/BreakpointGroupConfigEntityUnitTest.php
@@ -70,7 +70,7 @@ public static function getInfo() {
    * {@inheritdoc}
    */
   public function setUp() {
-    $this->entityTypeId = $this->randomName();
+    $this->entityTypeId = $this->randomMachineName();
 
     $this->entityType = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
     $this->entityType->expects($this->any())
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentActionsTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentActionsTest.php
index 667d278..092f01f 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentActionsTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentActionsTest.php
@@ -34,8 +34,8 @@ public static function getInfo() {
    */
   function testCommentPublishUnpublishActions() {
     $this->drupalLogin($this->web_user);
-    $comment_text = $this->randomName();
-    $subject = $this->randomName();
+    $comment_text = $this->randomMachineName();
+    $subject = $this->randomMachineName();
     $comment = $this->postComment($this->node, $comment_text, $subject);
 
     // Unpublish a comment.
@@ -54,11 +54,11 @@ function testCommentPublishUnpublishActions() {
    */
   function testCommentUnpublishByKeyword() {
     $this->drupalLogin($this->admin_user);
-    $keyword_1 = $this->randomName();
-    $keyword_2 = $this->randomName();
+    $keyword_1 = $this->randomMachineName();
+    $keyword_2 = $this->randomMachineName();
     $action = entity_create('action', array(
       'id' => 'comment_unpublish_by_keyword_action',
-      'label' => $this->randomName(),
+      'label' => $this->randomMachineName(),
       'type' => 'comment',
       'configuration' => array(
         'keywords' => array($keyword_1, $keyword_2),
@@ -67,7 +67,7 @@ function testCommentUnpublishByKeyword() {
     ));
     $action->save();
 
-    $comment = $this->postComment($this->node, $keyword_2, $this->randomName());
+    $comment = $this->postComment($this->node, $keyword_2, $this->randomMachineName());
 
     // Load the full comment so that status is available.
     $comment = comment_load($comment->id());
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentAdminTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentAdminTest.php
index 4f2f211..fb1338f 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentAdminTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentAdminTest.php
@@ -39,8 +39,8 @@ function testApprovalAdminInterface() {
     $this->drupalLogout();
 
     // Post anonymous comment without contact info.
-    $subject = $this->randomName();
-    $body = $this->randomName();
+    $subject = $this->randomMachineName();
+    $body = $this->randomMachineName();
     $this->postComment($this->node, $body, $subject, TRUE); // Set $contact to true so that it won't check for id and message.
     $this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), 'Comment requires approval.');
 
@@ -68,8 +68,8 @@ function testApprovalAdminInterface() {
     $this->assertTrue($this->commentExists($anonymous_comment4), 'Anonymous comment visible.');
 
     // Post 2 anonymous comments without contact info.
-    $comments[] = $this->postComment($this->node, $this->randomName(), $this->randomName(), TRUE);
-    $comments[] = $this->postComment($this->node, $this->randomName(), $this->randomName(), TRUE);
+    $comments[] = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName(), TRUE);
+    $comments[] = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName(), TRUE);
 
     // Publish multiple comments in one operation.
     $this->drupalLogin($this->admin_user);
@@ -116,8 +116,8 @@ function testApprovalNodeInterface() {
     $this->drupalLogout();
 
     // Post anonymous comment without contact info.
-    $subject = $this->randomName();
-    $body = $this->randomName();
+    $subject = $this->randomMachineName();
+    $body = $this->randomMachineName();
     $this->postComment($this->node, $body, $subject, TRUE); // Set $contact to true so that it won't check for id and message.
     $this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), 'Comment requires approval.');
 
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentAnonymousTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentAnonymousTest.php
index f71619b..d07b2f0 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentAnonymousTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentAnonymousTest.php
@@ -45,7 +45,7 @@ function testAnonymous() {
     $this->drupalLogout();
 
     // Post anonymous comment without contact info.
-    $anonymous_comment1 = $this->postComment($this->node, $this->randomName(), $this->randomName());
+    $anonymous_comment1 = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName());
     $this->assertTrue($this->commentExists($anonymous_comment1), 'Anonymous comment without contact info found.');
 
     // Allow contact info.
@@ -54,7 +54,7 @@ function testAnonymous() {
 
     // Attempt to edit anonymous comment.
     $this->drupalGet('comment/' . $anonymous_comment1->id() . '/edit');
-    $edited_comment = $this->postComment(NULL, $this->randomName(), $this->randomName());
+    $edited_comment = $this->postComment(NULL, $this->randomMachineName(), $this->randomMachineName());
     $this->assertTrue($this->commentExists($edited_comment, FALSE), 'Modified reply found.');
     $this->drupalLogout();
 
@@ -62,15 +62,15 @@ function testAnonymous() {
     $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment');
     $this->assertTrue($this->commentContactInfoAvailable(), 'Contact information available.');
 
-    $anonymous_comment2 = $this->postComment($this->node, $this->randomName(), $this->randomName());
+    $anonymous_comment2 = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName());
     $this->assertTrue($this->commentExists($anonymous_comment2), 'Anonymous comment with contact info (optional) found.');
 
     // Ensure anonymous users cannot post in the name of registered users.
     $edit = array(
       'name' => $this->admin_user->getUsername(),
-      'mail' => $this->randomName() . '@example.com',
-      'subject' => $this->randomName(),
-      'comment_body[0][value]' => $this->randomName(),
+      'mail' => $this->randomMachineName() . '@example.com',
+      'subject' => $this->randomMachineName(),
+      'comment_body[0][value]' => $this->randomMachineName(),
     );
     $this->drupalPostForm('comment/reply/node/' . $this->node->id() . '/comment', $edit, t('Save'));
     $this->assertText(t('The name you used belongs to a registered user.'));
@@ -84,15 +84,15 @@ function testAnonymous() {
     $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment');
     $this->assertTrue($this->commentContactInfoAvailable(), 'Contact information available.');
 
-    $anonymous_comment3 = $this->postComment($this->node, $this->randomName(), $this->randomName(), TRUE);
+    $anonymous_comment3 = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName(), TRUE);
     // Name should have 'Anonymous' for value by default.
     $this->assertText(t('E-mail field is required.'), 'E-mail required.');
     $this->assertFalse($this->commentExists($anonymous_comment3), 'Anonymous comment with contact info (required) not found.');
 
     // Post comment with contact info (required).
-    $author_name = $this->randomName();
-    $author_mail = $this->randomName() . '@example.com';
-    $anonymous_comment3 = $this->postComment($this->node, $this->randomName(), $this->randomName(), array('name' => $author_name, 'mail' => $author_mail));
+    $author_name = $this->randomMachineName();
+    $author_mail = $this->randomMachineName() . '@example.com';
+    $anonymous_comment3 = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName(), array('name' => $author_name, 'mail' => $author_mail));
     $this->assertTrue($this->commentExists($anonymous_comment3), 'Anonymous comment with contact info (required) found.');
 
     // Make sure the user data appears correctly when editing the comment.
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentBlockTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentBlockTest.php
index a7b28a7..50b0b6c 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentBlockTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentBlockTest.php
@@ -55,8 +55,8 @@ function testRecentCommentBlock() {
     // below.
     $timestamp = REQUEST_TIME;
     for ($i = 0; $i < 11; ++$i) {
-      $subject = ($i % 2) ? $this->randomName() : '';
-      $comments[$i] = $this->postComment($this->node, $this->randomName(), $subject);
+      $subject = ($i % 2) ? $this->randomMachineName() : '';
+      $comments[$i] = $this->postComment($this->node, $this->randomMachineName(), $subject);
       $comments[$i]->created->value = $timestamp--;
       $comments[$i]->save();
     }
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentBookTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentBookTest.php
index 4d92e9d..ba2b147 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentBookTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentBookTest.php
@@ -49,8 +49,8 @@ public function testBookCommentPrint() {
     $book_node->book['bid'] = 'new';
     $book_node->save();
 
-    $comment_subject = $this->randomName(8);
-    $comment_body = $this->randomName(8);
+    $comment_subject = $this->randomMachineName(8);
+    $comment_body = $this->randomMachineName(8);
     $comment = entity_create('comment', array(
       'subject' => $comment_subject,
       'comment_body' => $comment_body,
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php
index 8c2df9b..8102f77 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php
@@ -58,9 +58,9 @@ function testCommentClasses() {
         'field_name' => 'comment',
         'uid' => $case['comment_uid'],
         'status' => $case['comment_status'],
-        'subject' => $this->randomName(),
+        'subject' => $this->randomMachineName(),
         'language' => Language::LANGCODE_NOT_SPECIFIED,
-        'comment_body' => array(Language::LANGCODE_NOT_SPECIFIED => array($this->randomName())),
+        'comment_body' => array(Language::LANGCODE_NOT_SPECIFIED => array($this->randomMachineName())),
       ));
       $comment->save();
 
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentContentRebuildTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentContentRebuildTest.php
index c467a09..fd6e9ec 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentContentRebuildTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentContentRebuildTest.php
@@ -31,8 +31,8 @@ function testCommentRebuild() {
 
     // Log in as the web user and add the comment.
     $this->drupalLogin($this->web_user);
-    $subject_text = $this->randomName();
-    $comment_text = $this->randomName();
+    $subject_text = $this->randomMachineName();
+    $comment_text = $this->randomMachineName();
     $comment = $this->postComment($this->node, $comment_text, $subject_text, TRUE);
     $this->assertTrue($this->commentExists($comment), 'Comment found.');
 
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php
index 24a20a9..a142261 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php
@@ -119,7 +119,7 @@ function testCommentInstallAfterContentModule() {
     // asserting that the body is actually posted correctly.
     $this->web_user = $this->drupalCreateUser(array('access content', 'access comments', 'post comments', 'skip comment approval'));
     $this->drupalLogin($this->web_user);
-    $this->postComment($book_node, $this->randomName(), $this->randomName());
+    $this->postComment($book_node, $this->randomMachineName(), $this->randomMachineName());
   }
 
   /**
@@ -139,7 +139,7 @@ function testCommentFormat() {
 
     // Post a comment without an explicit subject.
     $this->drupalLogin($this->web_user);
-    $edit = array('comment_body[0][value]' => $this->randomName(8));
+    $edit = array('comment_body[0][value]' => $this->randomMachineName(8));
     $this->drupalPostForm('node/' . $this->node->id(), $edit, t('Save'));
   }
 }
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php
index 42157e1..7a3e340 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php
@@ -37,7 +37,7 @@ function testCommentInterface() {
 
     // Post comment #1 without subject or preview.
     $this->drupalLogin($this->web_user);
-    $comment_text = $this->randomName();
+    $comment_text = $this->randomMachineName();
     $comment = $this->postComment($this->node, $comment_text);
     $this->assertTrue($this->commentExists($comment), 'Comment found.');
 
@@ -50,15 +50,15 @@ function testCommentInterface() {
 
     // Create comment #2 that allows subject and requires preview.
     $this->drupalLogin($this->web_user);
-    $subject_text = $this->randomName();
-    $comment_text = $this->randomName();
+    $subject_text = $this->randomMachineName();
+    $comment_text = $this->randomMachineName();
     $comment = $this->postComment($this->node, $comment_text, $subject_text, TRUE);
     $this->assertTrue($this->commentExists($comment), 'Comment found.');
 
     // Comment as anonymous with preview required.
     $this->drupalLogout();
     user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access content', 'access comments', 'post comments', 'skip comment approval'));
-    $anonymous_comment = $this->postComment($this->node, $this->randomName(), $this->randomName(), TRUE);
+    $anonymous_comment = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName(), TRUE);
     $this->assertTrue($this->commentExists($anonymous_comment), 'Comment found.');
     $anonymous_comment->delete();
 
@@ -84,7 +84,7 @@ function testCommentInterface() {
     $this->assertTrue($comment->getAuthorName() == t('Anonymous') && $comment->getOwnerId() == 0, 'Comment author successfully changed to anonymous.');
 
     // Test changing the comment author to an unverified user.
-    $random_name = $this->randomName();
+    $random_name = $this->randomMachineName();
     $this->drupalGet('comment/' . $comment->id() . '/edit');
     $comment = $this->postComment(NULL, $comment->comment_body->value, $comment->getSubject(), array('name' => $random_name));
     $this->drupalGet('node/' . $this->node->id());
@@ -108,7 +108,7 @@ function testCommentInterface() {
     $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $comment->id());
     $this->assertText($subject_text, 'Individual comment-reply subject found.');
     $this->assertText($comment_text, 'Individual comment-reply body found.');
-    $reply = $this->postComment(NULL, $this->randomName(), '', TRUE);
+    $reply = $this->postComment(NULL, $this->randomMachineName(), '', TRUE);
     $reply_loaded = comment_load($reply->id());
     $this->assertTrue($this->commentExists($reply, TRUE), 'Reply found.');
     $this->assertEqual($comment->id(), $reply_loaded->getParentComment()->id(), 'Pid of a reply to a comment is set correctly.');
@@ -119,7 +119,7 @@ function testCommentInterface() {
     $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $comment->id());
     $this->assertText($comment->getSubject(), 'Individual comment-reply subject found.');
     $this->assertText($comment->comment_body->value, 'Individual comment-reply body found.');
-    $reply = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
+    $reply = $this->postComment(NULL, $this->randomMachineName(), $this->randomMachineName(), TRUE);
     $reply_loaded = comment_load($reply->id());
     $this->assertTrue($this->commentExists($reply, TRUE), 'Second reply found.');
     // Check the thread of second reply grows correctly.
@@ -129,7 +129,7 @@ function testCommentInterface() {
     $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $reply_loaded->id());
     $this->assertText($reply_loaded->getSubject(), 'Individual comment-reply subject found.');
     $this->assertText($reply_loaded->comment_body->value, 'Individual comment-reply body found.');
-    $reply = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
+    $reply = $this->postComment(NULL, $this->randomMachineName(), $this->randomMachineName(), TRUE);
     $reply_loaded = comment_load($reply->id());
     $this->assertTrue($this->commentExists($reply, TRUE), 'Second reply found.');
     // Check the thread of reply to second reply grows correctly.
@@ -137,12 +137,12 @@ function testCommentInterface() {
 
     // Edit reply.
     $this->drupalGet('comment/' . $reply->id() . '/edit');
-    $reply = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
+    $reply = $this->postComment(NULL, $this->randomMachineName(), $this->randomMachineName(), TRUE);
     $this->assertTrue($this->commentExists($reply, TRUE), 'Modified reply found.');
 
     // Confirm a new comment is posted to the correct page.
     $this->setCommentsPerPage(2);
-    $comment_new_page = $this->postComment($this->node, $this->randomName(), $this->randomName(), TRUE);
+    $comment_new_page = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName(), TRUE);
     $this->assertTrue($this->commentExists($comment_new_page), 'Page one exists. %s');
     $this->drupalGet('node/' . $this->node->id(), array('query' => array('page' => 2)));
     $this->assertTrue($this->commentExists($reply, TRUE), 'Page two exists. %s');
@@ -193,7 +193,7 @@ function testCommentInterface() {
     // Submit comment through node form.
     $this->drupalLogin($this->web_user);
     $this->drupalGet('node/' . $this->node->id());
-    $form_comment = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
+    $form_comment = $this->postComment(NULL, $this->randomMachineName(), $this->randomMachineName(), TRUE);
     $this->assertTrue($this->commentExists($form_comment), 'Form comment found.');
 
     // Disable comment form on node page.
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php
index 139bf73..805879e 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php
@@ -93,10 +93,10 @@ function testCommentLanguage() {
     // only content language has to.
     foreach ($this->container->get('language_manager')->getLanguages() as $node_langcode => $node_language) {
       // Create "Article" content.
-      $title = $this->randomName();
+      $title = $this->randomMachineName();
       $edit = array(
         'title[0][value]' => $title,
-        'body[0][value]' => $this->randomName(),
+        'body[0][value]' => $this->randomMachineName(),
         'langcode' => $node_langcode,
         'comment[0][status]' => CommentItemInterface::OPEN,
       );
@@ -107,9 +107,9 @@ function testCommentLanguage() {
       foreach ($this->container->get('language_manager')->getLanguages() as $langcode => $language) {
         // Post a comment with content language $langcode.
         $prefix = empty($prefixes[$langcode]) ? '' : $prefixes[$langcode] . '/';
-        $comment_values[$node_langcode][$langcode] = $this->randomName();
+        $comment_values[$node_langcode][$langcode] = $this->randomMachineName();
         $edit = array(
-          'subject' => $this->randomName(),
+          'subject' => $this->randomMachineName(),
           'comment_body[0][value]' => $comment_values[$node_langcode][$langcode],
         );
         $this->drupalPostForm($prefix . 'node/' . $node->id(), $edit, t('Preview'));
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksAlterTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksAlterTest.php
index be11b76..fb8a2a3 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksAlterTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksAlterTest.php
@@ -34,8 +34,8 @@ public function setUp() {
    */
   public function testCommentLinksAlter() {
     $this->drupalLogin($this->web_user);
-    $comment_text = $this->randomName();
-    $subject = $this->randomName();
+    $comment_text = $this->randomMachineName();
+    $subject = $this->randomMachineName();
     $comment = $this->postComment($this->node, $comment_text, $subject);
 
     $this->drupalGet('node/' . $this->node->id());
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php
index cf7af82..44f74da 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php
@@ -150,10 +150,10 @@ function setEnvironment(array $info) {
           'pid' => 0,
           'uid' => 0,
           'status' => CommentInterface::PUBLISHED,
-          'subject' => $this->randomName(),
+          'subject' => $this->randomMachineName(),
           'hostname' => '127.0.0.1',
           'langcode' => Language::LANGCODE_NOT_SPECIFIED,
-          'comment_body' => array(Language::LANGCODE_NOT_SPECIFIED => array($this->randomName())),
+          'comment_body' => array(Language::LANGCODE_NOT_SPECIFIED => array($this->randomMachineName())),
         ));
         $comment->save();
         $this->comment = $comment;
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentNewIndicatorTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentNewIndicatorTest.php
index 2a3a957..28b4510 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentNewIndicatorTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentNewIndicatorTest.php
@@ -98,10 +98,10 @@ public function testCommentNewCommentsIndicator() {
       'pid' => 0,
       'uid' => $this->loggedInUser->id(),
       'status' => CommentInterface::PUBLISHED,
-      'subject' => $this->randomName(),
+      'subject' => $this->randomMachineName(),
       'hostname' => '127.0.0.1',
       'langcode' => Language::LANGCODE_NOT_SPECIFIED,
-      'comment_body' => array(Language::LANGCODE_NOT_SPECIFIED => array($this->randomName())),
+      'comment_body' => array(Language::LANGCODE_NOT_SPECIFIED => array($this->randomMachineName())),
     ));
     $comment->save();
     $this->drupalLogout();
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentNodeAccessTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentNodeAccessTest.php
index a3eba40..d5abe74 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentNodeAccessTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentNodeAccessTest.php
@@ -65,8 +65,8 @@ function testThreadedCommentView() {
 
     // Post comment.
     $this->drupalLogin($this->web_user);
-    $comment_text = $this->randomName();
-    $comment_subject = $this->randomName();
+    $comment_text = $this->randomMachineName();
+    $comment_subject = $this->randomMachineName();
     $comment = $this->postComment($this->node, $comment_text, $comment_subject);
     $this->assertTrue($this->commentExists($comment), 'Comment found.');
 
@@ -77,8 +77,8 @@ function testThreadedCommentView() {
 
     // Reply to comment, creating second comment.
     $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $comment->id());
-    $reply_text = $this->randomName();
-    $reply_subject = $this->randomName();
+    $reply_text = $this->randomMachineName();
+    $reply_subject = $this->randomMachineName();
     $reply = $this->postComment(NULL, $reply_text, $reply_subject, TRUE);
     $this->assertTrue($this->commentExists($reply, TRUE), 'Reply found.');
 
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentNodeChangesTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentNodeChangesTest.php
index a6c8129..f5fd593 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentNodeChangesTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentNodeChangesTest.php
@@ -25,7 +25,7 @@ public static function getInfo() {
    */
   function testNodeDeletion() {
     $this->drupalLogin($this->web_user);
-    $comment = $this->postComment($this->node, $this->randomName(), $this->randomName());
+    $comment = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName());
     $this->assertTrue($comment->id(), 'The comment could be loaded.');
     $this->node->delete();
     $this->assertFalse(comment_load($comment->id()), 'The comment could not be loaded after the node was deleted.');
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentNonNodeTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentNonNodeTest.php
index d4af65e..0d443ed 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentNonNodeTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentNonNodeTest.php
@@ -65,7 +65,7 @@ function setUp() {
     ));
 
     // Create a test entity.
-    $random_label = $this->randomName();
+    $random_label = $this->randomMachineName();
     $data = array('type' => 'entity_test', 'name' => $random_label);
     $this->entity = entity_create('entity_test', $data);
     $this->entity->save();
@@ -240,7 +240,7 @@ function testCommentFunctionality() {
     $this->drupalLogin($this->admin_user);
 
     // Post a comment.
-    $comment1 = $this->postComment($this->entity, $this->randomName(), $this->randomName());
+    $comment1 = $this->postComment($this->entity, $this->randomMachineName(), $this->randomMachineName());
     $this->assertTrue($this->commentExists($comment1), 'Comment on test entity exists.');
 
     // Assert the breadcrumb is valid.
@@ -263,7 +263,7 @@ function testCommentFunctionality() {
     $this->assertNoRaw('comments[' . $comment1->id() . ']', 'Comment was deleted.');
 
     // Post another comment.
-    $comment1 = $this->postComment($this->entity, $this->randomName(), $this->randomName());
+    $comment1 = $this->postComment($this->entity, $this->randomMachineName(), $this->randomMachineName());
     $this->assertTrue($this->commentExists($comment1), 'Comment on test entity exists.');
 
     // Check that the comment was found.
@@ -363,7 +363,7 @@ function testCommentFunctionality() {
     $this->assertRaw(t('Saved %name configuration', array('%name' => 'Foobar')));
 
     // Test the new entity commenting inherits default.
-    $random_label = $this->randomName();
+    $random_label = $this->randomMachineName();
     $data = array('bundle' => 'entity_test', 'name' => $random_label);
     $new_entity = entity_create('entity_test', $data);
     $new_entity->save();
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentPagerTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentPagerTest.php
index d1e447bf..aae7bc4 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentPagerTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentPagerTest.php
@@ -33,9 +33,9 @@ function testCommentPaging() {
     // Create a node and three comments.
     $node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1));
     $comments = array();
-    $comments[] = $this->postComment($node, $this->randomName(), $this->randomName(), TRUE);
-    $comments[] = $this->postComment($node, $this->randomName(), $this->randomName(), TRUE);
-    $comments[] = $this->postComment($node, $this->randomName(), $this->randomName(), TRUE);
+    $comments[] = $this->postComment($node, $this->randomMachineName(), $this->randomMachineName(), TRUE);
+    $comments[] = $this->postComment($node, $this->randomMachineName(), $this->randomMachineName(), TRUE);
+    $comments[] = $this->postComment($node, $this->randomMachineName(), $this->randomMachineName(), TRUE);
 
     $this->setCommentSettings('default_mode', COMMENT_MODE_FLAT, 'Comment paging changed.');
 
@@ -66,7 +66,7 @@ function testCommentPaging() {
     // Post a reply to the oldest comment and test again.
     $oldest_comment = reset($comments);
     $this->drupalGet('comment/reply/node/' . $node->id() . '/comment/' . $oldest_comment->id());
-    $reply = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
+    $reply = $this->postComment(NULL, $this->randomMachineName(), $this->randomMachineName(), TRUE);
 
     $this->setCommentsPerPage(2);
     // We are still in flat view - the replies should not be on the first page,
@@ -84,7 +84,7 @@ function testCommentPaging() {
 
     // If (# replies > # comments per page) in threaded expanded view,
     // the overage should be bumped.
-    $reply2 = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
+    $reply2 = $this->postComment(NULL, $this->randomMachineName(), $this->randomMachineName(), TRUE);
     $this->drupalGet('node/' . $node->id(), array('query' => array('page' => 0)));
     $this->assertFalse($this->commentExists($reply2, TRUE), 'In threaded mode where # replies > # comments per page, the newest reply does not appear on page 1.');
 
@@ -108,25 +108,25 @@ function testCommentOrderingThreading() {
     // Create a node and three comments.
     $node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1));
     $comments = array();
-    $comments[] = $this->postComment($node, $this->randomName(), $this->randomName(), TRUE);
-    $comments[] = $this->postComment($node, $this->randomName(), $this->randomName(), TRUE);
-    $comments[] = $this->postComment($node, $this->randomName(), $this->randomName(), TRUE);
+    $comments[] = $this->postComment($node, $this->randomMachineName(), $this->randomMachineName(), TRUE);
+    $comments[] = $this->postComment($node, $this->randomMachineName(), $this->randomMachineName(), TRUE);
+    $comments[] = $this->postComment($node, $this->randomMachineName(), $this->randomMachineName(), TRUE);
 
     // Post a reply to the second comment.
     $this->drupalGet('comment/reply/node/' . $node->id() . '/comment/' . $comments[1]->id());
-    $comments[] = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
+    $comments[] = $this->postComment(NULL, $this->randomMachineName(), $this->randomMachineName(), TRUE);
 
     // Post a reply to the first comment.
     $this->drupalGet('comment/reply/node/' . $node->id() . '/comment/' . $comments[0]->id());
-    $comments[] = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
+    $comments[] = $this->postComment(NULL, $this->randomMachineName(), $this->randomMachineName(), TRUE);
 
     // Post a reply to the last comment.
     $this->drupalGet('comment/reply/node/' . $node->id() . '/comment/' . $comments[2]->id());
-    $comments[] = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
+    $comments[] = $this->postComment(NULL, $this->randomMachineName(), $this->randomMachineName(), TRUE);
 
     // Post a reply to the second comment.
     $this->drupalGet('comment/reply/node/' . $node->id() . '/comment/' . $comments[3]->id());
-    $comments[] = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
+    $comments[] = $this->postComment(NULL, $this->randomMachineName(), $this->randomMachineName(), TRUE);
 
     // At this point, the comment tree is:
     // - 0
@@ -208,21 +208,21 @@ function testCommentNewPageIndicator() {
     // Create a node and three comments.
     $node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1));
     $comments = array();
-    $comments[] = $this->postComment($node, $this->randomName(), $this->randomName(), TRUE);
-    $comments[] = $this->postComment($node, $this->randomName(), $this->randomName(), TRUE);
-    $comments[] = $this->postComment($node, $this->randomName(), $this->randomName(), TRUE);
+    $comments[] = $this->postComment($node, $this->randomMachineName(), $this->randomMachineName(), TRUE);
+    $comments[] = $this->postComment($node, $this->randomMachineName(), $this->randomMachineName(), TRUE);
+    $comments[] = $this->postComment($node, $this->randomMachineName(), $this->randomMachineName(), TRUE);
 
     // Post a reply to the second comment.
     $this->drupalGet('comment/reply/node/' . $node->id() . '/comment/' . $comments[1]->id());
-    $comments[] = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
+    $comments[] = $this->postComment(NULL, $this->randomMachineName(), $this->randomMachineName(), TRUE);
 
     // Post a reply to the first comment.
     $this->drupalGet('comment/reply/node/' . $node->id() . '/comment/' . $comments[0]->id());
-    $comments[] = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
+    $comments[] = $this->postComment(NULL, $this->randomMachineName(), $this->randomMachineName(), TRUE);
 
     // Post a reply to the last comment.
     $this->drupalGet('comment/reply/node/' . $node->id() . '/comment/' . $comments[2]->id());
-    $comments[] = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
+    $comments[] = $this->postComment(NULL, $this->randomMachineName(), $this->randomMachineName(), TRUE);
 
     // At this point, the comment tree is:
     // - 0
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php
index 1de62da..2edb7ec 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php
@@ -46,7 +46,7 @@ function testCommentPreview() {
     // Login as web user and add a signature and a user picture.
     $this->drupalLogin($this->web_user);
     \Drupal::config('user.settings')->set('signatures', 1)->save();
-    $test_signature = $this->randomName();
+    $test_signature = $this->randomMachineName();
     $edit['signature[value]'] = '<a href="http://example.com/">' . $test_signature. '</a>';
     $image = current($this->drupalGetTestFiles('image'));
     $edit['files[user_picture_0]'] = drupal_realpath($image->uri);
@@ -54,8 +54,8 @@ function testCommentPreview() {
 
     // As the web user, fill in the comment form and preview the comment.
     $edit = array();
-    $edit['subject'] = $this->randomName(8);
-    $edit['comment_body[0][value]'] = $this->randomName(16);
+    $edit['subject'] = $this->randomMachineName(8);
+    $edit['comment_body[0][value]'] = $this->randomMachineName(16);
     $this->drupalPostForm('node/' . $this->node->id(), $edit, t('Preview'));
 
     // Check that the preview is displaying the title and body.
@@ -87,8 +87,8 @@ function testCommentEditPreviewSave() {
 
     $edit = array();
     $date = new DrupalDateTime('2008-03-02 17:23');
-    $edit['subject'] = $this->randomName(8);
-    $edit['comment_body[0][value]'] = $this->randomName(16);
+    $edit['subject'] = $this->randomMachineName(8);
+    $edit['comment_body[0][value]'] = $this->randomMachineName(16);
     $edit['name'] = $web_user->getUsername();
     $edit['date[date]'] = $date->format('Y-m-d');
     $edit['date[time]'] = $date->format('H:i:s');
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentRssTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentRssTest.php
index c58ada7..96c46b7 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentRssTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentRssTest.php
@@ -35,7 +35,7 @@ public static function getInfo() {
   function testCommentRss() {
     // Find comment in RSS feed.
     $this->drupalLogin($this->web_user);
-    $this->postComment($this->node, $this->randomName(), $this->randomName());
+    $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName());
     $this->drupalGet('rss.xml');
     $raw = '<comments>' . url('node/' . $this->node->id(), array('fragment' => 'comments', 'absolute' => TRUE)) . '</comments>';
     $this->assertRaw($raw, 'Comments as part of RSS feed.');
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentStatisticsTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentStatisticsTest.php
index 6906b55..2504781 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentStatisticsTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentStatisticsTest.php
@@ -56,7 +56,7 @@ function testCommentNodeCommentStatistics() {
 
     // Post comment #1 as web_user2.
     $this->drupalLogin($this->web_user2);
-    $comment_text = $this->randomName();
+    $comment_text = $this->randomMachineName();
     $this->postComment($this->node, $comment_text);
 
     // Checks the new values of node comment statistics with comment #1.
@@ -79,7 +79,7 @@ function testCommentNodeCommentStatistics() {
 
     // Post comment #2 as anonymous (comment approval enabled).
     $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment');
-    $anonymous_comment = $this->postComment($this->node, $this->randomName(), '', TRUE);
+    $anonymous_comment = $this->postComment($this->node, $this->randomMachineName(), '', TRUE);
 
     // Checks the new values of node comment statistics with comment #2 and
     // ensure they haven't changed since the comment has not been moderated.
@@ -100,7 +100,7 @@ function testCommentNodeCommentStatistics() {
 
     // Post comment #3 as anonymous.
     $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment');
-    $anonymous_comment = $this->postComment($this->node, $this->randomName(), '', array('name' => $this->randomName()));
+    $anonymous_comment = $this->postComment($this->node, $this->randomMachineName(), '', array('name' => $this->randomMachineName()));
     $comment_loaded = comment_load($anonymous_comment->id());
 
     // Checks the new values of node comment statistics with comment #3.
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentThreadingTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentThreadingTest.php
index f69b55f..4b62b7d 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentThreadingTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentThreadingTest.php
@@ -39,8 +39,8 @@ function testCommentThreading() {
 
     // Post comment #1.
     $this->drupalLogin($this->web_user);
-    $subject_text = $this->randomName();
-    $comment_text = $this->randomName();
+    $subject_text = $this->randomMachineName();
+    $comment_text = $this->randomMachineName();
     $comment1 = $this->postComment($this->node, $comment_text, $subject_text, TRUE);
     // Confirm that the comment was created and has the correct threading.
     $this->assertTrue($this->commentExists($comment1), 'Comment #1. Comment found.');
@@ -51,7 +51,7 @@ function testCommentThreading() {
     // Reply to comment #1 creating comment #2.
     $this->drupalLogin($this->web_user);
     $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $comment1->id());
-    $comment2 = $this->postComment(NULL, $this->randomName(), '', TRUE);
+    $comment2 = $this->postComment(NULL, $this->randomMachineName(), '', TRUE);
     // Confirm that the comment was created and has the correct threading.
     $this->assertTrue($this->commentExists($comment2, TRUE), 'Comment #2. Reply found.');
     $this->assertEqual($comment2->getThread(), '01.00/');
@@ -60,7 +60,7 @@ function testCommentThreading() {
 
     // Reply to comment #2 creating comment #3.
     $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $comment2->id());
-    $comment3 = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
+    $comment3 = $this->postComment(NULL, $this->randomMachineName(), $this->randomMachineName(), TRUE);
     // Confirm that the comment was created and has the correct threading.
     $this->assertTrue($this->commentExists($comment3, TRUE), 'Comment #3. Second reply found.');
     $this->assertEqual($comment3->getThread(), '01.00.00/');
@@ -70,7 +70,7 @@ function testCommentThreading() {
     // Reply to comment #1 creating comment #4.
     $this->drupalLogin($this->web_user);
     $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $comment1->id());
-    $comment4 = $this->postComment(NULL, $this->randomName(), '', TRUE);
+    $comment4 = $this->postComment(NULL, $this->randomMachineName(), '', TRUE);
     // Confirm that the comment was created and has the correct threading.
     $this->assertTrue($this->commentExists($comment4), 'Comment #4. Third reply found.');
     $this->assertEqual($comment4->getThread(), '01.01/');
@@ -79,8 +79,8 @@ function testCommentThreading() {
 
     // Post comment #2 overall comment #5.
     $this->drupalLogin($this->web_user);
-    $subject_text = $this->randomName();
-    $comment_text = $this->randomName();
+    $subject_text = $this->randomMachineName();
+    $comment_text = $this->randomMachineName();
     $comment5 = $this->postComment($this->node, $comment_text, $subject_text, TRUE);
     // Confirm that the comment was created and has the correct threading.
     $this->assertTrue($this->commentExists($comment5), 'Comment #5. Second comment found.');
@@ -91,7 +91,7 @@ function testCommentThreading() {
     // Reply to comment #5 creating comment #6.
     $this->drupalLogin($this->web_user);
     $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $comment5->id());
-    $comment6 = $this->postComment(NULL, $this->randomName(), '', TRUE);
+    $comment6 = $this->postComment(NULL, $this->randomMachineName(), '', TRUE);
     // Confirm that the comment was created and has the correct threading.
     $this->assertTrue($this->commentExists($comment6, TRUE), 'Comment #6. Reply found.');
     $this->assertEqual($comment6->getThread(), '02.00/');
@@ -100,7 +100,7 @@ function testCommentThreading() {
 
     // Reply to comment #6 creating comment #7.
     $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $comment6->id());
-    $comment7 = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
+    $comment7 = $this->postComment(NULL, $this->randomMachineName(), $this->randomMachineName(), TRUE);
     // Confirm that the comment was created and has the correct threading.
     $this->assertTrue($this->commentExists($comment7, TRUE), 'Comment #7. Second reply found.');
     $this->assertEqual($comment7->getThread(), '02.00.00/');
@@ -110,7 +110,7 @@ function testCommentThreading() {
     // Reply to comment #5 creating comment #8.
     $this->drupalLogin($this->web_user);
     $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $comment5->id());
-    $comment8 = $this->postComment(NULL, $this->randomName(), '', TRUE);
+    $comment8 = $this->postComment(NULL, $this->randomMachineName(), '', TRUE);
     // Confirm that the comment was created and has the correct threading.
     $this->assertTrue($this->commentExists($comment8), 'Comment #8. Third reply found.');
     $this->assertEqual($comment8->getThread(), '02.01/');
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php
index 0d2a4b2..abc62f3 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php
@@ -40,11 +40,11 @@ function testCommentTokenReplacement() {
 
     // Create a node and a comment.
     $node = $this->drupalCreateNode(array('type' => 'article'));
-    $parent_comment = $this->postComment($node, $this->randomName(), $this->randomName(), TRUE);
+    $parent_comment = $this->postComment($node, $this->randomMachineName(), $this->randomMachineName(), TRUE);
 
     // Post a reply to the comment.
     $this->drupalGet('comment/reply/node/' . $node->id() . '/comment/' . $parent_comment->id());
-    $child_comment = $this->postComment(NULL, $this->randomName(), $this->randomName());
+    $child_comment = $this->postComment(NULL, $this->randomMachineName(), $this->randomMachineName());
     $comment = comment_load($child_comment->id());
     $comment->setHomepage('http://example.org/');
 
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php
index 5e5b4de..93e06dd 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php
@@ -40,7 +40,7 @@ function setUp() {
     $this->nodeBundle = 'article';
     $this->bundle = 'node__comment_article';
     $this->testLanguageSelector = FALSE;
-    $this->subject = $this->randomName();
+    $this->subject = $this->randomMachineName();
     parent::setUp();
   }
 
@@ -120,7 +120,7 @@ protected function getNewEntityValues($langcode) {
     // Comment subject is not translatable hence we use a fixed value.
     return array(
       'subject' => $this->subject,
-      'comment_body' => array(array('value' => $this->randomName(16))),
+      'comment_body' => array(array('value' => $this->randomMachineName(16))),
     ) + parent::getNewEntityValues($langcode);
   }
 
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentValidationTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentValidationTest.php
index 881c965..981638f 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentValidationTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentValidationTest.php
@@ -76,7 +76,7 @@ public function testValidation() {
       'entity_id' => $node->id(),
       'entity_type' => 'node',
       'field_name' => 'comment',
-      'comment_body' => $this->randomName(),
+      'comment_body' => $this->randomMachineName(),
     ));
 
     $violations = $comment->validate();
@@ -109,7 +109,7 @@ public function testValidation() {
     $this->assertEqual($violations[0]->getMessage(), t('This value is not a valid email address.'));
 
     $comment->set('mail', NULL);
-    $comment->set('homepage', 'http://example.com/' . $this->randomName(237));
+    $comment->set('homepage', 'http://example.com/' . $this->randomMachineName(237));
     $this->assertLengthViolation($comment, 'homepage', 255);
 
     $comment->set('homepage', 'invalid');
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/Views/WizardTest.php b/core/modules/comment/lib/Drupal/comment/Tests/Views/WizardTest.php
index 6ced3f6..bf13ed4 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/Views/WizardTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/Views/WizardTest.php
@@ -48,11 +48,11 @@ public function setUp() {
    */
   public function testCommentWizard() {
     $view = array();
-    $view['label'] = $this->randomName(16);
-    $view['id'] = strtolower($this->randomName(16));
+    $view['label'] = $this->randomMachineName(16);
+    $view['id'] = strtolower($this->randomMachineName(16));
     $view['show[wizard_key]'] = 'comment';
     $view['page[create]'] = TRUE;
-    $view['page[path]'] = $this->randomName(16);
+    $view['page[path]'] = $this->randomMachineName(16);
 
     // Just triggering the saving should automatically choose a proper row
     // plugin.
@@ -78,7 +78,7 @@ public function testCommentWizard() {
     $expected_options = array('comment', 'fields');
     $this->assertEqual($options, $expected_options);
 
-    $view['id'] = strtolower($this->randomName(16));
+    $view['id'] = strtolower($this->randomMachineName(16));
     $this->drupalPostForm(NULL, $view, t('Save and edit'));
     $this->assertUrl('admin/structure/views/view/' . $view['id'], array(), 'Make sure the view saving was successful and the browser got redirected to the edit page.');
 
diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityStatusTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityStatusTest.php
index 5519de5..ec211ba 100644
--- a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityStatusTest.php
+++ b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityStatusTest.php
@@ -34,7 +34,7 @@ public static function getInfo() {
    */
   function testCRUD() {
     $entity = entity_create('config_test', array(
-      'id' => strtolower($this->randomName()),
+      'id' => strtolower($this->randomMachineName()),
     ));
     $this->assertTrue($entity->status(), 'Default status is enabled.');
     $entity->save();
diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityStatusUITest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityStatusUITest.php
index 89f5b00..8686c58 100644
--- a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityStatusUITest.php
+++ b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityStatusUITest.php
@@ -34,10 +34,10 @@ public static function getInfo() {
    * Tests status operations.
    */
   function testCRUD() {
-    $id = strtolower($this->randomName());
+    $id = strtolower($this->randomMachineName());
     $edit = array(
       'id' => $id,
-      'label' => $this->randomName(),
+      'label' => $this->randomMachineName(),
     );
     $this->drupalPostForm('admin/structure/config_test/add', $edit, 'Save');
 
diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php
index a2e1975..1b64659 100644
--- a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php
+++ b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php
@@ -97,9 +97,9 @@ function testCRUD() {
 
     // Verify properties on a newly created entity.
     $config_test = entity_create('config_test', $expected = array(
-      'id' => $this->randomName(),
+      'id' => $this->randomMachineName(),
       'label' => $this->randomString(),
-      'style' => $this->randomName(),
+      'style' => $this->randomMachineName(),
     ));
     $this->assertIdentical($config_test->id, $expected['id']);
     $this->assertTrue($config_test->uuid);
@@ -150,7 +150,7 @@ function testCRUD() {
 
     // Test with a short ID.
     $id_length_config_test = entity_create('config_test', array(
-      'id' => $this->randomName(8),
+      'id' => $this->randomMachineName(8),
     ));
     try {
       $id_length_config_test->save();
@@ -164,7 +164,7 @@ function testCRUD() {
 
     // Test with an ID of the maximum allowed length.
     $id_length_config_test = entity_create('config_test', array(
-      'id' => $this->randomName(ConfigEntityStorage::MAX_ID_LENGTH),
+      'id' => $this->randomMachineName(ConfigEntityStorage::MAX_ID_LENGTH),
     ));
     try {
       $id_length_config_test->save();
@@ -178,7 +178,7 @@ function testCRUD() {
 
     // Test with an ID exeeding the maximum allowed length.
     $id_length_config_test = entity_create('config_test', array(
-      'id' => $this->randomName(ConfigEntityStorage::MAX_ID_LENGTH + 1),
+      'id' => $this->randomMachineName(ConfigEntityStorage::MAX_ID_LENGTH + 1),
     ));
     try {
       $status = $id_length_config_test->save();
@@ -208,7 +208,7 @@ function testCRUD() {
     }
 
     // Verify that renaming the ID returns correct status and properties.
-    $ids = array($expected['id'], 'second_' . $this->randomName(4), 'third_' . $this->randomName(4));
+    $ids = array($expected['id'], 'second_' . $this->randomMachineName(4), 'third_' . $this->randomMachineName(4));
     for ($i = 1; $i < 3; $i++) {
       $old_id = $ids[$i - 1];
       $new_id = $ids[$i];
@@ -238,10 +238,10 @@ function testCRUD() {
    * Tests CRUD operations through the UI.
    */
   function testCRUDUI() {
-    $id = strtolower($this->randomName());
-    $label1 = $this->randomName();
-    $label2 = $this->randomName();
-    $label3 = $this->randomName();
+    $id = strtolower($this->randomMachineName());
+    $label1 = $this->randomMachineName();
+    $label2 = $this->randomMachineName();
+    $label3 = $this->randomMachineName();
     $message_insert = format_string('%label configuration has been created.', array('%label' => $label1));
     $message_update = format_string('%label configuration has been updated.', array('%label' => $label2));
     $message_delete = format_string('%label configuration has been deleted.', array('%label' => $label2));
@@ -295,7 +295,7 @@ function testCRUDUI() {
 
     // Rename the configuration entity's ID/machine name.
     $edit = array(
-      'id' => strtolower($this->randomName()),
+      'id' => strtolower($this->randomMachineName()),
       'label' => $label3,
     );
     $this->drupalPostForm("admin/structure/config_test/manage/$id", $edit, 'Save');
diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityUnitTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityUnitTest.php
index 9800827..04b7f9e 100644
--- a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityUnitTest.php
+++ b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityUnitTest.php
@@ -61,20 +61,20 @@ public function testStorageMethods() {
     $this->assertIdentical($storage::getIDFromConfigName($config_name, $entity_type->getConfigPrefix()), $expected_id);
 
     // Create three entities, two with the same style.
-    $style = $this->randomName(8);
+    $style = $this->randomMachineName(8);
     for ($i = 0; $i < 2; $i++) {
       $entity = $this->storage->create(array(
-        'id' => $this->randomName(),
+        'id' => $this->randomMachineName(),
         'label' => $this->randomString(),
         'style' => $style,
       ));
       $entity->save();
     }
     $entity = $this->storage->create(array(
-      'id' => $this->randomName(),
+      'id' => $this->randomMachineName(),
       'label' => $this->randomString(),
       // Use a different length for the entity to ensure uniqueness.
-      'style' => $this->randomName(9),
+      'style' => $this->randomMachineName(9),
     ));
     $entity->save();
 
diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigExportImportUITest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigExportImportUITest.php
index 0a01bd1..a06bb2f 100644
--- a/core/modules/config/lib/Drupal/config/Tests/ConfigExportImportUITest.php
+++ b/core/modules/config/lib/Drupal/config/Tests/ConfigExportImportUITest.php
@@ -72,7 +72,7 @@ public function testExportImport() {
 
     // Create a field.
     $this->field = entity_create('field_config', array(
-      'name' => drupal_strtolower($this->randomName()),
+      'name' => drupal_strtolower($this->randomMachineName()),
       'entity_type' => 'node',
       'type' => 'text',
     ));
@@ -120,7 +120,7 @@ public function testExportImport() {
     $this->assertNoFieldByName("{$this->field->name}[0][value]", '', 'Widget is not displayed');
 
     // Import the configuration.
-    $filename = 'temporary://' . $this->randomName();
+    $filename = 'temporary://' . $this->randomMachineName();
     file_put_contents($filename, $this->tarball);
     $this->drupalPostForm('admin/config/development/configuration/full/import', array('files[import_tarball]' => $filename), 'Upload');
     $this->drupalPostForm(NULL, array(), 'Import all');
diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigFileContentTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigFileContentTest.php
index a73155d..cb3ad58 100644
--- a/core/modules/config/lib/Drupal/config/Tests/ConfigFileContentTest.php
+++ b/core/modules/config/lib/Drupal/config/Tests/ConfigFileContentTest.php
@@ -189,7 +189,7 @@ function testReadWriteConfig() {
    * Tests serialization of configuration to file.
    */
   function testSerialization() {
-    $name = $this->randomName(10) . '.' . $this->randomName(10);
+    $name = $this->randomMachineName(10) . '.' . $this->randomMachineName(10);
     $config_data = array(
       // Indexed arrays; the order of elements is essential.
       'numeric keys' => array('i', 'n', 'd', 'e', 'x', 'e', 'd'),
diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigImportRecreateTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigImportRecreateTest.php
index ac77a58..f2a0004 100644
--- a/core/modules/config/lib/Drupal/config/Tests/ConfigImportRecreateTest.php
+++ b/core/modules/config/lib/Drupal/config/Tests/ConfigImportRecreateTest.php
@@ -65,7 +65,7 @@ public function setUp() {
   }
 
   public function testRecreateEntity() {
-    $type_name = Unicode::strtolower($this->randomName(16));
+    $type_name = Unicode::strtolower($this->randomMachineName(16));
     $content_type = entity_create('node_type', array(
       'type' => $type_name,
       'name' => 'Node type one',
diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigLanguageOverrideWebTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigLanguageOverrideWebTest.php
index 34f5172..c6fa14e 100644
--- a/core/modules/config/lib/Drupal/config/Tests/ConfigLanguageOverrideWebTest.php
+++ b/core/modules/config/lib/Drupal/config/Tests/ConfigLanguageOverrideWebTest.php
@@ -37,7 +37,7 @@ function testSiteNameTranslation() {
 
     // Add a custom lanugage.
     $langcode = 'xx';
-    $name = $this->randomName(16);
+    $name = $this->randomMachineName(16);
     $edit = array(
       'predefined_langcode' => 'custom',
       'langcode' => $langcode,
diff --git a/core/modules/config_translation/lib/Drupal/config_translation/Tests/ConfigTranslationListUiTest.php b/core/modules/config_translation/lib/Drupal/config_translation/Tests/ConfigTranslationListUiTest.php
index 06ede2d..8b48a6f 100644
--- a/core/modules/config_translation/lib/Drupal/config_translation/Tests/ConfigTranslationListUiTest.php
+++ b/core/modules/config_translation/lib/Drupal/config_translation/Tests/ConfigTranslationListUiTest.php
@@ -97,7 +97,7 @@ public function setUp() {
   protected function doBlockListTest() {
     // Add a test block, any block will do.
     // Set the machine name so the translate link can be built later.
-    $id = Unicode::strtolower($this->randomName(16));
+    $id = Unicode::strtolower($this->randomMachineName(16));
     $this->drupalPlaceBlock('system_powered_by_block', array('id' => $id));
 
     // Get the Block listing.
@@ -120,8 +120,8 @@ protected function doMenuListTest() {
     // this does not test more than necessary.
     $this->drupalGet('admin/structure/menu/add');
     // Lowercase the machine name.
-    $menu_name = Unicode::strtolower($this->randomName(16));
-    $label = $this->randomName(16);
+    $menu_name = Unicode::strtolower($this->randomMachineName(16));
+    $label = $this->randomMachineName(16);
     $edit = array(
       'id' => $menu_name,
       'description' => '',
@@ -166,9 +166,9 @@ protected function doVocabularyListTest() {
     // Create a test vocabulary to decouple looking for translate operations
     // link so this does not test more than necessary.
     $vocabulary = entity_create('taxonomy_vocabulary', array(
-      'name' => $this->randomName(),
-      'description' => $this->randomName(),
-      'vid' => Unicode::strtolower($this->randomName()),
+      'name' => $this->randomMachineName(),
+      'description' => $this->randomMachineName(),
+      'vid' => Unicode::strtolower($this->randomMachineName()),
     ));
     $vocabulary->save();
 
@@ -191,8 +191,8 @@ public function doCustomBlockTypeListTest() {
     // Create a test custom block type to decouple looking for translate
     // operations link so this does not test more than necessary.
     $custom_block_type = entity_create('custom_block_type', array(
-      'id' => Unicode::strtolower($this->randomName(16)),
-      'label' => $this->randomName(),
+      'id' => Unicode::strtolower($this->randomMachineName(16)),
+      'label' => $this->randomMachineName(),
       'revision' => FALSE
     ));
     $custom_block_type->save();
@@ -216,8 +216,8 @@ public function doContactFormsListTest() {
     // Create a test contact form to decouple looking for translate operations
     // link so this does not test more than necessary.
     $contact_form = entity_create('contact_category', array(
-      'id' => Unicode::strtolower($this->randomName(16)),
-      'label' => $this->randomName(),
+      'id' => Unicode::strtolower($this->randomMachineName(16)),
+      'label' => $this->randomMachineName(),
     ));
     $contact_form->save();
 
@@ -240,8 +240,8 @@ public function doContentTypeListTest() {
     // Create a test content type to decouple looking for translate operations
     // link so this does not test more than necessary.
     $content_type = entity_create('node_type', array(
-      'type' => Unicode::strtolower($this->randomName(16)),
-      'name' => $this->randomName(),
+      'type' => Unicode::strtolower($this->randomMachineName(16)),
+      'name' => $this->randomMachineName(),
     ));
     $content_type->save();
 
@@ -264,8 +264,8 @@ public function doFormatsListTest() {
     // Create a test format to decouple looking for translate operations
     // link so this does not test more than necessary.
     $filter_format = entity_create('filter_format', array(
-      'format' => Unicode::strtolower($this->randomName(16)),
-      'name' => $this->randomName(),
+      'format' => Unicode::strtolower($this->randomMachineName(16)),
+      'name' => $this->randomMachineName(),
     ));
     $filter_format->save();
 
@@ -288,7 +288,7 @@ public function doShortcutListTest() {
     // Create a test shortcut to decouple looking for translate operations
     // link so this does not test more than necessary.
     $shortcut = entity_create('shortcut_set', array(
-      'id' => Unicode::strtolower($this->randomName(16)),
+      'id' => Unicode::strtolower($this->randomMachineName(16)),
       'label' => $this->randomString(),
     ));
     $shortcut->save();
@@ -311,7 +311,7 @@ public function doShortcutListTest() {
   public function doUserRoleListTest() {
     // Create a test role to decouple looking for translate operations
     // link so this does not test more than necessary.
-    $role_id = Unicode::strtolower($this->randomName(16));
+    $role_id = Unicode::strtolower($this->randomMachineName(16));
     $this->drupalCreateRole(array(), $role_id);
 
     // Get the role listing.
@@ -368,7 +368,7 @@ public function doImageStyleListTest() {
    */
   public function doResponsiveImageListTest() {
     $edit = array();
-    $edit['label'] = $this->randomName();
+    $edit['label'] = $this->randomMachineName();
     $edit['id'] = strtolower($edit['label']);
 
     $this->drupalPostForm('admin/config/media/responsive-image-mapping/add', $edit, t('Save'));
@@ -392,8 +392,8 @@ public function doResponsiveImageListTest() {
   public function doFieldListTest() {
     // Create a base content type.
     $content_type = entity_create('node_type', array(
-      'type' => Unicode::strtolower($this->randomName(16)),
-      'name' => $this->randomName(),
+      'type' => Unicode::strtolower($this->randomMachineName(16)),
+      'name' => $this->randomMachineName(),
     ));
     $content_type->save();
 
diff --git a/core/modules/config_translation/lib/Drupal/config_translation/Tests/ConfigTranslationOverviewTest.php b/core/modules/config_translation/lib/Drupal/config_translation/Tests/ConfigTranslationOverviewTest.php
index 59a2999..d5e675b 100644
--- a/core/modules/config_translation/lib/Drupal/config_translation/Tests/ConfigTranslationOverviewTest.php
+++ b/core/modules/config_translation/lib/Drupal/config_translation/Tests/ConfigTranslationOverviewTest.php
@@ -83,7 +83,7 @@ public function testMapperListPage() {
 
     foreach ($labels as $label) {
       $test_entity = entity_create('config_test', array(
-        'id' => $this->randomName(),
+        'id' => $this->randomMachineName(),
         'label' => $label,
       ));
       $test_entity->save();
diff --git a/core/modules/config_translation/lib/Drupal/config_translation/Tests/ConfigTranslationUiTest.php b/core/modules/config_translation/lib/Drupal/config_translation/Tests/ConfigTranslationUiTest.php
index 405aaf5..742dea2 100644
--- a/core/modules/config_translation/lib/Drupal/config_translation/Tests/ConfigTranslationUiTest.php
+++ b/core/modules/config_translation/lib/Drupal/config_translation/Tests/ConfigTranslationUiTest.php
@@ -572,7 +572,7 @@ public function testLocaleDBStorage() {
     $this->drupalLogin($this->admin_user);
 
     $langcode = 'xx';
-    $name = $this->randomName(16);
+    $name = $this->randomMachineName(16);
     $edit = array(
       'predefined_langcode' => 'custom',
       'langcode' => $langcode,
diff --git a/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php b/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php
index f1df078..0db141e 100644
--- a/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php
+++ b/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php
@@ -233,8 +233,8 @@ function testPersonalContactFlood() {
    */
   protected function submitPersonalContact($account, array $message = array()) {
     $message += array(
-      'subject' => $this->randomName(16),
-      'message' => $this->randomName(64),
+      'subject' => $this->randomMachineName(16),
+      'message' => $this->randomMachineName(64),
     );
     $this->drupalPostForm('user/' . $account->id() . '/contact', $message, t('Send message'));
     return $message;
diff --git a/core/modules/contact/lib/Drupal/contact/Tests/ContactSitewideTest.php b/core/modules/contact/lib/Drupal/contact/Tests/ContactSitewideTest.php
index 7442166..c025954 100644
--- a/core/modules/contact/lib/Drupal/contact/Tests/ContactSitewideTest.php
+++ b/core/modules/contact/lib/Drupal/contact/Tests/ContactSitewideTest.php
@@ -98,7 +98,7 @@ function testSiteWideContact() {
     // Test invalid recipients.
     $invalid_recipients = array('invalid', 'invalid@', 'invalid@site.', '@site.', '@site.com');
     foreach ($invalid_recipients as $invalid_recipient) {
-      $this->addCategory($this->randomName(16), $this->randomName(16), $invalid_recipient, '', FALSE);
+      $this->addCategory($this->randomMachineName(16), $this->randomMachineName(16), $invalid_recipient, '', FALSE);
       $this->assertRaw(t('%recipient is an invalid e-mail address.', array('%recipient' => $invalid_recipient)));
     }
 
@@ -110,7 +110,7 @@ function testSiteWideContact() {
 
     // Create first valid category.
     $recipients = array('simpletest@example.com', 'simpletest2@example.com', 'simpletest3@example.com');
-    $this->addCategory($id = drupal_strtolower($this->randomName(16)), $label = $this->randomName(16), implode(',', array($recipients[0])), '', TRUE);
+    $this->addCategory($id = drupal_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($recipients[0])), '', TRUE);
     $this->assertRaw(t('Category %label has been added.', array('%label' => $label)));
 
     // Check that the category was created in site default language.
@@ -122,7 +122,7 @@ function testSiteWideContact() {
     $this->assertNoUniqueText($label, 'New category included in categories list.');
 
     // Test update contact form category.
-    $this->updateCategory($id, $label = $this->randomName(16), $recipients_str = implode(',', array($recipients[0], $recipients[1])), $reply = $this->randomName(30), FALSE);
+    $this->updateCategory($id, $label = $this->randomMachineName(16), $recipients_str = implode(',', array($recipients[0], $recipients[1])), $reply = $this->randomMachineName(30), FALSE);
     $config = \Drupal::config('contact.category.' . $id)->get();
     $this->assertEqual($config['label'], $label);
     $this->assertEqual($config['recipients'], array($recipients[0], $recipients[1]));
@@ -145,10 +145,10 @@ function testSiteWideContact() {
     $this->drupalLogin($admin_user);
 
     // Add more categories.
-    $this->addCategory(drupal_strtolower($this->randomName(16)), $label = $this->randomName(16), implode(',', array($recipients[0], $recipients[1])), '', FALSE);
+    $this->addCategory(drupal_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($recipients[0], $recipients[1])), '', FALSE);
     $this->assertRaw(t('Category %label has been added.', array('%label' => $label)));
 
-    $this->addCategory($name = drupal_strtolower($this->randomName(16)), $label = $this->randomName(16), implode(',', array($recipients[0], $recipients[1], $recipients[2])), '', FALSE);
+    $this->addCategory($name = drupal_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($recipients[0], $recipients[1], $recipients[2])), '', FALSE);
     $this->assertRaw(t('Category %label has been added.', array('%label' => $label)));
 
     // Try adding a category that already exists.
@@ -173,19 +173,19 @@ function testSiteWideContact() {
     $this->assertResponse(200);
 
     // Submit contact form with invalid values.
-    $this->submitContact('', $recipients[0], $this->randomName(16), $id, $this->randomName(64));
+    $this->submitContact('', $recipients[0], $this->randomMachineName(16), $id, $this->randomMachineName(64));
     $this->assertText(t('Your name field is required.'));
 
-    $this->submitContact($this->randomName(16), '', $this->randomName(16), $id, $this->randomName(64));
+    $this->submitContact($this->randomMachineName(16), '', $this->randomMachineName(16), $id, $this->randomMachineName(64));
     $this->assertText(t('Your e-mail address field is required.'));
 
-    $this->submitContact($this->randomName(16), $invalid_recipients[0], $this->randomName(16), $id, $this->randomName(64));
+    $this->submitContact($this->randomMachineName(16), $invalid_recipients[0], $this->randomMachineName(16), $id, $this->randomMachineName(64));
     $this->assertRaw(t('The e-mail address %mail is not valid.', array('%mail' => 'invalid')));
 
-    $this->submitContact($this->randomName(16), $recipients[0], '', $id, $this->randomName(64));
+    $this->submitContact($this->randomMachineName(16), $recipients[0], '', $id, $this->randomMachineName(64));
     $this->assertText(t('Subject field is required.'));
 
-    $this->submitContact($this->randomName(16), $recipients[0], $this->randomName(16), $id, '');
+    $this->submitContact($this->randomMachineName(16), $recipients[0], $this->randomMachineName(16), $id, '');
     $this->assertText(t('Message field is required.'));
 
     // Test contact form with no default category selected.
@@ -198,12 +198,12 @@ function testSiteWideContact() {
     // Try to access contact form with non-existing category IDs.
     $this->drupalGet('contact/0');
     $this->assertResponse(404);
-    $this->drupalGet('contact/' . $this->randomName());
+    $this->drupalGet('contact/' . $this->randomMachineName());
     $this->assertResponse(404);
 
     // Submit contact form with correct values and check flood interval.
     for ($i = 0; $i < $flood_limit; $i++) {
-      $this->submitContact($this->randomName(16), $recipients[0], $this->randomName(16), $id, $this->randomName(64));
+      $this->submitContact($this->randomMachineName(16), $recipients[0], $this->randomMachineName(16), $id, $this->randomMachineName(64));
       $this->assertText(t('Your message has been sent.'));
     }
     // Submit contact form one over limit.
@@ -216,9 +216,9 @@ function testSiteWideContact() {
 
     $this->deleteCategories();
 
-    $label = $this->randomName(16);
+    $label = $this->randomMachineName(16);
     $recipients = implode(',', array($recipients[0], $recipients[1], $recipients[2]));
-    $category = drupal_strtolower($this->randomName(16));
+    $category = drupal_strtolower($this->randomMachineName(16));
     $this->addCategory($category, $label, $recipients, '', FALSE);
     $this->drupalGet('admin/structure/contact');
     $this->clickLink(t('Edit'));
@@ -242,8 +242,8 @@ function testSiteWideContact() {
 
     // Create a simple textfield.
     $edit = array(
-      'fields[_add_new_field][label]' => $field_label = $this->randomName(),
-      'fields[_add_new_field][field_name]' => Unicode::strtolower($this->randomName()),
+      'fields[_add_new_field][label]' => $field_label = $this->randomMachineName(),
+      'fields[_add_new_field][field_name]' => Unicode::strtolower($this->randomMachineName()),
       'fields[_add_new_field][type]' => 'text',
     );
     $field_name = 'field_' . $edit['fields[_add_new_field][field_name]'];
@@ -257,9 +257,9 @@ function testSiteWideContact() {
 
     // Submit the contact form and verify the content.
     $edit = array(
-      'subject' => $this->randomName(),
-      'message' => $this->randomName(),
-      $field_name . '[0][value]' => $this->randomName(),
+      'subject' => $this->randomMachineName(),
+      'message' => $this->randomMachineName(),
+      $field_name . '[0][value]' => $this->randomMachineName(),
     );
     $this->drupalPostForm(NULL, $edit, t('Send message'));
     $mails = $this->drupalGetMails();
@@ -278,8 +278,8 @@ function testAutoReply() {
     $this->drupalLogin($admin_user);
 
     // Set up three categories, 2 with an auto-reply and one without.
-    $foo_autoreply = $this->randomName(40);
-    $bar_autoreply = $this->randomName(40);
+    $foo_autoreply = $this->randomMachineName(40);
+    $bar_autoreply = $this->randomMachineName(40);
     $this->addCategory('foo', 'foo', 'foo@example.com', $foo_autoreply, FALSE);
     $this->addCategory('bar', 'bar', 'bar@example.com', $bar_autoreply, FALSE);
     $this->addCategory('no_autoreply', 'no_autoreply', 'bar@example.com', '', FALSE);
@@ -289,9 +289,9 @@ function testAutoReply() {
     user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access site-wide contact form'));
 
     // Test the auto-reply for category 'foo'.
-    $email = $this->randomName(32) . '@example.com';
-    $subject = $this->randomName(64);
-    $this->submitContact($this->randomName(16), $email, $subject, 'foo', $this->randomString(128));
+    $email = $this->randomMachineName(32) . '@example.com';
+    $subject = $this->randomMachineName(64);
+    $this->submitContact($this->randomMachineName(16), $email, $subject, 'foo', $this->randomString(128));
 
     // We are testing the auto-reply, so there should be one e-mail going to the sender.
     $captured_emails = $this->drupalGetMails(array('id' => 'contact_page_autoreply', 'to' => $email));
@@ -299,8 +299,8 @@ function testAutoReply() {
     $this->assertEqual(trim($captured_emails[0]['body']), trim(drupal_html_to_text($foo_autoreply)));
 
     // Test the auto-reply for category 'bar'.
-    $email = $this->randomName(32) . '@example.com';
-    $this->submitContact($this->randomName(16), $email, $this->randomString(64), 'bar', $this->randomString(128));
+    $email = $this->randomMachineName(32) . '@example.com';
+    $this->submitContact($this->randomMachineName(16), $email, $this->randomString(64), 'bar', $this->randomString(128));
 
     // Auto-reply for category 'bar' should result in one auto-reply e-mail to the sender.
     $captured_emails = $this->drupalGetMails(array('id' => 'contact_page_autoreply', 'to' => $email));
@@ -308,8 +308,8 @@ function testAutoReply() {
     $this->assertEqual(trim($captured_emails[0]['body']), trim(drupal_html_to_text($bar_autoreply)));
 
     // Verify that no auto-reply is sent when the auto-reply field is left blank.
-    $email = $this->randomName(32) . '@example.com';
-    $this->submitContact($this->randomName(16), $email, $this->randomString(64), 'no_autoreply', $this->randomString(128));
+    $email = $this->randomMachineName(32) . '@example.com';
+    $this->submitContact($this->randomMachineName(16), $email, $this->randomString(64), 'no_autoreply', $this->randomString(128));
     $captured_emails = $this->drupalGetMails(array('id' => 'contact_page_autoreply', 'to' => $email));
     $this->assertEqual(count($captured_emails), 0);
   }
diff --git a/core/modules/contact/lib/Drupal/contact/Tests/Views/ContactFieldsTest.php b/core/modules/contact/lib/Drupal/contact/Tests/Views/ContactFieldsTest.php
index 28216aa..2cd37b6 100644
--- a/core/modules/contact/lib/Drupal/contact/Tests/Views/ContactFieldsTest.php
+++ b/core/modules/contact/lib/Drupal/contact/Tests/Views/ContactFieldsTest.php
@@ -41,7 +41,7 @@ protected function setUp() {
     parent::setUp();
 
     $this->field = entity_create('field_config', array(
-      'name' => strtolower($this->randomName()),
+      'name' => strtolower($this->randomMachineName()),
       'entity_type' => 'contact_message',
       'type' => 'text'
     ));
diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTestTranslationUITest.php b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTestTranslationUITest.php
index 3b836b9..b4f1a82 100644
--- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTestTranslationUITest.php
+++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTestTranslationUITest.php
@@ -49,7 +49,7 @@ protected function getTranslatorPermissions() {
   protected function getNewEntityValues($langcode) {
     $user = $this->drupalCreateUser();
     return array(
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       'user_id' => $user->id(),
     ) + parent::getNewEntityValues($langcode);
   }
diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationContextualLinksTest.php b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationContextualLinksTest.php
index 4b71a16..d9433e6 100644
--- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationContextualLinksTest.php
+++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationContextualLinksTest.php
@@ -63,7 +63,7 @@ function setUp() {
     parent::setUp();
 
     // Create a content type.
-    $this->bundle = $this->randomName();
+    $this->bundle = $this->randomMachineName();
     $this->contentType = $this->drupalCreateContentType(array('type' => $this->bundle));
 
     // Create a translator user.
diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncImageTest.php b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncImageTest.php
index 3f990db..08be0e9 100644
--- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncImageTest.php
+++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncImageTest.php
@@ -128,7 +128,7 @@ function testImageFieldSync() {
 
     // Populate the test entity with some random initial values.
     $values = array(
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       'user_id' => mt_rand(1, 128),
       'langcode' => $default_langcode,
     );
@@ -156,8 +156,8 @@ function testImageFieldSync() {
       // the entity.
       $item = array(
         'target_id' => $fid,
-        'alt' => $default_langcode . '_' . $fid . '_' . $this->randomName(),
-        'title' => $default_langcode . '_' . $fid . '_' . $this->randomName(),
+        'alt' => $default_langcode . '_' . $fid . '_' . $this->randomMachineName(),
+        'title' => $default_langcode . '_' . $fid . '_' . $this->randomMachineName(),
       );
       $entity->{$this->fieldName}->get($delta)->setValue($item);
 
@@ -182,8 +182,8 @@ function testImageFieldSync() {
       $fid = $this->files[$index]->fid;
       $item = array(
         'target_id' => $fid,
-        'alt' => $langcode . '_' . $fid . '_' . $this->randomName(),
-        'title' => $langcode . '_' . $fid . '_' . $this->randomName(),
+        'alt' => $langcode . '_' . $fid . '_' . $this->randomMachineName(),
+        'title' => $langcode . '_' . $fid . '_' . $this->randomMachineName(),
       );
       $translation->{$this->fieldName}->get($delta)->setValue($item);
 
@@ -218,8 +218,8 @@ function testImageFieldSync() {
     // Add back an item for the dropped value and perform synchronization again.
     $values[$langcode][$removed_fid] = array(
       'target_id' => $removed_fid,
-      'alt' => $langcode . '_' . $removed_fid . '_' . $this->randomName(),
-      'title' => $langcode . '_' . $removed_fid . '_' . $this->randomName(),
+      'alt' => $langcode . '_' . $removed_fid . '_' . $this->randomMachineName(),
+      'title' => $langcode . '_' . $removed_fid . '_' . $this->randomMachineName(),
     );
     $translation->{$this->fieldName}->setValue(array_values($values[$langcode]));
     // When updating an entity we do not have a source language defined.
diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncUnitTest.php b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncUnitTest.php
index a1e0805..d71a657 100644
--- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncUnitTest.php
+++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncUnitTest.php
@@ -102,7 +102,7 @@ public function testFieldSync() {
     $field_values = $this->unchangedFieldValues;
     $item = array();
     foreach ($this->columns as $column) {
-      $item[$column] = $this->randomName();
+      $item[$column] = $this->randomMachineName();
     }
     $field_values[$sync_langcode][] = $item;
     $this->synchronizer->synchronizeItems($field_values, $unchanged_items, $sync_langcode, $this->langcodes, $this->synchronized);
diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationUITest.php b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationUITest.php
index 96bf8b2..fcf7384 100644
--- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationUITest.php
+++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationUITest.php
@@ -204,7 +204,7 @@ protected function doTestAuthoringInfo() {
     $langcode = 'en';
     $edit = array(
       // User names have by default length 8.
-      'content_translation[name]' => $this->randomName(12),
+      'content_translation[name]' => $this->randomMachineName(12),
       'content_translation[created]' => '19/11/1978',
     );
     $this->drupalPostForm($path, $edit, $this->getFormSubmitAction($entity, $langcode));
@@ -234,7 +234,7 @@ protected function doTestTranslationDeletion() {
    * Returns an array of entity field values to be tested.
    */
   protected function getNewEntityValues($langcode) {
-    return array($this->fieldName => array(array('value' => $this->randomName(16))));
+    return array($this->fieldName => array(array('value' => $this->randomMachineName(16))));
   }
 
   /**
diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationWorkflowsTest.php b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationWorkflowsTest.php
index 43e5d77..936ed2e 100644
--- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationWorkflowsTest.php
+++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationWorkflowsTest.php
@@ -58,9 +58,9 @@ protected function setupEntity() {
     // Create a test entity.
     $user = $this->drupalCreateUser();
     $values = array(
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       'user_id' => $user->id(),
-      $this->fieldName => array(array('value' => $this->randomName(16))),
+      $this->fieldName => array(array('value' => $this->randomMachineName(16))),
     );
     $id = $this->createEntity($values, $default_langcode);
     $this->entity = entity_load($this->entityTypeId, $id, TRUE);
diff --git a/core/modules/datetime/lib/Drupal/datetime/Tests/DateTimeFieldTest.php b/core/modules/datetime/lib/Drupal/datetime/Tests/DateTimeFieldTest.php
index 76b4cb9..d4c5fd1 100644
--- a/core/modules/datetime/lib/Drupal/datetime/Tests/DateTimeFieldTest.php
+++ b/core/modules/datetime/lib/Drupal/datetime/Tests/DateTimeFieldTest.php
@@ -59,7 +59,7 @@ function setUp() {
 
     // Create a field with settings to validate.
     $this->field = entity_create('field_config', array(
-      'name' => drupal_strtolower($this->randomName()),
+      'name' => drupal_strtolower($this->randomMachineName()),
       'entity_type' => 'entity_test',
       'type' => 'datetime',
       'settings' => array('datetime_type' => 'date'),
@@ -108,7 +108,7 @@ function testDateField() {
 
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$field_name}[0][value][date]" => $date->format($date_format),
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -178,7 +178,7 @@ function testDatetimeField() {
 
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$field_name}[0][value][date]" => $date->format($date_format),
       "{$field_name}[0][value][time]" => $date->format($time_format),
     );
@@ -267,7 +267,7 @@ function testDatelistWidget() {
 
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
     );
     // Add the ampm indicator since we are testing 12 hour time.
     $date_value['ampm'] = 'am';
@@ -297,7 +297,7 @@ function testDefaultValue() {
 
     // Create a field with settings to validate.
     $field = entity_create('field_config', array(
-      'name' => drupal_strtolower($this->randomName()),
+      'name' => drupal_strtolower($this->randomMachineName()),
       'entity_type' => 'node',
       'type' => 'datetime',
       'settings' => array('datetime_type' => 'date'),
diff --git a/core/modules/datetime/lib/Drupal/datetime/Tests/DateTimeItemTest.php b/core/modules/datetime/lib/Drupal/datetime/Tests/DateTimeItemTest.php
index e709902..3d9fdba 100644
--- a/core/modules/datetime/lib/Drupal/datetime/Tests/DateTimeItemTest.php
+++ b/core/modules/datetime/lib/Drupal/datetime/Tests/DateTimeItemTest.php
@@ -61,7 +61,7 @@ public function testDateTimeItem() {
     $entity = entity_create('entity_test');
     $value = '2014-01-01T20:00:00Z';
     $entity->field_datetime = $value;
-    $entity->name->value = $this->randomName();
+    $entity->name->value = $this->randomMachineName();
     $entity->save();
 
     // Verify entity has been created properly.
@@ -73,7 +73,7 @@ public function testDateTimeItem() {
     $this->assertEqual($entity->field_datetime[0]->value, $value);
 
     // Verify changing the date value.
-    $new_value = $this->randomName();
+    $new_value = $this->randomMachineName();
     $entity->field_datetime->value = $new_value;
     $this->assertEqual($entity->field_datetime->value, $new_value);
 
diff --git a/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php b/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php
index 850b6e1..33913d8 100644
--- a/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php
+++ b/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php
@@ -215,7 +215,7 @@ private function verifyEvents() {
    */
   private function doUser() {
     // Set user variables.
-    $name = $this->randomName();
+    $name = $this->randomMachineName();
     $pass = user_password();
     // Add a user using the form to generate an add user event (which is not
     // triggered by drupalCreateUser).
@@ -284,7 +284,7 @@ private function doUser() {
     }
     $this->assertTrue($link, 'DBLog event was recorded: [delete user]');
     // Visit random URL (to generate page not found event).
-    $not_found_url = $this->randomName(60);
+    $not_found_url = $this->randomMachineName(60);
     $this->drupalGet($not_found_url);
     $this->assertResponse(404);
     // View the database log page-not-found report page.
@@ -370,16 +370,16 @@ private function getContent($type) {
     switch ($type) {
       case 'forum':
         $content = array(
-          'title[0][value]' => $this->randomName(8),
+          'title[0][value]' => $this->randomMachineName(8),
           'taxonomy_forums' => array(1),
-          'body[0][value]' => $this->randomName(32),
+          'body[0][value]' => $this->randomMachineName(32),
         );
         break;
 
       default:
         $content = array(
-          'title[0][value]' => $this->randomName(8),
-          'body[0][value]' => $this->randomName(32),
+          'title[0][value]' => $this->randomMachineName(8),
+          'body[0][value]' => $this->randomMachineName(32),
         );
         break;
     }
@@ -397,7 +397,7 @@ private function getContent($type) {
    */
   private function getContentUpdate($type) {
     $content = array(
-      'body[0][value]' => $this->randomName(32),
+      'body[0][value]' => $this->randomMachineName(32),
     );
     return $content;
   }
@@ -451,7 +451,7 @@ protected function testFilter() {
     $type_names = array();
     $types = array();
     for ($i = 0; $i < 3; $i++) {
-      $type_names[] = $type_name = $this->randomName();
+      $type_names[] = $type_name = $this->randomMachineName();
       $severity = WATCHDOG_EMERGENCY;
       for ($j = 0; $j < 3; $j++) {
         $types[] = $type = array(
diff --git a/core/modules/dblog/lib/Drupal/dblog/Tests/Views/ViewsIntegrationTest.php b/core/modules/dblog/lib/Drupal/dblog/Tests/Views/ViewsIntegrationTest.php
index 818cfd3..9b8837b 100644
--- a/core/modules/dblog/lib/Drupal/dblog/Tests/Views/ViewsIntegrationTest.php
+++ b/core/modules/dblog/lib/Drupal/dblog/Tests/Views/ViewsIntegrationTest.php
@@ -63,20 +63,20 @@ public function testIntegration() {
     $entries = array();
     // Setup a watchdog entry without tokens.
     $entries[] = array(
-      'message' => $this->randomName(),
+      'message' => $this->randomMachineName(),
       'variables' => array(),
       'link' => l('Link', 'node/1'),
     );
     // Setup a watchdog entry with one token.
     $entries[] = array(
       'message' => '@token1',
-      'variables' => array('@token1' => $this->randomName()),
+      'variables' => array('@token1' => $this->randomMachineName()),
       'link' => l('Link', 'node/2'),
     );
     // Setup a watchdog entry with two tokens.
     $entries[] = array(
       'message' => '@token1 !token2',
-      'variables' => array('@token1' => $this->randomName(), '!token2' => $this->randomName()),
+      'variables' => array('@token1' => $this->randomMachineName(), '!token2' => $this->randomMachineName()),
       // Setup a link with a tag which is filtered by
       // \Drupal\Component\Utility\Xss::filterAdmin().
       'link' => l('<object>Link</object>', 'node/2', array('html' => TRUE)),
diff --git a/core/modules/edit/lib/Drupal/edit/Tests/EditAutocompleteTermTest.php b/core/modules/edit/lib/Drupal/edit/Tests/EditAutocompleteTermTest.php
index 803b0e3..b74e557 100644
--- a/core/modules/edit/lib/Drupal/edit/Tests/EditAutocompleteTermTest.php
+++ b/core/modules/edit/lib/Drupal/edit/Tests/EditAutocompleteTermTest.php
@@ -206,8 +206,8 @@ protected function createTerm() {
     $filter_formats = filter_formats();
     $format = array_pop($filter_formats);
     $term = entity_create('taxonomy_term', array(
-      'name' => $this->randomName(),
-      'description' => $this->randomName(),
+      'name' => $this->randomMachineName(),
+      'description' => $this->randomMachineName(),
       // Use the first available text format.
       'format' => $format->format,
       'vid' => $this->vocabulary->id(),
diff --git a/core/modules/editor/lib/Drupal/editor/Tests/EditorLoadingTest.php b/core/modules/editor/lib/Drupal/editor/Tests/EditorLoadingTest.php
index 59dde52..8fcc720 100644
--- a/core/modules/editor/lib/Drupal/editor/Tests/EditorLoadingTest.php
+++ b/core/modules/editor/lib/Drupal/editor/Tests/EditorLoadingTest.php
@@ -141,7 +141,7 @@ public function testLoading() {
     $this->drupalCreateNode(array(
       'type' => 'article',
       'body' => array(
-        array('value' => $this->randomName(32), 'format' => 'full_html')
+        array('value' => $this->randomMachineName(32), 'format' => 'full_html')
       ),
     ));
 
diff --git a/core/modules/editor/tests/Drupal/editor/Tests/EditorConfigEntityUnitTest.php b/core/modules/editor/tests/Drupal/editor/Tests/EditorConfigEntityUnitTest.php
index 9064172..56839ac 100644
--- a/core/modules/editor/tests/Drupal/editor/Tests/EditorConfigEntityUnitTest.php
+++ b/core/modules/editor/tests/Drupal/editor/Tests/EditorConfigEntityUnitTest.php
@@ -83,8 +83,8 @@ public static function getInfo() {
    * {@inheritdoc}
    */
   public function setUp() {
-    $this->editorId = $this->randomName();
-    $this->entityTypeId = $this->randomName();
+    $this->editorId = $this->randomMachineName();
+    $this->entityTypeId = $this->randomMachineName();
 
     $this->entityType = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
     $this->entityType->expects($this->any())
diff --git a/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayModeTest.php b/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayModeTest.php
index 133b8c3..dc30067 100644
--- a/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayModeTest.php
+++ b/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayModeTest.php
@@ -51,7 +51,7 @@ public function testEntityViewModeUI() {
     // Test adding a view mode including dots in machine_name.
     $this->clickLink(t('Test entity'));
     $edit = array(
-      'id' => strtolower($this->randomName()) . '.' . strtolower($this->randomName()),
+      'id' => strtolower($this->randomMachineName()) . '.' . strtolower($this->randomMachineName()),
       'label' => $this->randomString(),
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -59,7 +59,7 @@ public function testEntityViewModeUI() {
 
     // Test adding a view mode.
     $edit = array(
-      'id' => strtolower($this->randomName()),
+      'id' => strtolower($this->randomMachineName()),
       'label' => $this->randomString(),
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -97,7 +97,7 @@ public function testEntityFormModeUI() {
     // Test adding a view mode including dots in machine_name.
     $this->clickLink(t('Test entity'));
     $edit = array(
-      'id' => strtolower($this->randomName()) . '.' . strtolower($this->randomName()),
+      'id' => strtolower($this->randomMachineName()) . '.' . strtolower($this->randomMachineName()),
       'label' => $this->randomString(),
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -105,7 +105,7 @@ public function testEntityFormModeUI() {
 
     // Test adding a form mode.
     $edit = array(
-      'id' => strtolower($this->randomName()),
+      'id' => strtolower($this->randomMachineName()),
       'label' => $this->randomString(),
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAdminTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAdminTest.php
index 545bc1b..eb1f9d7 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAdminTest.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAdminTest.php
@@ -40,7 +40,7 @@ public function setUp() {
     $this->drupalLogin($admin_user);
 
     // Create a content type, with underscores.
-    $type_name = strtolower($this->randomName(8)) . '_test';
+    $type_name = strtolower($this->randomMachineName(8)) . '_test';
     $type = $this->drupalCreateContentType(array('name' => $type_name, 'type' => $type_name));
     $this->type = $type->type;
   }
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutoCreateTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutoCreateTest.php
index cc883c8..a53a7c1 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutoCreateTest.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutoCreateTest.php
@@ -87,7 +87,7 @@ public function testAutoCreate() {
     $this->drupalGet('node/add/' . $this->referencing_type);
     $this->assertFieldByXPath('//input[@id="edit-test-field-0-target-id" and contains(@class, "form-autocomplete")]', NULL, 'The autocomplete input element appears.');
 
-    $new_title = $this->randomName();
+    $new_title = $this->randomMachineName();
 
     // Assert referenced node does not exist.
     $base_query = \Drupal::entityQuery('node');
@@ -100,7 +100,7 @@ public function testAutoCreate() {
     $this->assertFalse($result, 'Referenced node does not exist yet.');
 
     $edit = array(
-      'title[0][value]' => $this->randomName(),
+      'title[0][value]' => $this->randomMachineName(),
       'test_field[0][target_id]' => $new_title,
     );
     $this->drupalPostForm("node/add/$this->referencing_type", $edit, 'Save');
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceFieldDefaultValueTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceFieldDefaultValueTest.php
index 9c316a5..1ca35ba 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceFieldDefaultValueTest.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceFieldDefaultValueTest.php
@@ -49,7 +49,7 @@ function testEntityReferenceDefaultValue() {
     $referenced_node = $this->drupalCreateNode(array('type' => 'referenced_content'));
 
     $this->field = entity_create('field_config', array(
-      'name' => drupal_strtolower($this->randomName()),
+      'name' => drupal_strtolower($this->randomMachineName()),
       'entity_type' => 'node',
       'type' => 'entity_reference',
       'settings' => array('target_type' => 'node'),
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceFormatterTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceFormatterTest.php
index 44bcca1..03138a2 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceFormatterTest.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceFormatterTest.php
@@ -64,10 +64,10 @@ public function setUp() {
   public function testAccess() {
     $field_name = $this->fieldName;
 
-    $entity_1 = entity_create($this->entityType, array('name' => $this->randomName()));
+    $entity_1 = entity_create($this->entityType, array('name' => $this->randomMachineName()));
     $entity_1->save();
 
-    $entity_2 = entity_create($this->entityType, array('name' => $this->randomName()));
+    $entity_2 = entity_create($this->entityType, array('name' => $this->randomMachineName()));
     $entity_2->save();
     $entity_2->{$field_name}->entity = $entity_1;
 
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceIntegrationTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceIntegrationTest.php
index 3a892b2..a6f3159 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceIntegrationTest.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceIntegrationTest.php
@@ -74,7 +74,7 @@ public function testSupportedEntityTypesAndWidgets() {
       // Test the default 'entity_reference_autocomplete' widget.
       entity_get_form_display($this->entityType, $this->bundle, 'default')->setComponent($this->fieldName)->save();
 
-      $entity_name = $this->randomName();
+      $entity_name = $this->randomMachineName();
       $edit = array(
         'name' => $entity_name,
         'user_id' => mt_rand(0, 128),
@@ -95,7 +95,7 @@ public function testSupportedEntityTypesAndWidgets() {
         'type' => 'entity_reference_autocomplete_tags',
       ))->save();
 
-      $entity_name = $this->randomName();
+      $entity_name = $this->randomMachineName();
       $target_id = $referenced_entities[0]->label() . ' (' . $referenced_entities[0]->id() . ')';
       $target_id .= ', ' . $referenced_entities[1]->label() . ' (' . $referenced_entities[1]->id() . ')';
       $edit = array(
@@ -159,14 +159,14 @@ protected function assertFieldValues($entity_name, $referenced_entities) {
    *   An array of entity objects.
    */
   protected function getTestEntities() {
-    $config_entity_1 = entity_create('config_test', array('id' => $this->randomName(), 'label' => $this->randomName()));
+    $config_entity_1 = entity_create('config_test', array('id' => $this->randomMachineName(), 'label' => $this->randomMachineName()));
     $config_entity_1->save();
-    $config_entity_2 = entity_create('config_test', array('id' => $this->randomName(), 'label' => $this->randomName()));
+    $config_entity_2 = entity_create('config_test', array('id' => $this->randomMachineName(), 'label' => $this->randomMachineName()));
     $config_entity_2->save();
 
-    $content_entity_1 = entity_create('entity_test', array('name' => $this->randomName()));
+    $content_entity_1 = entity_create('entity_test', array('name' => $this->randomMachineName()));
     $content_entity_1->save();
-    $content_entity_2 = entity_create('entity_test', array('name' => $this->randomName()));
+    $content_entity_2 = entity_create('entity_test', array('name' => $this->randomMachineName()));
     $content_entity_2->save();
 
     return array(
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceItemTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceItemTest.php
index 8c33d47..12005c6 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceItemTest.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceItemTest.php
@@ -56,14 +56,14 @@ public function setUp() {
     $this->installSchema('taxonomy', 'taxonomy_term_hierarchy');
 
     $this->vocabulary = entity_create('taxonomy_vocabulary', array(
-      'name' => $this->randomName(),
-      'vid' => drupal_strtolower($this->randomName()),
+      'name' => $this->randomMachineName(),
+      'vid' => drupal_strtolower($this->randomMachineName()),
       'langcode' => Language::LANGCODE_NOT_SPECIFIED,
     ));
     $this->vocabulary->save();
 
     $this->term = entity_create('taxonomy_term', array(
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       'vid' => $this->vocabulary->id(),
       'langcode' => Language::LANGCODE_NOT_SPECIFIED,
     ));
@@ -83,7 +83,7 @@ public function testContentEntityReferenceItem() {
     // Just being able to create the entity like this verifies a lot of code.
     $entity = entity_create('entity_test');
     $entity->field_test_taxonomy_term->target_id = $tid;
-    $entity->name->value = $this->randomName();
+    $entity->name->value = $this->randomMachineName();
     $entity->save();
 
     $entity = entity_load('entity_test', $entity->id());
@@ -95,7 +95,7 @@ public function testContentEntityReferenceItem() {
     $this->assertEqual($entity->field_test_taxonomy_term->entity->uuid(), $this->term->uuid());
 
     // Change the name of the term via the reference.
-    $new_name = $this->randomName();
+    $new_name = $this->randomMachineName();
     $entity->field_test_taxonomy_term->entity->setName($new_name);
     $entity->field_test_taxonomy_term->entity->save();
     // Verify it is the correct name.
@@ -104,7 +104,7 @@ public function testContentEntityReferenceItem() {
 
     // Make sure the computed term reflects updates to the term id.
     $term2 = entity_create('taxonomy_term', array(
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       'vid' => $this->term->bundle(),
       'langcode' => Language::LANGCODE_NOT_SPECIFIED,
     ));
@@ -117,7 +117,7 @@ public function testContentEntityReferenceItem() {
     // Delete terms so we have nothing to reference and try again
     $term->delete();
     $term2->delete();
-    $entity = entity_create('entity_test', array('name' => $this->randomName()));
+    $entity = entity_create('entity_test', array('name' => $this->randomMachineName()));
     $entity->save();
   }
 
@@ -130,7 +130,7 @@ public function testConfigEntityReferenceItem() {
     // Just being able to create the entity like this verifies a lot of code.
     $entity = entity_create('entity_test');
     $entity->field_test_taxonomy_vocabulary->target_id = $referenced_entity_id;
-    $entity->name->value = $this->randomName();
+    $entity->name->value = $this->randomMachineName();
     $entity->save();
 
     $entity = entity_load('entity_test', $entity->id());
@@ -142,7 +142,7 @@ public function testConfigEntityReferenceItem() {
     $this->assertEqual($entity->field_test_taxonomy_vocabulary->entity->uuid(), $this->vocabulary->uuid());
 
     // Change the name of the term via the reference.
-    $new_name = $this->randomName();
+    $new_name = $this->randomMachineName();
     $entity->field_test_taxonomy_vocabulary->entity->name = $new_name;
     $entity->field_test_taxonomy_vocabulary->entity->save();
     // Verify it is the correct name.
@@ -151,8 +151,8 @@ public function testConfigEntityReferenceItem() {
 
     // Make sure the computed term reflects updates to the term id.
     $vocabulary2 = entity_create('taxonomy_vocabulary', array(
-      'name' => $this->randomName(),
-      'vid' => drupal_strtolower($this->randomName()),
+      'name' => $this->randomMachineName(),
+      'vid' => drupal_strtolower($this->randomMachineName()),
       'langcode' => Language::LANGCODE_NOT_SPECIFIED,
     ));
     $vocabulary2->save();
@@ -164,7 +164,7 @@ public function testConfigEntityReferenceItem() {
     // Delete terms so we have nothing to reference and try again
     $this->vocabulary->delete();
     $vocabulary2->delete();
-    $entity = entity_create('entity_test', array('name' => $this->randomName()));
+    $entity = entity_create('entity_test', array('name' => $this->randomMachineName()));
     $entity->save();
   }
 
diff --git a/core/modules/field/lib/Drupal/field/Tests/DisplayApiTest.php b/core/modules/field/lib/Drupal/field/Tests/DisplayApiTest.php
index 88001f0..97fea63 100644
--- a/core/modules/field/lib/Drupal/field/Tests/DisplayApiTest.php
+++ b/core/modules/field/lib/Drupal/field/Tests/DisplayApiTest.php
@@ -66,7 +66,7 @@ function setUp() {
 
     // Create a field and instance.
     $this->field_name = 'test_field';
-    $this->label = $this->randomName();
+    $this->label = $this->randomMachineName();
     $this->cardinality = 4;
 
     $field = array(
@@ -86,13 +86,13 @@ function setUp() {
       'default' => array(
         'type' => 'field_test_default',
         'settings' => array(
-          'test_formatter_setting' => $this->randomName(),
+          'test_formatter_setting' => $this->randomMachineName(),
         ),
       ),
       'teaser' => array(
         'type' => 'field_test_default',
         'settings' => array(
-          'test_formatter_setting' => $this->randomName(),
+          'test_formatter_setting' => $this->randomMachineName(),
         ),
       ),
     );
@@ -137,7 +137,7 @@ function testFieldItemListView() {
       'label' => 'hidden',
       'type' => 'field_test_multiple',
       'settings' => array(
-        'test_formatter_setting_multiple' => $this->randomName(),
+        'test_formatter_setting_multiple' => $this->randomMachineName(),
         'alter' => TRUE,
       ),
     );
@@ -158,7 +158,7 @@ function testFieldItemListView() {
       'label' => 'hidden',
       'type' => 'field_test_with_prepare_view',
       'settings' => array(
-        'test_formatter_setting_additional' => $this->randomName(),
+        'test_formatter_setting_additional' => $this->randomMachineName(),
       ),
     );
     $output = $items->view($display);
@@ -210,7 +210,7 @@ function testFieldItemView() {
     $display = array(
       'type' => 'field_test_multiple',
       'settings' => array(
-        'test_formatter_setting_multiple' => $this->randomName(),
+        'test_formatter_setting_multiple' => $this->randomMachineName(),
       ),
     );
     $setting = $display['settings']['test_formatter_setting_multiple'];
@@ -225,7 +225,7 @@ function testFieldItemView() {
     $display = array(
       'type' => 'field_test_with_prepare_view',
       'settings' => array(
-        'test_formatter_setting_additional' => $this->randomName(),
+        'test_formatter_setting_additional' => $this->randomMachineName(),
       ),
     );
     $setting = $display['settings']['test_formatter_setting_additional'];
@@ -266,7 +266,7 @@ function testFieldEmpty() {
       'label' => 'hidden',
       'type' => 'field_empty_test',
       'settings' => array(
-        'test_empty_string' => '**EMPTY FIELD**' . $this->randomName(),
+        'test_empty_string' => '**EMPTY FIELD**' . $this->randomMachineName(),
       ),
     );
     // $this->entity is set by the setUp() method and by default contains 4
diff --git a/core/modules/field/lib/Drupal/field/Tests/Email/EmailFieldTest.php b/core/modules/field/lib/Drupal/field/Tests/Email/EmailFieldTest.php
index 4197798..4085068 100644
--- a/core/modules/field/lib/Drupal/field/Tests/Email/EmailFieldTest.php
+++ b/core/modules/field/lib/Drupal/field/Tests/Email/EmailFieldTest.php
@@ -59,7 +59,7 @@ function setUp() {
    */
   function testEmailField() {
     // Create a field with settings to validate.
-    $field_name = drupal_strtolower($this->randomName());
+    $field_name = drupal_strtolower($this->randomMachineName());
     $this->field = entity_create('field_config', array(
       'name' => $field_name,
       'entity_type' => 'entity_test',
@@ -98,7 +98,7 @@ function testEmailField() {
     $value = 'test@example.com';
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$field_name}[0][value]" => $value,
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
diff --git a/core/modules/field/lib/Drupal/field/Tests/Email/EmailItemTest.php b/core/modules/field/lib/Drupal/field/Tests/Email/EmailItemTest.php
index 8aa560b..0d3edcc 100644
--- a/core/modules/field/lib/Drupal/field/Tests/Email/EmailItemTest.php
+++ b/core/modules/field/lib/Drupal/field/Tests/Email/EmailItemTest.php
@@ -62,7 +62,7 @@ public function testEmailItem() {
     $entity = entity_create('entity_test');
     $value = 'test@example.com';
     $entity->field_email = $value;
-    $entity->name->value = $this->randomName();
+    $entity->name->value = $this->randomMachineName();
     $entity->save();
 
     // Verify entity has been created properly.
@@ -74,7 +74,7 @@ public function testEmailItem() {
     $this->assertEqual($entity->field_email[0]->value, $value);
 
     // Verify changing the email value.
-    $new_value = $this->randomName();
+    $new_value = $this->randomMachineName();
     $entity->field_email->value = $new_value;
     $this->assertEqual($entity->field_email->value, $new_value);
 
diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldAttachOtherTest.php b/core/modules/field/lib/Drupal/field/Tests/FieldAttachOtherTest.php
index 9e42126..4d39fd7 100644
--- a/core/modules/field/lib/Drupal/field/Tests/FieldAttachOtherTest.php
+++ b/core/modules/field/lib/Drupal/field/Tests/FieldAttachOtherTest.php
@@ -61,7 +61,7 @@ function testEntityDisplayBuild() {
     $entity = clone($entity_init);
     $display = entity_get_display($entity_type, $entity->bundle(), 'full');
 
-    $formatter_setting = $this->randomName();
+    $formatter_setting = $this->randomMachineName();
     $display_options = array(
       'label' => 'above',
       'type' => 'field_test_default',
@@ -71,7 +71,7 @@ function testEntityDisplayBuild() {
     );
     $display->setComponent($this->field->getName(), $display_options);
 
-    $formatter_setting_2 = $this->randomName();
+    $formatter_setting_2 = $this->randomMachineName();
     $display_options_2 = array(
       'label' => 'above',
       'type' => 'field_test_default',
@@ -113,7 +113,7 @@ function testEntityDisplayBuild() {
 
     // Multiple formatter.
     $entity = clone($entity_init);
-    $formatter_setting = $this->randomName();
+    $formatter_setting = $this->randomMachineName();
     $display->setComponent($this->field->getName(), array(
       'label' => 'above',
       'type' => 'field_test_multiple',
@@ -131,7 +131,7 @@ function testEntityDisplayBuild() {
 
     // Test a formatter that uses hook_field_formatter_prepare_view().
     $entity = clone($entity_init);
-    $formatter_setting = $this->randomName();
+    $formatter_setting = $this->randomMachineName();
     $display->setComponent($this->field->getName(), array(
       'label' => 'above',
       'type' => 'field_test_with_prepare_view',
diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldAttachStorageTest.php b/core/modules/field/lib/Drupal/field/Tests/FieldAttachStorageTest.php
index efb6ae8..b24bb3e 100644
--- a/core/modules/field/lib/Drupal/field/Tests/FieldAttachStorageTest.php
+++ b/core/modules/field/lib/Drupal/field/Tests/FieldAttachStorageTest.php
@@ -313,7 +313,7 @@ function testEntityCreateRenameBundle() {
     $cardinality = $this->field->getCardinality();
 
     // Create a new bundle.
-    $new_bundle = 'test_bundle_' . drupal_strtolower($this->randomName());
+    $new_bundle = 'test_bundle_' . drupal_strtolower($this->randomMachineName());
     entity_test_create_bundle($new_bundle, NULL, $entity_type);
 
     // Add an instance to that bundle.
@@ -330,7 +330,7 @@ function testEntityCreateRenameBundle() {
     $this->assertEqual(count($entity->{$this->field_name}), $cardinality, "Data is retrieved for the new bundle");
 
     // Rename the bundle.
-    $new_bundle = 'test_bundle_' . drupal_strtolower($this->randomName());
+    $new_bundle = 'test_bundle_' . drupal_strtolower($this->randomMachineName());
     entity_test_rename_bundle($this->instance_definition['bundle'], $new_bundle, $entity_type);
 
     // Check that the instance definition has been updated.
@@ -352,7 +352,7 @@ function testEntityDeleteBundle() {
     $this->createFieldWithInstance('', $entity_type);
 
     // Create a new bundle.
-    $new_bundle = 'test_bundle_' . drupal_strtolower($this->randomName());
+    $new_bundle = 'test_bundle_' . drupal_strtolower($this->randomMachineName());
     entity_test_create_bundle($new_bundle, NULL, $entity_type);
 
     // Add an instance to that bundle.
@@ -360,7 +360,7 @@ function testEntityDeleteBundle() {
     entity_create('field_instance_config', $this->instance_definition)->save();
 
     // Create a second field for the test bundle
-    $field_name = drupal_strtolower($this->randomName() . '_field_name');
+    $field_name = drupal_strtolower($this->randomMachineName() . '_field_name');
     $field = array(
       'name' => $field_name,
       'entity_type' => $entity_type,
@@ -372,8 +372,8 @@ function testEntityDeleteBundle() {
       'field_name' => $field_name,
       'entity_type' => $entity_type,
       'bundle' => $this->instance->bundle,
-      'label' => $this->randomName() . '_label',
-      'description' => $this->randomName() . '_description',
+      'label' => $this->randomMachineName() . '_label',
+      'description' => $this->randomMachineName() . '_description',
       'weight' => mt_rand(0, 127),
     );
     entity_create('field_instance_config', $instance)->save();
diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php b/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php
index 4999a83..c6e1a9c 100644
--- a/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php
+++ b/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php
@@ -44,7 +44,7 @@ function testFieldInfo() {
     // Create a field, verify it shows up.
     $core_fields = field_info_fields();
     $field = entity_create('field_config', array(
-      'name' => drupal_strtolower($this->randomName()),
+      'name' => drupal_strtolower($this->randomMachineName()),
       'entity_type' => 'entity_test',
       'type' => 'test_field',
     ));
@@ -65,8 +65,8 @@ function testFieldInfo() {
       'field_name' => $field->getName(),
       'entity_type' => 'entity_test',
       'bundle' => 'entity_test',
-      'label' => $this->randomName(),
-      'description' => $this->randomName(),
+      'label' => $this->randomMachineName(),
+      'description' => $this->randomMachineName(),
       'weight' => mt_rand(0, 127),
     );
     $instance = entity_create('field_instance_config', $instance_definition);
@@ -303,7 +303,7 @@ function testSettingsInfo() {
   function testFieldInfoCache() {
     // Create a test field and ensure it's in the array returned by
     // field_info_fields().
-    $field_name = drupal_strtolower($this->randomName());
+    $field_name = drupal_strtolower($this->randomMachineName());
     $field = entity_create('field_config', array(
       'name' => $field_name,
       'entity_type' => 'entity_test',
diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldInstanceCrudTest.php b/core/modules/field/lib/Drupal/field/Tests/FieldInstanceCrudTest.php
index f8a02ab..1d48919 100644
--- a/core/modules/field/lib/Drupal/field/Tests/FieldInstanceCrudTest.php
+++ b/core/modules/field/lib/Drupal/field/Tests/FieldInstanceCrudTest.php
@@ -45,7 +45,7 @@ function setUp() {
     parent::setUp();
 
     $this->field_definition = array(
-      'name' => drupal_strtolower($this->randomName()),
+      'name' => drupal_strtolower($this->randomMachineName()),
       'entity_type' => 'entity_test',
       'type' => 'test_field',
     );
@@ -96,7 +96,7 @@ function testCreateFieldInstance() {
 
     // Check that the specified field exists.
     try {
-      $this->instance_definition['field_name'] = $this->randomName();
+      $this->instance_definition['field_name'] = $this->randomMachineName();
       entity_create('field_instance_config', $this->instance_definition)->save();
       $this->fail(t('Cannot create an instance of a non-existing field.'));
     }
@@ -129,9 +129,9 @@ function testUpdateFieldInstance() {
     // Check that basic changes are saved.
     $instance = entity_load('field_instance_config', 'entity_test.' . $this->instance_definition['bundle'] . '.' . $this->instance_definition['field_name']);
     $instance->required = !$instance->isRequired();
-    $instance->label = $this->randomName();
-    $instance->description = $this->randomName();
-    $instance->settings['test_instance_setting'] = $this->randomName();
+    $instance->label = $this->randomMachineName();
+    $instance->description = $this->randomMachineName();
+    $instance->settings['test_instance_setting'] = $this->randomMachineName();
     $instance->save();
 
     $instance_new = entity_load('field_instance_config', 'entity_test.' . $this->instance_definition['bundle'] . '.' . $this->instance_definition['field_name']);
diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldUnitTestBase.php b/core/modules/field/lib/Drupal/field/Tests/FieldUnitTestBase.php
index 5f77d92..b9c8b79 100644
--- a/core/modules/field/lib/Drupal/field/Tests/FieldUnitTestBase.php
+++ b/core/modules/field/lib/Drupal/field/Tests/FieldUnitTestBase.php
@@ -67,7 +67,7 @@ function createFieldWithInstance($suffix = '', $entity_type = 'entity_test', $bu
     $instance = 'instance' . $suffix;
     $instance_definition = 'instance_definition' . $suffix;
 
-    $this->$field_name = drupal_strtolower($this->randomName() . '_field_name' . $suffix);
+    $this->$field_name = drupal_strtolower($this->randomMachineName() . '_field_name' . $suffix);
     $this->$field = entity_create('field_config', array(
       'name' => $this->$field_name,
       'entity_type' => $entity_type,
@@ -80,10 +80,10 @@ function createFieldWithInstance($suffix = '', $entity_type = 'entity_test', $bu
       'field_name' => $this->$field_name,
       'entity_type' => $entity_type,
       'bundle' => $bundle,
-      'label' => $this->randomName() . '_label',
-      'description' => $this->randomName() . '_description',
+      'label' => $this->randomMachineName() . '_label',
+      'description' => $this->randomMachineName() . '_description',
       'settings' => array(
-        'test_instance_setting' => $this->randomName(),
+        'test_instance_setting' => $this->randomMachineName(),
       ),
     );
     $this->$instance = entity_create('field_instance_config', $this->$instance_definition);
@@ -93,7 +93,7 @@ function createFieldWithInstance($suffix = '', $entity_type = 'entity_test', $bu
       ->setComponent($this->$field_name, array(
         'type' => 'test_field_widget',
         'settings' => array(
-          'test_widget_setting' => $this->randomName(),
+          'test_widget_setting' => $this->randomMachineName(),
         )
       ))
       ->save();
diff --git a/core/modules/field/lib/Drupal/field/Tests/FormTest.php b/core/modules/field/lib/Drupal/field/Tests/FormTest.php
index bbfccb7..965c285 100644
--- a/core/modules/field/lib/Drupal/field/Tests/FormTest.php
+++ b/core/modules/field/lib/Drupal/field/Tests/FormTest.php
@@ -81,11 +81,11 @@ function setUp() {
     $this->instance = array(
       'entity_type' => 'entity_test',
       'bundle' => 'entity_test',
-      'label' => $this->randomName() . '_label',
+      'label' => $this->randomMachineName() . '_label',
       'description' => '[site:name]_description',
       'weight' => mt_rand(0, 127),
       'settings' => array(
-        'test_instance_setting' => $this->randomName(),
+        'test_instance_setting' => $this->randomMachineName(),
       ),
     );
   }
@@ -116,7 +116,7 @@ function testFieldFormSingle() {
     // Submit with invalid value (field-level validation).
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$field_name}[0][value]" => -1
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -127,7 +127,7 @@ function testFieldFormSingle() {
     $value = mt_rand(1, 127);
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$field_name}[0][value]" => $value,
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -146,7 +146,7 @@ function testFieldFormSingle() {
     $value = mt_rand(1, 127);
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$field_name}[0][value]" => $value,
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -159,7 +159,7 @@ function testFieldFormSingle() {
     $value = '';
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$field_name}[0][value]" => $value
     );
     $this->drupalPostForm('entity_test/manage/' . $id, $edit, t('Save'));
@@ -192,7 +192,7 @@ function testFieldFormDefaultValue() {
     // Try to submit an empty value.
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$field_name}[0][value]" => '',
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -223,7 +223,7 @@ function testFieldFormSingleRequired() {
     $value = mt_rand(1, 127);
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$field_name}[0][value]" => $value,
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -237,7 +237,7 @@ function testFieldFormSingleRequired() {
     $value = '';
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$field_name}[0][value]" => $value,
     );
     $this->drupalPostForm('entity_test/manage/' . $id, $edit, t('Save'));
@@ -283,7 +283,7 @@ function testFieldFormUnlimited() {
     $values = $weights = $pattern = $expected_values = array();
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
     );
     for ($delta = 0; $delta <= $delta_range; $delta++) {
       // Assign unique random values and weights.
@@ -465,7 +465,7 @@ function testFieldFormMultipleWidget() {
     // Create entity with three values.
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       $field_name => '1, 2, 3',
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -546,7 +546,7 @@ function testFieldFormAccess() {
     // Create entity.
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$field_name}[0][value]" => 1,
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -561,7 +561,7 @@ function testFieldFormAccess() {
     // Create a new revision.
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$field_name}[0][value]" => 2,
       'revision' => TRUE,
     );
@@ -603,7 +603,7 @@ function testHiddenField() {
     // Create an entity and test that the default value is assigned correctly to
     // the field that uses the hidden widget.
     $this->assertNoField("{$field_name}[0][value]", 'The field does not appear in the form');
-    $this->drupalPostForm(NULL, array('user_id' => 1, 'name' => $this->randomName()), t('Save'));
+    $this->drupalPostForm(NULL, array('user_id' => 1, 'name' => $this->randomMachineName()), t('Save'));
     preg_match('|' . $entity_type . '/manage/(\d+)|', $this->url, $match);
     $id = $match[1];
     $this->assertText(t('entity_test_rev @id has been created.', array('@id' => $id)), 'Entity was created');
diff --git a/core/modules/field/lib/Drupal/field/Tests/NestedFormTest.php b/core/modules/field/lib/Drupal/field/Tests/NestedFormTest.php
index d120b95..337841d 100644
--- a/core/modules/field/lib/Drupal/field/Tests/NestedFormTest.php
+++ b/core/modules/field/lib/Drupal/field/Tests/NestedFormTest.php
@@ -47,11 +47,11 @@ public function setUp() {
     $this->instance = array(
       'entity_type' => 'entity_test',
       'bundle' => 'entity_test',
-      'label' => $this->randomName() . '_label',
+      'label' => $this->randomMachineName() . '_label',
       'description' => '[site:name]_description',
       'weight' => mt_rand(0, 127),
       'settings' => array(
-        'test_instance_setting' => $this->randomName(),
+        'test_instance_setting' => $this->randomMachineName(),
       ),
     );
   }
diff --git a/core/modules/field/lib/Drupal/field/Tests/Number/NumberFieldTest.php b/core/modules/field/lib/Drupal/field/Tests/Number/NumberFieldTest.php
index 569ea05..efc35b7 100644
--- a/core/modules/field/lib/Drupal/field/Tests/Number/NumberFieldTest.php
+++ b/core/modules/field/lib/Drupal/field/Tests/Number/NumberFieldTest.php
@@ -62,7 +62,7 @@ function setUp() {
    */
   function testNumberDecimalField() {
     // Create a field with settings to validate.
-    $field_name = drupal_strtolower($this->randomName());
+    $field_name = drupal_strtolower($this->randomMachineName());
     entity_create('field_config', array(
       'name' => $field_name,
       'entity_type' => 'entity_test',
@@ -100,7 +100,7 @@ function testNumberDecimalField() {
     $value = '-1234.5678';
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$field_name}[0][value]" => $value,
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -154,7 +154,7 @@ function testNumberIntegerField() {
     $maximum = rand(2000, 4000);
 
     // Create a field with settings to validate.
-    $field_name = drupal_strtolower($this->randomName());
+    $field_name = drupal_strtolower($this->randomMachineName());
     entity_create('field_config', array(
       'name' => $field_name,
       'entity_type' => 'entity_test',
@@ -193,7 +193,7 @@ function testNumberIntegerField() {
     $value = rand($minimum, $maximum);
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$field_name}[0][value]" => $value,
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -205,7 +205,7 @@ function testNumberIntegerField() {
     $this->drupalGet('entity_test/add');
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$field_name}[0][value]" => $minimum - 1,
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -215,7 +215,7 @@ function testNumberIntegerField() {
     $this->drupalGet('entity_test/add');
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$field_name}[0][value]" => 1.5,
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -225,7 +225,7 @@ function testNumberIntegerField() {
     $this->drupalGet('entity_test/add');
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$field_name}[0][value]" => $maximum + 1,
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -242,7 +242,7 @@ function testNumberIntegerField() {
       $this->drupalGet('entity_test/add');
       $edit = array(
         'user_id' => 1,
-        'name' => $this->randomName(),
+        'name' => $this->randomMachineName(),
         "{$field_name}[0][value]" => $valid_entry,
       );
       $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -258,7 +258,7 @@ function testNumberIntegerField() {
   */
   function testNumberFloatField() {
     // Create a field with settings to validate.
-    $field_name = drupal_strtolower($this->randomName());
+    $field_name = drupal_strtolower($this->randomMachineName());
     entity_create('field_config', array(
       'name' => $field_name,
       'entity_type' => 'entity_test',
@@ -295,7 +295,7 @@ function testNumberFloatField() {
     $value = '-1234.5678';
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$field_name}[0][value]" => $value,
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -345,13 +345,13 @@ function testNumberFloatField() {
    * Test default formatter behavior
    */
   function testNumberFormatter() {
-    $type = drupal_strtolower($this->randomName());
-    $float_field = drupal_strtolower($this->randomName());
-    $integer_field = drupal_strtolower($this->randomName());
+    $type = drupal_strtolower($this->randomMachineName());
+    $float_field = drupal_strtolower($this->randomMachineName());
+    $integer_field = drupal_strtolower($this->randomMachineName());
     $thousand_separators = array('', '.', ',', ' ', chr(8201), "'");
     $decimal_separators = array('.', ',');
-    $prefix = $this->randomName();
-    $suffix = $this->randomName();
+    $prefix = $this->randomMachineName();
+    $suffix = $this->randomMachineName();
     $random_float = rand(0,pow(10,6));
     $random_integer = rand(0, pow(10,6));
 
@@ -417,7 +417,7 @@ function testNumberFormatter() {
     // Create a node to test formatters.
     $node = entity_create('node', array(
       'type' => $type,
-      'title' => $this->randomName(),
+      'title' => $this->randomMachineName(),
       $float_field => array(
         'value' => $random_float,
       ),
diff --git a/core/modules/field/lib/Drupal/field/Tests/Number/NumberItemTest.php b/core/modules/field/lib/Drupal/field/Tests/Number/NumberItemTest.php
index 011bf09..a7ee858 100644
--- a/core/modules/field/lib/Drupal/field/Tests/Number/NumberItemTest.php
+++ b/core/modules/field/lib/Drupal/field/Tests/Number/NumberItemTest.php
@@ -61,7 +61,7 @@ public function testNumberItem() {
     $entity->field_float = $float;
     $decimal = '31.3';
     $entity->field_decimal = $decimal;
-    $entity->name->value = $this->randomName();
+    $entity->name->value = $this->randomMachineName();
     $entity->save();
 
     // Verify entity has been created properly.
diff --git a/core/modules/field/lib/Drupal/field/Tests/ShapeItemTest.php b/core/modules/field/lib/Drupal/field/Tests/ShapeItemTest.php
index d3afd9a..9047372 100644
--- a/core/modules/field/lib/Drupal/field/Tests/ShapeItemTest.php
+++ b/core/modules/field/lib/Drupal/field/Tests/ShapeItemTest.php
@@ -65,7 +65,7 @@ public function testShapeItem() {
     $color = 'blue';
     $entity->{$this->field_name}->shape = $shape;
     $entity->{$this->field_name}->color = $color;
-    $entity->name->value = $this->randomName();
+    $entity->name->value = $this->randomMachineName();
     $entity->save();
 
     // Verify entity has been created properly.
diff --git a/core/modules/field/lib/Drupal/field/Tests/TestItemTest.php b/core/modules/field/lib/Drupal/field/Tests/TestItemTest.php
index f48c48c..00d3b09 100644
--- a/core/modules/field/lib/Drupal/field/Tests/TestItemTest.php
+++ b/core/modules/field/lib/Drupal/field/Tests/TestItemTest.php
@@ -64,7 +64,7 @@ public function testTestItem() {
     $entity = entity_create('entity_test');
     $value = rand(1, 10);
     $entity->field_test = $value;
-    $entity->name->value = $this->randomName();
+    $entity->name->value = $this->randomMachineName();
     $entity->save();
 
     // Verify entity has been created properly.
diff --git a/core/modules/field/lib/Drupal/field/Tests/TranslationTest.php b/core/modules/field/lib/Drupal/field/Tests/TranslationTest.php
index 89af9c9..05b2f7d 100644
--- a/core/modules/field/lib/Drupal/field/Tests/TranslationTest.php
+++ b/core/modules/field/lib/Drupal/field/Tests/TranslationTest.php
@@ -81,7 +81,7 @@ function setUp() {
 
     $this->installConfig(array('language'));
 
-    $this->field_name = drupal_strtolower($this->randomName());
+    $this->field_name = drupal_strtolower($this->randomMachineName());
 
     $this->entity_type = 'entity_test';
 
@@ -146,7 +146,7 @@ function testTranslatableFieldSaveLoad() {
     }
 
     // Test default values.
-    $field_name_default = drupal_strtolower($this->randomName() . '_field_name');
+    $field_name_default = drupal_strtolower($this->randomMachineName() . '_field_name');
     $field_definition = $this->field_definition;
     $field_definition['name'] = $field_name_default;
     entity_create('field_config', $field_definition)->save();
diff --git a/core/modules/field/lib/Drupal/field/Tests/TranslationWebTest.php b/core/modules/field/lib/Drupal/field/Tests/TranslationWebTest.php
index ba00c74..4330591 100644
--- a/core/modules/field/lib/Drupal/field/Tests/TranslationWebTest.php
+++ b/core/modules/field/lib/Drupal/field/Tests/TranslationWebTest.php
@@ -60,7 +60,7 @@ public static function getInfo() {
   function setUp() {
     parent::setUp();
 
-    $this->field_name = drupal_strtolower($this->randomName() . '_field_name');
+    $this->field_name = drupal_strtolower($this->randomMachineName() . '_field_name');
 
     $field = array(
       'name' => $this->field_name,
@@ -117,7 +117,7 @@ function testFieldFormTranslationRevisions() {
     // Create a new revision.
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$field_name}[0][value]" => $entity->{$field_name}->value,
       'revision' => TRUE,
     );
diff --git a/core/modules/field/lib/Drupal/field/Tests/Views/ApiDataTest.php b/core/modules/field/lib/Drupal/field/Tests/Views/ApiDataTest.php
index be0d496..67111f8 100644
--- a/core/modules/field/lib/Drupal/field/Tests/Views/ApiDataTest.php
+++ b/core/modules/field/lib/Drupal/field/Tests/Views/ApiDataTest.php
@@ -42,7 +42,7 @@ function setUp() {
     // Now create some example nodes/users for the view result.
     for ($i = 0; $i < 5; $i++) {
       $edit = array(
-        $field_names[0] => array((array('value' => $this->randomName()))),
+        $field_names[0] => array((array('value' => $this->randomMachineName()))),
       );
       $nodes[] = $this->drupalCreateNode($edit);
     }
diff --git a/core/modules/field/lib/Drupal/field/Tests/Views/HandlerFieldFieldTest.php b/core/modules/field/lib/Drupal/field/Tests/Views/HandlerFieldFieldTest.php
index 9a25836..5a13ac4 100644
--- a/core/modules/field/lib/Drupal/field/Tests/Views/HandlerFieldFieldTest.php
+++ b/core/modules/field/lib/Drupal/field/Tests/Views/HandlerFieldFieldTest.php
@@ -74,10 +74,10 @@ protected function setUp() {
 
       for ($key = 0; $key < 3; $key++) {
         $field = $this->fields[$key];
-        $edit[$field->getName()][0]['value'] = $this->randomName(8);
+        $edit[$field->getName()][0]['value'] = $this->randomMachineName(8);
       }
       for ($j = 0; $j < 5; $j++) {
-        $edit[$this->fields[3]->getName()][$j]['value'] = $this->randomName(8);
+        $edit[$this->fields[3]->getName()][$j]['value'] = $this->randomMachineName(8);
       }
       // Set this field to be empty.
       $edit[$this->fields[4]->getName()] = array(array('value' => NULL));
diff --git a/core/modules/field/lib/Drupal/field/Tests/reEnableModuleFieldTest.php b/core/modules/field/lib/Drupal/field/Tests/reEnableModuleFieldTest.php
index 5702719..3d2e23c 100644
--- a/core/modules/field/lib/Drupal/field/Tests/reEnableModuleFieldTest.php
+++ b/core/modules/field/lib/Drupal/field/Tests/reEnableModuleFieldTest.php
@@ -85,7 +85,7 @@ function testReEnabledField() {
     // Submit an article node with a telephone field so data exist for the
     // field.
     $edit = array(
-      'title[0][value]' => $this->randomName(),
+      'title[0][value]' => $this->randomMachineName(),
       'field_telephone[0][value]' => "123456789",
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
diff --git a/core/modules/field/tests/Drupal/field/Tests/FieldConfigEntityUnitTest.php b/core/modules/field/tests/Drupal/field/Tests/FieldConfigEntityUnitTest.php
index 0e1c723..bd408fc 100644
--- a/core/modules/field/tests/Drupal/field/Tests/FieldConfigEntityUnitTest.php
+++ b/core/modules/field/tests/Drupal/field/Tests/FieldConfigEntityUnitTest.php
@@ -82,7 +82,7 @@ public function testCalculateDependencies() {
       ->will($this->returnValue('field'));
 
     // Create a mock entity type to attach the field to.
-    $attached_entity_type_id = $this->randomName();
+    $attached_entity_type_id = $this->randomMachineName();
     $attached_entity_type = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
     $attached_entity_type->expects($this->any())
       ->method('getProvider')
diff --git a/core/modules/field/tests/Drupal/field/Tests/FieldInstanceConfigEntityUnitTest.php b/core/modules/field/tests/Drupal/field/Tests/FieldInstanceConfigEntityUnitTest.php
index d8a43d4..1002995 100644
--- a/core/modules/field/tests/Drupal/field/Tests/FieldInstanceConfigEntityUnitTest.php
+++ b/core/modules/field/tests/Drupal/field/Tests/FieldInstanceConfigEntityUnitTest.php
@@ -69,7 +69,7 @@ public static function getInfo() {
    * {@inheritdoc}
    */
   public function setUp() {
-    $this->entityTypeId = $this->randomName();
+    $this->entityTypeId = $this->randomMachineName();
 
     $this->entityManager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface');
 
diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Tests/FieldUiTestBase.php b/core/modules/field_ui/lib/Drupal/field_ui/Tests/FieldUiTestBase.php
index f103e6d..eb7eeeb 100644
--- a/core/modules/field_ui/lib/Drupal/field_ui/Tests/FieldUiTestBase.php
+++ b/core/modules/field_ui/lib/Drupal/field_ui/Tests/FieldUiTestBase.php
@@ -30,15 +30,15 @@ function setUp() {
     $this->drupalLogin($admin_user);
 
     // Create content type, with underscores.
-    $type_name = strtolower($this->randomName(8)) . '_test';
+    $type_name = strtolower($this->randomMachineName(8)) . '_test';
     $type = $this->drupalCreateContentType(array('name' => $type_name, 'type' => $type_name));
     $this->type = $type->type;
 
     // Create a default vocabulary.
     $vocabulary = entity_create('taxonomy_vocabulary', array(
-      'name' => $this->randomName(),
-      'description' => $this->randomName(),
-      'vid' => drupal_strtolower($this->randomName()),
+      'name' => $this->randomMachineName(),
+      'description' => $this->randomMachineName(),
+      'vid' => drupal_strtolower($this->randomMachineName()),
       'langcode' => Language::LANGCODE_NOT_SPECIFIED,
       'help' => '',
       'nodes' => array('article' => 'article'),
diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php b/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php
index 8fd993f..a4d5e45 100644
--- a/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php
+++ b/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php
@@ -28,8 +28,8 @@ function setUp() {
     parent::setUp();
 
     // Create random field name.
-    $this->field_label = $this->randomName(8);
-    $this->field_name_input =  strtolower($this->randomName(8));
+    $this->field_label = $this->randomMachineName(8);
+    $this->field_name_input =  strtolower($this->randomMachineName(8));
     $this->field_name = 'field_'. $this->field_name_input;
 
     // Create Basic page and Article node types.
@@ -259,12 +259,12 @@ function assertFieldSettings($bundle, $field_name, $string = 'dummy test string'
    */
   function testFieldPrefix() {
     // Change default field prefix.
-    $field_prefix = strtolower($this->randomName(10));
+    $field_prefix = strtolower($this->randomMachineName(10));
     \Drupal::config('field_ui.settings')->set('field_prefix', $field_prefix)->save();
 
     // Create a field input and label exceeding the new maxlength, which is 22.
     $field_exceed_max_length_label = $this->randomString(23);
-    $field_exceed_max_length_input = $this->randomName(23);
+    $field_exceed_max_length_input = $this->randomMachineName(23);
 
     // Try to create the field.
     $edit = array(
@@ -357,7 +357,7 @@ function testDeleteField() {
     $this->fieldUIAddNewField($bundle_path1, $edit1);
 
     // Create an additional node type.
-    $type_name2 = strtolower($this->randomName(8)) . '_test';
+    $type_name2 = strtolower($this->randomMachineName(8)) . '_test';
     $type2 = $this->drupalCreateContentType(array('name' => $type_name2, 'type' => $type_name2));
     $type_name2 = $type2->type;
 
@@ -423,7 +423,7 @@ function testLockedField() {
     // Create a locked field and attach it to a bundle. We need to do this
     // programatically as there's no way to create a locked field through UI.
     $field = entity_create('field_config', array(
-      'name' => strtolower($this->randomName(8)),
+      'name' => strtolower($this->randomMachineName(8)),
       'entity_type' => 'node',
       'type' => 'test_field',
       'cardinality' => 1,
@@ -509,7 +509,7 @@ function testHiddenFields() {
    * Tests renaming a bundle.
    */
   function testRenameBundle() {
-    $type2 = strtolower($this->randomName(8)) . '_test';
+    $type2 = strtolower($this->randomMachineName(8)) . '_test';
 
     $options = array(
       'type' => $type2,
@@ -526,7 +526,7 @@ function testDuplicateFieldName() {
     // create a new field with the same name.
     $edit = array(
       'fields[_add_new_field][field_name]' => 'tags',
-      'fields[_add_new_field][label]' => $this->randomName(),
+      'fields[_add_new_field][label]' => $this->randomMachineName(),
       'fields[_add_new_field][type]' => 'taxonomy_term_reference',
     );
     $url = 'admin/structure/types/manage/' . $this->type . '/fields';
diff --git a/core/modules/file/lib/Drupal/file/Tests/CopyTest.php b/core/modules/file/lib/Drupal/file/Tests/CopyTest.php
index 9fb0ed1..931fc80 100644
--- a/core/modules/file/lib/Drupal/file/Tests/CopyTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/CopyTest.php
@@ -23,9 +23,9 @@ public static function getInfo() {
    * Test file copying in the normal, base case.
    */
   function testNormal() {
-    $contents = $this->randomName(10);
+    $contents = $this->randomMachineName(10);
     $source = $this->createFile(NULL, $contents);
-    $desired_uri = 'public://' . $this->randomName();
+    $desired_uri = 'public://' . $this->randomMachineName();
 
     // Clone the object so we don't have to worry about the function changing
     // our reference copy.
@@ -53,7 +53,7 @@ function testNormal() {
    */
   function testExistingRename() {
     // Setup a file to overwrite.
-    $contents = $this->randomName(10);
+    $contents = $this->randomMachineName(10);
     $source = $this->createFile(NULL, $contents);
     $target = $this->createFile();
     $this->assertDifferentFile($source, $target);
@@ -93,7 +93,7 @@ function testExistingRename() {
    */
   function testExistingReplace() {
     // Setup a file to overwrite.
-    $contents = $this->randomName(10);
+    $contents = $this->randomMachineName(10);
     $source = $this->createFile(NULL, $contents);
     $target = $this->createFile();
     $this->assertDifferentFile($source, $target);
@@ -131,7 +131,7 @@ function testExistingReplace() {
    * specified.
    */
   function testExistingError() {
-    $contents = $this->randomName(10);
+    $contents = $this->randomMachineName(10);
     $source = $this->createFile();
     $target = $this->createFile(NULL, $contents);
     $this->assertDifferentFile($source, $target);
diff --git a/core/modules/file/lib/Drupal/file/Tests/DownloadTest.php b/core/modules/file/lib/Drupal/file/Tests/DownloadTest.php
index e39b39c..72f5356 100644
--- a/core/modules/file/lib/Drupal/file/Tests/DownloadTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/DownloadTest.php
@@ -57,7 +57,7 @@ function testPrivateFileTransfer() {
     // Set file downloads to private so handler functions get called.
 
     // Create a file.
-    $contents = $this->randomName(8);
+    $contents = $this->randomMachineName(8);
     $file = $this->createFile(NULL, $contents, 'private');
     $url  = file_create_url($file->getFileUri());
 
@@ -77,7 +77,7 @@ function testPrivateFileTransfer() {
     $this->assertResponse(403, 'Correctly denied access to a file when file_test sets the header to -1.');
 
     // Try non-existent file.
-    $url = file_create_url('private://' . $this->randomName());
+    $url = file_create_url('private://' . $this->randomMachineName());
     $this->drupalHead($url);
     $this->assertResponse(404, 'Correctly returned 404 response for a non-existent file.');
   }
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldDisplayTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldDisplayTest.php
index 219c083..1a93874 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldDisplayTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldDisplayTest.php
@@ -26,7 +26,7 @@ public static function getInfo() {
    * Tests normal formatter display on node display.
    */
   function testNodeDisplay() {
-    $field_name = strtolower($this->randomName());
+    $field_name = strtolower($this->randomMachineName());
     $type_name = 'article';
     $field_settings = array(
       'display_field' => '1',
@@ -76,7 +76,7 @@ function testNodeDisplay() {
     $this->assertNoRaw($default_output, 'Field is hidden when "display" option is unchecked.');
 
     // Add a description and make sure that it is displayed.
-    $description = $this->randomName();
+    $description = $this->randomMachineName();
     $edit = array(
       $field_name . '[0][description]' => $description,
       $field_name . '[0][display]' => TRUE,
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldPathTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldPathTest.php
index 3366b2b..7af55d8 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldPathTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldPathTest.php
@@ -25,7 +25,7 @@ public static function getInfo() {
    * Tests the normal formatter display on node display.
    */
   function testUploadPath() {
-    $field_name = strtolower($this->randomName());
+    $field_name = strtolower($this->randomMachineName());
     $type_name = 'article';
     $this->createFileField($field_name, 'node', $type_name);
     $test_file = $this->getTestFile('text');
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldRSSContentTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldRSSContentTest.php
index ba46dc6..de1d675 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldRSSContentTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldRSSContentTest.php
@@ -33,7 +33,7 @@ public static function getInfo() {
    * Tests RSS enclosure formatter display for RSS feeds.
    */
   function testFileFieldRSSContent() {
-    $field_name = strtolower($this->randomName());
+    $field_name = strtolower($this->randomMachineName());
     $type_name = 'article';
     $field_settings = array(
       'display_field' => '1',
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php
index f586446..253fd93 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php
@@ -34,7 +34,7 @@ public static function getInfo() {
    */
   function testRevisions() {
     $type_name = 'article';
-    $field_name = strtolower($this->randomName());
+    $field_name = strtolower($this->randomMachineName());
     $this->createFileField($field_name, 'node', $type_name);
     // Create the same fields for users.
     $this->createFileField($field_name, 'user', 'user');
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldTestBase.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldTestBase.php
index a7df01d..b299ac9 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldTestBase.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldTestBase.php
@@ -139,7 +139,7 @@ function updateFileField($name, $type_name, $instance_settings = array(), $widge
    */
   function uploadNodeFile($file, $field_name, $nid_or_type, $new_revision = TRUE, $extras = array()) {
     $edit = array(
-      'title[0][value]' => $this->randomName(),
+      'title[0][value]' => $this->randomMachineName(),
       'revision' => (string) (int) $new_revision,
     );
 
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldValidateTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldValidateTest.php
index b85b187..f9e82bc 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldValidateTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldValidateTest.php
@@ -30,7 +30,7 @@ public static function getInfo() {
    */
   function testRequired() {
     $type_name = 'article';
-    $field_name = strtolower($this->randomName());
+    $field_name = strtolower($this->randomMachineName());
     $field = $this->createFileField($field_name, 'node', $type_name, array(), array('required' => '1'));
     $instance = Field::fieldInfo()->getInstance('node', $type_name, $field_name);
 
@@ -38,7 +38,7 @@ function testRequired() {
 
     // Try to post a new node without uploading a file.
     $edit = array();
-    $edit['title[0][value]'] = $this->randomName();
+    $edit['title[0][value]'] = $this->randomMachineName();
     $this->drupalPostForm('node/add/' . $type_name, $edit, t('Save and publish'));
     $this->assertRaw(t('!title field is required.', array('!title' => $instance->getLabel())), 'Node save failed when required file field was empty.');
 
@@ -58,7 +58,7 @@ function testRequired() {
 
     // Try to post a new node without uploading a file in the multivalue field.
     $edit = array();
-    $edit['title[0][value]'] = $this->randomName();
+    $edit['title[0][value]'] = $this->randomMachineName();
     $this->drupalPostForm('node/add/' . $type_name, $edit, t('Save and publish'));
     $this->assertRaw(t('!title field is required.', array('!title' => $instance->getLabel())), 'Node save failed when required multiple value file field was empty.');
 
@@ -75,7 +75,7 @@ function testRequired() {
    */
   function testFileMaxSize() {
     $type_name = 'article';
-    $field_name = strtolower($this->randomName());
+    $field_name = strtolower($this->randomMachineName());
     $this->createFileField($field_name, 'node', $type_name, array(), array('required' => '1'));
 
     $small_file = $this->getTestFile('text', 131072); // 128KB.
@@ -121,7 +121,7 @@ function testFileMaxSize() {
    */
   function testFileExtension() {
     $type_name = 'article';
-    $field_name = strtolower($this->randomName());
+    $field_name = strtolower($this->randomMachineName());
     $this->createFileField($field_name, 'node', $type_name);
 
     $test_file = $this->getTestFile('image');
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php
index bf80c17..feef142 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php
@@ -32,7 +32,7 @@ public static function getInfo() {
    */
   function testSingleValuedWidget() {
     $type_name = 'article';
-    $field_name = strtolower($this->randomName());
+    $field_name = strtolower($this->randomMachineName());
     $this->createFileField($field_name, 'node', $type_name);
 
     $test_file = $this->getTestFile('text');
@@ -189,7 +189,7 @@ function testMultiValuedWidget() {
       $this->assertNoFieldByXPath('//input[@type="submit"]', t('Remove'), format_string('After removing all files, there is no "Remove" button displayed (JSMode=%type).', array('%type' => $type)));
 
       // Save the node and ensure it does not have any files.
-      $this->drupalPostForm(NULL, array('title[0][value]' => $this->randomName()), t('Save and publish'));
+      $this->drupalPostForm(NULL, array('title[0][value]' => $this->randomMachineName()), t('Save and publish'));
       $matches = array();
       preg_match('/node\/([0-9]+)/', $this->getUrl(), $matches);
       $nid = $matches[1];
@@ -206,7 +206,7 @@ function testPrivateFileSetting() {
     user_role_grant_permissions($this->admin_user->roles[0]->value, array('administer node fields'));
 
     $type_name = 'article';
-    $field_name = strtolower($this->randomName());
+    $field_name = strtolower($this->randomMachineName());
     $this->createFileField($field_name, 'node', $type_name);
     $instance = field_info_instance('node', $field_name, $type_name);
 
@@ -253,8 +253,8 @@ function testPrivateFileComment() {
     // Create a new field.
     $this->container->get('comment.manager')->addDefaultField('node', 'article');
     $edit = array(
-      'fields[_add_new_field][label]' => $label = $this->randomName(),
-      'fields[_add_new_field][field_name]' => $name = strtolower($this->randomName()),
+      'fields[_add_new_field][label]' => $label = $this->randomMachineName(),
+      'fields[_add_new_field][field_name]' => $name = strtolower($this->randomMachineName()),
       'fields[_add_new_field][type]' => 'file',
     );
     $this->drupalPostForm('admin/structure/comments/manage/node__comment/fields', $edit, t('Save'));
@@ -267,7 +267,7 @@ function testPrivateFileComment() {
 
     // Create node.
     $edit = array(
-      'title[0][value]' => $this->randomName(),
+      'title[0][value]' => $this->randomMachineName(),
     );
     $this->drupalPostForm('node/add/article', $edit, t('Save and publish'));
     $node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
@@ -276,7 +276,7 @@ function testPrivateFileComment() {
     $text_file = $this->getTestFile('text');
     $edit = array(
       'files[field_' . $name . '_' . 0 . ']' => drupal_realpath($text_file->getFileUri()),
-      'comment_body[0][value]' => $comment_body = $this->randomName(),
+      'comment_body[0][value]' => $comment_body = $this->randomMachineName(),
     );
     $this->drupalPostForm('node/' . $node->id(), $edit, t('Save'));
 
@@ -316,7 +316,7 @@ function testPrivateFileComment() {
    */
   function testWidgetValidation() {
     $type_name = 'article';
-    $field_name = strtolower($this->randomName());
+    $field_name = strtolower($this->randomMachineName());
     $this->createFileField($field_name, 'node', $type_name);
     $this->updateFileField($field_name, $type_name, array('file_extensions' => 'txt'));
 
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileItemTest.php b/core/modules/file/lib/Drupal/file/Tests/FileItemTest.php
index 0f40a14..826191d 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileItemTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileItemTest.php
@@ -56,7 +56,7 @@ public function setUp() {
       'field_name' => 'file_test',
       'bundle' => 'entity_test',
     ))->save();
-    file_put_contents('public://example.txt', $this->randomName());
+    file_put_contents('public://example.txt', $this->randomMachineName());
     $this->file = entity_create('file', array(
       'uri' => 'public://example.txt',
     ));
@@ -71,8 +71,8 @@ public function testFileItem() {
     $entity = entity_create('entity_test');
     $entity->file_test->target_id = $this->file->id();
     $entity->file_test->display = 1;
-    $entity->file_test->description = $description = $this->randomName();
-    $entity->name->value = $this->randomName();
+    $entity->file_test->description = $description = $this->randomMachineName();
+    $entity->name->value = $this->randomMachineName();
     $entity->save();
 
     $entity = entity_load('entity_test', $entity->id());
@@ -86,7 +86,7 @@ public function testFileItem() {
     $this->assertEqual($entity->file_test->entity->uuid(), $this->file->uuid());
 
     // Make sure the computed files reflects updates to the file.
-    file_put_contents('public://example-2.txt', $this->randomName());
+    file_put_contents('public://example-2.txt', $this->randomMachineName());
     $file2 = entity_create('file', array(
       'uri' => 'public://example-2.txt',
     ));
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileManagedTestBase.php b/core/modules/file/lib/Drupal/file/Tests/FileManagedTestBase.php
index c777691..04d16dc 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileManagedTestBase.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileManagedTestBase.php
@@ -188,7 +188,7 @@ function createUri($filepath = NULL, $contents = NULL, $scheme = NULL) {
     if (!isset($filepath)) {
       // Prefix with non-latin characters to ensure that all file-related
       // tests work with international filenames.
-      $filepath = 'Файл для тестирования ' . $this->randomName();
+      $filepath = 'Файл для тестирования ' . $this->randomMachineName();
     }
     if (!isset($scheme)) {
       $scheme = file_default_scheme();
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileManagedUnitTestBase.php b/core/modules/file/lib/Drupal/file/Tests/FileManagedUnitTestBase.php
index c9ec86d..0f4d645 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileManagedUnitTestBase.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileManagedUnitTestBase.php
@@ -34,7 +34,7 @@ function setUp() {
 
     // Make sure that a user with uid 1 exists, self::createFile() relies on
     // it.
-    $user = entity_create('user', array('uid' => 1, 'name' => $this->randomName()));
+    $user = entity_create('user', array('uid' => 1, 'name' => $this->randomMachineName()));
     $user->enforceIsNew();
     $user->save();
     \Drupal::currentUser()->setAccount($user);
@@ -197,7 +197,7 @@ function createUri($filepath = NULL, $contents = NULL, $scheme = NULL) {
     if (!isset($filepath)) {
       // Prefix with non-latin characters to ensure that all file-related
       // tests work with international filenames.
-      $filepath = 'Файл для тестирования ' . $this->randomName();
+      $filepath = 'Файл для тестирования ' . $this->randomMachineName();
     }
     if (!isset($scheme)) {
       $scheme = file_default_scheme();
diff --git a/core/modules/file/lib/Drupal/file/Tests/FilePrivateTest.php b/core/modules/file/lib/Drupal/file/Tests/FilePrivateTest.php
index e51ba64..d70a920 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FilePrivateTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FilePrivateTest.php
@@ -40,7 +40,7 @@ public function setUp() {
    */
   function testPrivateFile() {
     $type_name = 'article';
-    $field_name = strtolower($this->randomName());
+    $field_name = strtolower($this->randomMachineName());
     $this->createFileField($field_name, 'node', $type_name, array('uri_scheme' => 'private'));
 
     // Create a field with no view access. See
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php b/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php
index 35bb593..5b58d76 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php
@@ -30,7 +30,7 @@ function testFileTokenReplacement() {
 
     // Create file field.
     $type_name = 'article';
-    $field_name = 'field_' . strtolower($this->randomName());
+    $field_name = 'field_' . strtolower($this->randomMachineName());
     $this->createFileField($field_name, 'node', $type_name);
 
     $test_file = $this->getTestFile('text');
diff --git a/core/modules/file/lib/Drupal/file/Tests/MoveTest.php b/core/modules/file/lib/Drupal/file/Tests/MoveTest.php
index b063afa..dcf63aa 100644
--- a/core/modules/file/lib/Drupal/file/Tests/MoveTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/MoveTest.php
@@ -23,9 +23,9 @@ public static function getInfo() {
    * Move a normal file.
    */
   function testNormal() {
-    $contents = $this->randomName(10);
+    $contents = $this->randomMachineName(10);
     $source = $this->createFile(NULL, $contents);
-    $desired_filepath = 'public://' . $this->randomName();
+    $desired_filepath = 'public://' . $this->randomMachineName();
 
     // Clone the object so we don't have to worry about the function changing
     // our reference copy.
@@ -54,7 +54,7 @@ function testNormal() {
    */
   function testExistingRename() {
     // Setup a file to overwrite.
-    $contents = $this->randomName(10);
+    $contents = $this->randomMachineName(10);
     $source = $this->createFile(NULL, $contents);
     $target = $this->createFile();
     $this->assertDifferentFile($source, $target);
@@ -89,7 +89,7 @@ function testExistingRename() {
    */
   function testExistingReplace() {
     // Setup a file to overwrite.
-    $contents = $this->randomName(10);
+    $contents = $this->randomMachineName(10);
     $source = $this->createFile(NULL, $contents);
     $target = $this->createFile();
     $this->assertDifferentFile($source, $target);
@@ -121,7 +121,7 @@ function testExistingReplace() {
    */
   function testExistingReplaceSelf() {
     // Setup a file to overwrite.
-    $contents = $this->randomName(10);
+    $contents = $this->randomMachineName(10);
     $source = $this->createFile(NULL, $contents);
 
     // Copy the file over itself. Clone the object so we don't have to worry
@@ -143,7 +143,7 @@ function testExistingReplaceSelf() {
    * specified.
    */
   function testExistingError() {
-    $contents = $this->randomName(10);
+    $contents = $this->randomMachineName(10);
     $source = $this->createFile();
     $target = $this->createFile(NULL, $contents);
     $this->assertDifferentFile($source, $target);
diff --git a/core/modules/file/lib/Drupal/file/Tests/SaveDataTest.php b/core/modules/file/lib/Drupal/file/Tests/SaveDataTest.php
index 081b6b3..76d3d2c 100644
--- a/core/modules/file/lib/Drupal/file/Tests/SaveDataTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/SaveDataTest.php
@@ -23,7 +23,7 @@ public static function getInfo() {
    * Test the file_save_data() function when no filename is provided.
    */
   function testWithoutFilename() {
-    $contents = $this->randomName(8);
+    $contents = $this->randomMachineName(8);
 
     $result = file_save_data($contents);
     $this->assertTrue($result, 'Unnamed file saved correctly.');
@@ -45,7 +45,7 @@ function testWithoutFilename() {
    * Test the file_save_data() function when a filename is provided.
    */
   function testWithFilename() {
-    $contents = $this->randomName(8);
+    $contents = $this->randomMachineName(8);
 
     // Using filename with non-latin characters.
     $filename = 'Текстовый файл.txt';
@@ -72,7 +72,7 @@ function testWithFilename() {
   function testExistingRename() {
     // Setup a file to overwrite.
     $existing = $this->createFile();
-    $contents = $this->randomName(8);
+    $contents = $this->randomMachineName(8);
 
     $result = file_save_data($contents, $existing->getFileUri(), FILE_EXISTS_RENAME);
     $this->assertTrue($result, 'File saved successfully.');
@@ -100,7 +100,7 @@ function testExistingRename() {
   function testExistingReplace() {
     // Setup a file to overwrite.
     $existing = $this->createFile();
-    $contents = $this->randomName(8);
+    $contents = $this->randomMachineName(8);
 
     $result = file_save_data($contents, $existing->getFileUri(), FILE_EXISTS_REPLACE);
     $this->assertTrue($result, 'File saved successfully.');
@@ -125,7 +125,7 @@ function testExistingReplace() {
    * Test that file_save_data() fails overwriting an existing file.
    */
   function testExistingError() {
-    $contents = $this->randomName(8);
+    $contents = $this->randomMachineName(8);
     $existing = $this->createFile(NULL, $contents);
 
     // Check the overwrite error.
diff --git a/core/modules/file/lib/Drupal/file/Tests/SaveUploadTest.php b/core/modules/file/lib/Drupal/file/Tests/SaveUploadTest.php
index 6596f87..0f07189 100644
--- a/core/modules/file/lib/Drupal/file/Tests/SaveUploadTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/SaveUploadTest.php
@@ -103,7 +103,7 @@ function testNormal() {
     // Upload a third file to a subdirectory.
     $image3 = current($this->drupalGetTestFiles('image'));
     $image3_realpath = drupal_realpath($image3->uri);
-    $dir = $this->randomName();
+    $dir = $this->randomMachineName();
     $edit = array(
       'files[file_test_upload]' => $image3_realpath,
       'file_subdir' => $dir,
diff --git a/core/modules/file/lib/Drupal/file/Tests/ValidatorTest.php b/core/modules/file/lib/Drupal/file/Tests/ValidatorTest.php
index 398860c..31759ba 100644
--- a/core/modules/file/lib/Drupal/file/Tests/ValidatorTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/ValidatorTest.php
@@ -130,7 +130,7 @@ function testFileValidateNameLength() {
    */
   function testFileValidateSize() {
     // Run these tests as a regular user.
-    $user = entity_create('user', array('uid' => 2, 'name' => $this->randomName()));
+    $user = entity_create('user', array('uid' => 2, 'name' => $this->randomMachineName()));
     $user->enforceIsNew();
     $user->save();
     \Drupal::currentUser()->setAccount($user);
diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php
index 248a9dd..308e7f4 100644
--- a/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php
+++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php
@@ -54,8 +54,8 @@ function testFormatAdmin() {
     // Add text format.
     $this->drupalGet('admin/config/content/formats');
     $this->clickLink('Add text format');
-    $format_id = drupal_strtolower($this->randomName());
-    $name = $this->randomName();
+    $format_id = drupal_strtolower($this->randomMachineName());
+    $name = $this->randomMachineName();
     $edit = array(
       'format' => $format_id,
       'name' => $name,
@@ -189,8 +189,8 @@ function testFilterAdmin() {
 
     // Add format.
     $edit = array();
-    $edit['format'] = drupal_strtolower($this->randomName());
-    $edit['name'] = $this->randomName();
+    $edit['format'] = drupal_strtolower($this->randomMachineName());
+    $edit['name'] = $this->randomMachineName();
     $edit['roles[' . DRUPAL_AUTHENTICATED_RID . ']'] = 1;
     $edit['filters[' . $second_filter . '][status]'] = TRUE;
     $edit['filters[' . $first_filter . '][status]'] = TRUE;
@@ -227,12 +227,12 @@ function testFilterAdmin() {
     $this->assertRaw('<option value="' . $full . '">Full HTML</option>', 'Full HTML filter accessible.');
 
     // Use basic HTML and see if it removes tags that are not allowed.
-    $body = '<em>' . $this->randomName() . '</em>';
+    $body = '<em>' . $this->randomMachineName() . '</em>';
     $extra_text = 'text';
     $text = $body . '<random>' . $extra_text . '</random>';
 
     $edit = array();
-    $edit['title[0][value]'] = $this->randomName();
+    $edit['title[0][value]'] = $this->randomMachineName();
     $edit['body[0][value]'] = $text;
     $edit['body[0][format]'] = $basic;
     $this->drupalPostForm('node/add/page', $edit, t('Save'));
@@ -297,7 +297,7 @@ function testFilterAdmin() {
   function testUrlFilterAdmin() {
     // The form does not save with an invalid filter URL length.
     $edit = array(
-      'filters[filter_url][settings][filter_url_length]' => $this->randomName(4),
+      'filters[filter_url][settings][filter_url_length]' => $this->randomMachineName(4),
     );
     $this->drupalPostForm('admin/config/content/formats/manage/basic_html', $edit, t('Save configuration'));
     $this->assertNoRaw(t('The text format %format has been updated.', array('%format' => 'Basic HTML')));
diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterDefaultFormatTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterDefaultFormatTest.php
index b9b6b71..cf6ff9e 100644
--- a/core/modules/filter/lib/Drupal/filter/Tests/FilterDefaultFormatTest.php
+++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterDefaultFormatTest.php
@@ -40,8 +40,8 @@ function testDefaultTextFormats() {
     $formats = array();
     for ($i = 0; $i < 2; $i++) {
       $edit = array(
-        'format' => drupal_strtolower($this->randomName()),
-        'name' => $this->randomName(),
+        'format' => drupal_strtolower($this->randomMachineName()),
+        'name' => $this->randomMachineName(),
       );
       $this->drupalPostForm('admin/config/content/formats/add', $edit, t('Save configuration'));
       $this->resetFilterCaches();
diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterFormatAccessTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterFormatAccessTest.php
index e402fda..de00004 100644
--- a/core/modules/filter/lib/Drupal/filter/Tests/FilterFormatAccessTest.php
+++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterFormatAccessTest.php
@@ -90,8 +90,8 @@ function setUp() {
     $formats = array();
     for ($i = 0; $i < 3; $i++) {
       $edit = array(
-        'format' => drupal_strtolower($this->randomName()),
-        'name' => $this->randomName(),
+        'format' => drupal_strtolower($this->randomMachineName()),
+        'name' => $this->randomMachineName(),
       );
       $this->drupalPostForm('admin/config/content/formats/add', $edit, t('Save configuration'));
       $this->resetFilterCaches();
@@ -219,8 +219,8 @@ function testFormatWidgetPermissions() {
     // Create node to edit.
     $this->drupalLogin($this->admin_user);
     $edit = array();
-    $edit['title[0][value]'] = $this->randomName(8);
-    $edit[$body_value_key] = $this->randomName(16);
+    $edit['title[0][value]'] = $this->randomMachineName(8);
+    $edit[$body_value_key] = $this->randomMachineName(16);
     $edit[$body_format_key] = $this->disallowed_format->format;
     $this->drupalPostForm('node/add/page', $edit, t('Save'));
     $node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
@@ -235,7 +235,7 @@ function testFormatWidgetPermissions() {
 
     // Verify that title can be changed, but preview displays original body.
     $new_edit = array();
-    $new_edit['title[0][value]'] = $this->randomName(8);
+    $new_edit['title[0][value]'] = $this->randomMachineName(8);
     $this->drupalPostForm(NULL, $new_edit, t('Preview'));
     $this->assertText($edit[$body_value_key], 'Old body found in preview.');
 
@@ -275,7 +275,7 @@ function testFormatWidgetPermissions() {
     // Verify that trying to save the node without selecting a new text format
     // produces an error message, and does not result in the node being saved.
     $old_title = $new_edit['title[0][value]'];
-    $new_title = $this->randomName(8);
+    $new_title = $this->randomMachineName(8);
     $edit = array();
     $edit['title[0][value]'] = $new_title;
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
@@ -310,7 +310,7 @@ function testFormatWidgetPermissions() {
     // format.
     $this->drupalLogin($this->filter_admin_user);
     $old_title = $new_title;
-    $new_title = $this->randomName(8);
+    $new_title = $this->randomMachineName(8);
     $edit = array();
     $edit['title[0][value]'] = $new_title;
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterHooksTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterHooksTest.php
index b23ed88..65cf726 100644
--- a/core/modules/filter/lib/Drupal/filter/Tests/FilterHooksTest.php
+++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterHooksTest.php
@@ -37,7 +37,7 @@ public static function getInfo() {
    */
   function testFilterHooks() {
     // Create content type, with underscores.
-    $type_name = 'test_' . strtolower($this->randomName());
+    $type_name = 'test_' . strtolower($this->randomMachineName());
     $type = $this->drupalCreateContentType(array('name' => $type_name, 'type' => $type_name));
     $node_permission = "create $type_name content";
 
@@ -45,9 +45,9 @@ function testFilterHooks() {
     $this->drupalLogin($admin_user);
 
     // Add a text format.
-    $name = $this->randomName();
+    $name = $this->randomMachineName();
     $edit = array();
-    $edit['format'] = drupal_strtolower($this->randomName());
+    $edit['format'] = drupal_strtolower($this->randomMachineName());
     $edit['name'] = $name;
     $edit['roles[' . DRUPAL_ANONYMOUS_RID . ']'] = 1;
     $this->drupalPostForm('admin/config/content/formats/add', $edit, t('Save configuration'));
@@ -64,10 +64,10 @@ function testFilterHooks() {
     $this->assertText('hook_filter_format_update invoked.');
 
     // Use the format created.
-    $title = $this->randomName(8);
+    $title = $this->randomMachineName(8);
     $edit = array();
     $edit['title[0][value]'] = $title;
-    $edit['body[0][value]'] = $this->randomName(32);
+    $edit['body[0][value]'] = $this->randomMachineName(32);
     $edit['body[0][format]'] = $format_id;
     $this->drupalPostForm("node/add/{$type->type}", $edit, t('Save and publish'));
     $this->assertText(t('@type @title has been created.', array('@type' => $type_name, '@title' => $title)));
diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterNoFormatTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterNoFormatTest.php
index 9f2090c..aad1c2b 100644
--- a/core/modules/filter/lib/Drupal/filter/Tests/FilterNoFormatTest.php
+++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterNoFormatTest.php
@@ -38,7 +38,7 @@ public static function getInfo() {
   function testCheckMarkupNoFormat() {
     // Create some text. Include some HTML and line breaks, so we get a good
     // test of the filtering that is applied to it.
-    $text = "<strong>" . $this->randomName(32) . "</strong>\n\n<div>" . $this->randomName(32) . "</div>";
+    $text = "<strong>" . $this->randomMachineName(32) . "</strong>\n\n<div>" . $this->randomMachineName(32) . "</div>";
 
     // Make sure that when this text is run through check_markup() with no text
     // format, it is filtered as though it is in the fallback format.
diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterUnitTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterUnitTest.php
index a51d6b9..1f304db 100644
--- a/core/modules/filter/lib/Drupal/filter/Tests/FilterUnitTest.php
+++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterUnitTest.php
@@ -223,7 +223,7 @@ function testLineBreakFilter() {
 
     // Very long string hitting PCRE limits.
     $limit = max(ini_get('pcre.backtrack_limit'), ini_get('pcre.recursion_limit'));
-    $source = $this->randomName($limit);
+    $source = $this->randomMachineName($limit);
     $result = _filter_autop($source);
     $success = $this->assertEqual($result, '<p>' . $source . "</p>\n", 'Line break filter can process very long strings.');
     if (!$success) {
diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumBlockTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumBlockTest.php
index 1295c82..9cebd88 100644
--- a/core/modules/forum/lib/Drupal/forum/Tests/ForumBlockTest.php
+++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumBlockTest.php
@@ -164,8 +164,8 @@ protected function createForumTopics($count = 5) {
 
     for ($index = 0; $index < $count; $index++) {
       // Generate a random subject/body.
-      $title = $this->randomName(20);
-      $body = $this->randomName(200);
+      $title = $this->randomMachineName(20);
+      $body = $this->randomMachineName(200);
       // Forum posts are ordered by timestamp, so force a unique timestamp by
       // changing the date.
       $date->modify('+1 minute');
diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumIndexTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumIndexTest.php
index 8c1f3ee..fbec11a 100644
--- a/core/modules/forum/lib/Drupal/forum/Tests/ForumIndexTest.php
+++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumIndexTest.php
@@ -45,10 +45,10 @@ function testForumIndexStatus() {
     $tid = 1;
 
     // Create a test node.
-    $title = $this->randomName(20);
+    $title = $this->randomMachineName(20);
     $edit = array(
       'title[0][value]' => $title,
-      'body[0][value]' => $this->randomName(200),
+      'body[0][value]' => $this->randomMachineName(200),
     );
 
     // Create the forum topic, preselecting the forum ID via a URL parameter.
diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumNodeAccessTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumNodeAccessTest.php
index 99f8b25..5294836 100644
--- a/core/modules/forum/lib/Drupal/forum/Tests/ForumNodeAccessTest.php
+++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumNodeAccessTest.php
@@ -50,10 +50,10 @@ function testForumNodeAccess() {
     $this->drupalLogin($admin_user);
 
     // Create a private node.
-    $private_node_title = $this->randomName(20);
+    $private_node_title = $this->randomMachineName(20);
     $edit = array(
       'title[0][value]' => $private_node_title,
-      'body[0][value]' => $this->randomName(200),
+      'body[0][value]' => $this->randomMachineName(200),
       'private' => TRUE,
     );
     $this->drupalPostForm('node/add/forum', $edit, t('Save'), array('query' => array('forum_id' => 1)));
@@ -61,10 +61,10 @@ function testForumNodeAccess() {
     $this->assertTrue(!empty($private_node), 'New private forum node found in database.');
 
     // Create a public node.
-    $public_node_title = $this->randomName(20);
+    $public_node_title = $this->randomMachineName(20);
     $edit = array(
       'title[0][value]' => $public_node_title,
-      'body[0][value]' => $this->randomName(200),
+      'body[0][value]' => $this->randomMachineName(200),
     );
     $this->drupalPostForm('node/add/forum', $edit, t('Save'), array('query' => array('forum_id' => 1)));
     $public_node = $this->drupalGetNodeByTitle($public_node_title);
diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php
index 6373929..67c28f1 100644
--- a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php
+++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php
@@ -188,7 +188,7 @@ function testForum() {
     // Test adding a comment to a forum topic.
     $node = $this->createForumTopic($this->forum, FALSE);
     $edit = array();
-    $edit['comment_body[0][value]'] = $this->randomName();
+    $edit['comment_body[0][value]'] = $this->randomMachineName();
     $this->drupalPostForm('node/' . $node->id(), $edit, t('Save'));
     $this->assertResponse(200);
 
@@ -224,8 +224,8 @@ function testAddOrphanTopic() {
 
     // Create an orphan forum item.
     $edit = array();
-    $edit['title[0][value]'] = $this->randomName(10);
-    $edit['body[0][value]'] = $this->randomName(120);
+    $edit['title[0][value]'] = $this->randomMachineName(10);
+    $edit['body[0][value]'] = $this->randomMachineName(120);
     $this->drupalLogin($this->admin_user);
     $this->drupalPostForm('node/add/forum', $edit, t('Save'));
 
@@ -326,8 +326,8 @@ function editForumVocabulary() {
 
     // Generate a random name and description.
     $edit = array(
-      'name' => $this->randomName(10),
-      'description' => $this->randomName(100),
+      'name' => $this->randomMachineName(10),
+      'description' => $this->randomMachineName(100),
     );
 
     // Edit the vocabulary.
@@ -364,8 +364,8 @@ function editForumVocabulary() {
    */
   function createForum($type, $parent = 0) {
     // Generate a random name/description.
-    $name = $this->randomName(10);
-    $description = $this->randomName(100);
+    $name = $this->randomMachineName(10);
+    $description = $this->randomMachineName(100);
 
     $edit = array(
       'name[0][value]' => $name,
@@ -455,8 +455,8 @@ function testForumWithNewPost() {
     $this->drupalLogin($this->post_comment_user);
     // Post a reply to the topic.
     $edit = array();
-    $edit['subject'] = $this->randomName();
-    $edit['comment_body[0][value]'] = $this->randomName();
+    $edit['subject'] = $this->randomMachineName();
+    $edit['comment_body[0][value]'] = $this->randomMachineName();
     $this->drupalPostForm('node/' . $node->id(), $edit, t('Save'));
     $this->assertResponse(200);
 
@@ -485,8 +485,8 @@ function testForumWithNewPost() {
    */
   function createForumTopic($forum, $container = FALSE) {
     // Generate a random subject/body.
-    $title = $this->randomName(20);
-    $body = $this->randomName(200);
+    $title = $this->randomMachineName(20);
+    $body = $this->randomMachineName(200);
 
     $edit = array(
       'title[0][value]' => $title,
@@ -576,7 +576,7 @@ private function verifyForums(EntityInterface $node, $admin, $response = 200) {
       // Edit forum node (including moving it to another forum).
       $edit = array();
       $edit['title[0][value]'] = 'node/' . $node->id();
-      $edit['body[0][value]'] = $this->randomName(256);
+      $edit['body[0][value]'] = $this->randomMachineName(256);
       // Assume the topic is initially associated with $forum.
       $edit['taxonomy_forums'] = $this->root_forum['tid'];
       $edit['shadow'] = TRUE;
diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumUninstallTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumUninstallTest.php
index 1e4e9bd..c03d1f0 100644
--- a/core/modules/forum/lib/Drupal/forum/Tests/ForumUninstallTest.php
+++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumUninstallTest.php
@@ -65,7 +65,7 @@ function testForumUninstallWithField() {
       'pid' => 0,
       'uid' => 0,
       'status' => CommentInterface::PUBLISHED,
-      'subject' => $this->randomName(),
+      'subject' => $this->randomMachineName(),
       'hostname' => '127.0.0.1',
     ));
     $comment->save();
diff --git a/core/modules/hal/lib/Drupal/hal/Tests/DenormalizeTest.php b/core/modules/hal/lib/Drupal/hal/Tests/DenormalizeTest.php
index 32bc279..e33f9d7 100644
--- a/core/modules/hal/lib/Drupal/hal/Tests/DenormalizeTest.php
+++ b/core/modules/hal/lib/Drupal/hal/Tests/DenormalizeTest.php
@@ -128,26 +128,26 @@ public function testBasicFieldDenormalization() {
       ),
       'field_test_text' => array(
         array(
-          'value' => $this->randomName(),
+          'value' => $this->randomMachineName(),
           'format' => 'full_html',
         ),
       ),
       'field_test_translatable_text' => array(
         array(
-          'value' => $this->randomName(),
+          'value' => $this->randomMachineName(),
           'format' => 'full_html',
         ),
         array(
-          'value' => $this->randomName(),
+          'value' => $this->randomMachineName(),
           'format' => 'filtered_html',
         ),
         array(
-          'value' => $this->randomName(),
+          'value' => $this->randomMachineName(),
           'format' => 'filtered_html',
           'lang' => 'de',
         ),
         array(
-          'value' => $this->randomName(),
+          'value' => $this->randomMachineName(),
           'format' => 'full_html',
           'lang' => 'de',
         ),
@@ -193,7 +193,7 @@ public function testPatchDenormailzation() {
       ),
       'field_test_text' => array(
         array(
-          'value' => $this->randomName(),
+          'value' => $this->randomMachineName(),
           'format' => 'full_html',
         ),
       ),
diff --git a/core/modules/hal/lib/Drupal/hal/Tests/EntityTest.php b/core/modules/hal/lib/Drupal/hal/Tests/EntityTest.php
index 42bfc4f..8f004cc 100644
--- a/core/modules/hal/lib/Drupal/hal/Tests/EntityTest.php
+++ b/core/modules/hal/lib/Drupal/hal/Tests/EntityTest.php
@@ -50,19 +50,19 @@ public function testNode() {
     $node_type = entity_create('node_type', array('type' => 'example_type'));
     $node_type->save();
 
-    $user = entity_create('user', array('name' => $this->randomName()));
+    $user = entity_create('user', array('name' => $this->randomMachineName()));
     $user->save();
 
     $node = entity_create('node', array(
-      'title' => $this->randomName(),
+      'title' => $this->randomMachineName(),
       'uid' => $user->id(),
       'type' => $node_type->id(),
       'status' => NODE_PUBLISHED,
       'promote' => 1,
       'sticky' => 0,
       'body' => array(
-        'value' => $this->randomName(),
-        'format' => $this->randomName(),
+        'value' => $this->randomMachineName(),
+        'format' => $this->randomMachineName(),
       )
     ));
     $node->save();
@@ -93,11 +93,11 @@ public function testTerm() {
     $vocabulary->save();
 
     $term = entity_create('taxonomy_term', array(
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       'vid' => $vocabulary->id(),
       'description' => array(
-        'value' => $this->randomName(),
-        'format' => $this->randomName(),
+        'value' => $this->randomMachineName(),
+        'format' => $this->randomMachineName(),
       )
     ));
     $term->save();
diff --git a/core/modules/hal/lib/Drupal/hal/Tests/NormalizeTest.php b/core/modules/hal/lib/Drupal/hal/Tests/NormalizeTest.php
index 396f40a..e3d5a85 100644
--- a/core/modules/hal/lib/Drupal/hal/Tests/NormalizeTest.php
+++ b/core/modules/hal/lib/Drupal/hal/Tests/NormalizeTest.php
@@ -41,10 +41,10 @@ public function testNormalize() {
     // Create a German entity.
     $values = array(
       'langcode' => 'de',
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       'user_id' => 1,
       'field_test_text' => array(
-        'value' => $this->randomName(),
+        'value' => $this->randomMachineName(),
         'format' => 'full_html',
       ),
       'field_test_entity_reference' => array(
@@ -53,7 +53,7 @@ public function testNormalize() {
     );
     // Array of translated values.
     $translation_values = array(
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       'field_test_entity_reference' => array(
         'target_id' => $target_entity_en->id(),
       )
diff --git a/core/modules/image/lib/Drupal/image/Tests/FileMoveTest.php b/core/modules/image/lib/Drupal/image/Tests/FileMoveTest.php
index 13518e0..74abca3 100644
--- a/core/modules/image/lib/Drupal/image/Tests/FileMoveTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/FileMoveTest.php
@@ -48,7 +48,7 @@ function testNormal() {
 
     // Clone the object so we don't have to worry about the function changing
     // our reference copy.
-    $desired_filepath = 'public://' . $this->randomName();
+    $desired_filepath = 'public://' . $this->randomMachineName();
     $result = file_move(clone $file, $desired_filepath, FILE_EXISTS_ERROR);
 
     // Check if image has been moved.
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php
index bcad6fc..7ba524e 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php
@@ -70,7 +70,7 @@ function testStyle() {
     $admin_path = 'admin/config/media/image-styles';
 
     // Setup a style to be created and effects to add to it.
-    $style_name = strtolower($this->randomName(10));
+    $style_name = strtolower($this->randomMachineName(10));
     $style_label = $this->randomString();
     $style_path = $admin_path . '/manage/' . $style_name;
     $effect_edits = array(
@@ -173,8 +173,8 @@ function testStyle() {
 
     // Test the style overview form.
     // Change the name of the style and adjust the weights of effects.
-    $style_name = strtolower($this->randomName(10));
-    $style_label = $this->randomName();
+    $style_name = strtolower($this->randomMachineName(10));
+    $style_label = $this->randomMachineName();
     $weight = count($effect_edits);
     $edit = array(
       'name' => $style_name,
@@ -261,14 +261,14 @@ function testStyle() {
    */
   function testStyleReplacement() {
     // Create a new style.
-    $style_name = strtolower($this->randomName(10));
+    $style_name = strtolower($this->randomMachineName(10));
     $style_label = $this->randomString();
     $style = entity_create('image_style', array('name' => $style_name, 'label' => $style_label));
     $style->save();
     $style_path = 'admin/config/media/image-styles/manage/';
 
     // Create an image field that uses the new style.
-    $field_name = strtolower($this->randomName(10));
+    $field_name = strtolower($this->randomMachineName(10));
     $this->createImageField($field_name, 'article');
     entity_get_display('node', 'article', 'default')
       ->setComponent($field_name, array(
@@ -291,7 +291,7 @@ function testStyleReplacement() {
     $this->assertRaw($style->buildUrl($original_uri), format_string('Image displayed using style @style.', array('@style' => $style_name)));
 
     // Rename the style and make sure the image field is updated.
-    $new_style_name = strtolower($this->randomName(10));
+    $new_style_name = strtolower($this->randomMachineName(10));
     $new_style_label = $this->randomString();
     $edit = array(
       'name' => $new_style_name,
@@ -367,7 +367,7 @@ public function testFlushUserInterface() {
     $admin_path = 'admin/config/media/image-styles';
 
     // Create a new style.
-    $style_name = strtolower($this->randomName(10));
+    $style_name = strtolower($this->randomMachineName(10));
     $style = entity_create('image_style', array('name' => $style_name, 'label' => $this->randomString()));
     $style->save();
 
@@ -396,13 +396,13 @@ public function testFlushUserInterface() {
    */
   function testConfigImport() {
     // Create a new style.
-    $style_name = strtolower($this->randomName(10));
+    $style_name = strtolower($this->randomMachineName(10));
     $style_label = $this->randomString();
     $style = entity_create('image_style', array('name' => $style_name, 'label' => $style_label));
     $style->save();
 
     // Create an image field that uses the new style.
-    $field_name = strtolower($this->randomName(10));
+    $field_name = strtolower($this->randomMachineName(10));
     $this->createImageField($field_name, 'article');
     entity_get_display('node', 'article', 'default')
       ->setComponent($field_name, array(
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageFieldDefaultImagesTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageFieldDefaultImagesTest.php
index c0fd5d7..41bdeba 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageFieldDefaultImagesTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageFieldDefaultImagesTest.php
@@ -35,7 +35,7 @@ public function testDefaultImages() {
     $files = $this->drupalGetTestFiles('image');
     // Create 10 files so the default image fids are not a single value.
     for ($i = 1; $i <= 10; $i++) {
-      $filename = $this->randomName() . "$i";
+      $filename = $this->randomMachineName() . "$i";
       $desired_filepath = 'public://' . $filename;
       file_unmanaged_copy($files[0]->uri, $desired_filepath, FILE_EXISTS_ERROR);
       $file = entity_create('file', array('uri' => $desired_filepath, 'filename' => $filename, 'name' => $filename));
@@ -49,7 +49,7 @@ public function testDefaultImages() {
     }
 
     // Create an image field and add an instance to the article content type.
-    $field_name = strtolower($this->randomName());
+    $field_name = strtolower($this->randomMachineName());
     $field_settings['default_image'] = array(
       'fid' => $default_images['field']->id(),
       'alt' => '',
@@ -296,7 +296,7 @@ public function testDefaultImages() {
    */
   public  function testInvalidDefaultImage() {
     $field = array(
-      'name' => drupal_strtolower($this->randomName()),
+      'name' => drupal_strtolower($this->randomMachineName()),
       'entity_type' => 'node',
       'type' => 'image',
       'settings' => array(
@@ -307,7 +307,7 @@ public  function testInvalidDefaultImage() {
     );
     $instance = array(
       'field_name' => $field['name'],
-      'label' => $this->randomName(),
+      'label' => $this->randomMachineName(),
       'entity_type' => 'node',
       'bundle' => 'page',
       'settings' => array(
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php
index b49a4ac..3d92889 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php
@@ -49,7 +49,7 @@ function testImageFieldFormattersPrivate() {
    * Test image formatters on node display.
    */
   function _testImageFieldFormatters($scheme) {
-    $field_name = strtolower($this->randomName());
+    $field_name = strtolower($this->randomMachineName());
     $this->createImageField($field_name, 'article', array('uri_scheme' => $scheme));
 
     // Create a new node with an image attached.
@@ -156,7 +156,7 @@ function _testImageFieldFormatters($scheme) {
   function testImageFieldSettings() {
     $test_image = current($this->drupalGetTestFiles('image'));
     list(, $test_image_extension) = explode('.', $test_image->filename);
-    $field_name = strtolower($this->randomName());
+    $field_name = strtolower($this->randomMachineName());
     $instance_settings = array(
       'alt_field' => 1,
       'file_extensions' => $test_image_extension,
@@ -199,8 +199,8 @@ function testImageFieldSettings() {
     $image = array(
       '#theme' => 'image',
       '#uri' => file_load($node->{$field_name}->target_id)->getFileUri(),
-      '#alt' => $this->randomName(),
-      '#title' => $this->randomName(),
+      '#alt' => $this->randomMachineName(),
+      '#title' => $this->randomMachineName(),
       '#width' => 40,
       '#height' => 20,
     );
@@ -215,8 +215,8 @@ function testImageFieldSettings() {
     // Verify that alt/title longer than allowed results in a validation error.
     $test_size = 2000;
     $edit = array(
-      $field_name . '[0][alt]' => $this->randomName($test_size),
-      $field_name . '[0][title]' => $this->randomName($test_size),
+      $field_name . '[0][alt]' => $this->randomMachineName($test_size),
+      $field_name . '[0][title]' => $this->randomMachineName($test_size),
     );
     $this->drupalPostForm('node/' . $nid . '/edit', $edit, t('Save and keep published'));
     $schema = $instance->getField()->getSchema();
@@ -248,7 +248,7 @@ function testImageFieldSettings() {
    */
   function testImageFieldDefaultImage() {
     // Create a new image field.
-    $field_name = strtolower($this->randomName());
+    $field_name = strtolower($this->randomMachineName());
     $this->createImageField($field_name, 'article');
 
     // Create a new node, with no images and verify that no images are
@@ -314,7 +314,7 @@ function testImageFieldDefaultImage() {
     $this->assertFalse($default_image['fid'], 'Default image removed from field.');
     // Create an image field that uses the private:// scheme and test that the
     // default image works as expected.
-    $private_field_name = strtolower($this->randomName());
+    $private_field_name = strtolower($this->randomMachineName());
     $this->createImageField($private_field_name, 'article', array('uri_scheme' => 'private'));
     // Add a default image to the new field.
     $edit = array(
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageFieldTestBase.php b/core/modules/image/lib/Drupal/image/Tests/ImageFieldTestBase.php
index f4e1021..e93d972 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageFieldTestBase.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageFieldTestBase.php
@@ -110,7 +110,7 @@ function createImageField($name, $type_name, $field_settings = array(), $instanc
    */
   function previewNodeImage($image, $field_name, $type) {
     $edit = array(
-      'title[0][value]' => $this->randomName(),
+      'title[0][value]' => $this->randomMachineName(),
     );
     $edit['files[' . $field_name . '_0]'] = drupal_realpath($image->uri);
     $this->drupalPostForm('node/add/' . $type, $edit, t('Preview'));
@@ -128,7 +128,7 @@ function previewNodeImage($image, $field_name, $type) {
    */
   function uploadNodeImage($image, $field_name, $type) {
     $edit = array(
-      'title[0][value]' => $this->randomName(),
+      'title[0][value]' => $this->randomMachineName(),
     );
     $edit['files[' . $field_name . '_0]'] = drupal_realpath($image->uri);
     $this->drupalPostForm('node/add/' . $type, $edit, t('Save and publish'));
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageFieldValidateTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageFieldValidateTest.php
index b8b4a75..0d87e36 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageFieldValidateTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageFieldValidateTest.php
@@ -23,7 +23,7 @@ public static function getInfo() {
    * Test min/max resolution settings.
    */
   function testResolution() {
-    $field_name = strtolower($this->randomName());
+    $field_name = strtolower($this->randomMachineName());
     $min_resolution = 50;
     $max_resolution = 100;
     $instance_settings = array(
@@ -59,7 +59,7 @@ function testResolution() {
    * Test that required alt/title fields gets validated right.
    */
   function testRequiredAttributes() {
-    $field_name = strtolower($this->randomName());
+    $field_name = strtolower($this->randomMachineName());
     $instance_settings = array(
       'alt_field' => 1,
       'alt_field_required' => 1,
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageItemTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageItemTest.php
index 7803a11..98e2d44 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageItemTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageItemTest.php
@@ -75,9 +75,9 @@ public function testImageItem() {
     // Create a test entity with the image field set.
     $entity = entity_create('entity_test');
     $entity->image_test->target_id = $this->image->id();
-    $entity->image_test->alt = $alt = $this->randomName();
-    $entity->image_test->title = $title = $this->randomName();
-    $entity->name->value = $this->randomName();
+    $entity->image_test->alt = $alt = $this->randomMachineName();
+    $entity->image_test->title = $title = $this->randomMachineName();
+    $entity->name->value = $this->randomMachineName();
     $entity->save();
 
     $entity = entity_load('entity_test', $entity->id());
@@ -100,7 +100,7 @@ public function testImageItem() {
     $image2->save();
 
     $entity->image_test->target_id = $image2->id();
-    $entity->image_test->alt = $new_alt = $this->randomName();
+    $entity->image_test->alt = $new_alt = $this->randomMachineName();
     // The width and height is only updated when width is not set.
     $entity->image_test->width = NULL;
     $entity->save();
@@ -117,7 +117,7 @@ public function testImageItem() {
 
     // Delete the image and try to save the entity again.
     $this->image->delete();
-    $entity = entity_create('entity_test', array('mame' => $this->randomName()));
+    $entity = entity_create('entity_test', array('mame' => $this->randomMachineName()));
     $entity->save();
   }
 
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageStyleFlushTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageStyleFlushTest.php
index 1cbe4e8..f677828 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageStyleFlushTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageStyleFlushTest.php
@@ -53,7 +53,7 @@ function getImageCount($style, $wrapper) {
   function testFlush() {
 
     // Setup a style to be created and effects to add to it.
-    $style_name = strtolower($this->randomName(10));
+    $style_name = strtolower($this->randomMachineName(10));
     $style_label = $this->randomString();
     $style_path = 'admin/config/media/image-styles/manage/' . $style_name;
     $effect_edits = array(
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageThemeFunctionTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageThemeFunctionTest.php
index 6be3ee9..562ff7b 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageThemeFunctionTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageThemeFunctionTest.php
@@ -87,7 +87,7 @@ function testImageFormatterTheme() {
     $entity->save();
 
     // Test using theme_image_formatter() with a NULL value for the alt option.
-    $path = $this->randomName();
+    $path = $this->randomMachineName();
     $element = array(
       '#theme' => 'image_formatter',
       '#image_style' => 'test',
@@ -108,7 +108,7 @@ function testImageFormatterTheme() {
     $this->assertEqual(count($elements), 1, 'theme_image_formatter() correctly renders without title, alt, or path options.');
 
     // Link the image to a fragment on the page, and not a full URL.
-    $fragment = $this->randomName();
+    $fragment = $this->randomMachineName();
     $element['#path']['path'] = '';
     $element['#path']['options'] = array(
       'external' => TRUE,
diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageBrowserDetectionUnitTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageBrowserDetectionUnitTest.php
index 5571668..225ea2c 100644
--- a/core/modules/language/lib/Drupal/language/Tests/LanguageBrowserDetectionUnitTest.php
+++ b/core/modules/language/lib/Drupal/language/Tests/LanguageBrowserDetectionUnitTest.php
@@ -137,7 +137,7 @@ function testLanguageFromBrowser() {
       '' => FALSE,
       'de,pl' => FALSE,
       'iecRswK4eh' => FALSE,
-      $this->randomName(10) => FALSE,
+      $this->randomMachineName(10) => FALSE,
 
       // Chinese langcodes.
       'zh-cn, en-us;q=0.90, en;q=0.80, zh;q=0.70' => 'zh-hans',
diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationElementTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationElementTest.php
index 0a507f2..8c2d8e1 100644
--- a/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationElementTest.php
+++ b/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationElementTest.php
@@ -70,7 +70,7 @@ public function testDefaultLangcode() {
     foreach (array('aa', 'bb', 'cc') as $language_code) {
       $language = new Language(array(
         'id' => $language_code,
-        'name' => $this->randomName(),
+        'name' => $this->randomMachineName(),
       ));
       language_save($language);
     }
diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageFallbackTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageFallbackTest.php
index fb621d8..04e8b44 100644
--- a/core/modules/language/lib/Drupal/language/Tests/LanguageFallbackTest.php
+++ b/core/modules/language/lib/Drupal/language/Tests/LanguageFallbackTest.php
@@ -30,7 +30,7 @@ protected function setUp() {
 
     for ($i = 0; $i < 3; $i++) {
       $language = new Language();
-      $language->id = $this->randomName(2);
+      $language->id = $this->randomMachineName(2);
       $language->weight = -$i;
       language_save($language);
     }
diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageListTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageListTest.php
index 273850b..3f67d52 100644
--- a/core/modules/language/lib/Drupal/language/Tests/LanguageListTest.php
+++ b/core/modules/language/lib/Drupal/language/Tests/LanguageListTest.php
@@ -50,7 +50,7 @@ function testLanguageList() {
 
     // Add custom language.
     $langcode = 'xx';
-    $name = $this->randomName(16);
+    $name = $this->randomMachineName(16);
     $edit = array(
       'predefined_langcode' => 'custom',
       'langcode' => $langcode,
@@ -83,7 +83,7 @@ function testLanguageList() {
     $this->clickLink(t('Edit'));
     $this->assertTitle(t('Edit language | Drupal'), 'Page title is "Edit language".');
     // Edit a language.
-    $name = $this->randomName(16);
+    $name = $this->randomMachineName(16);
     $edit = array(
       'name' => $name,
     );
@@ -137,7 +137,7 @@ function testLanguageList() {
     // language so we must add a new language and make it the default before
     // deleting English.
     $langcode = 'xx';
-    $name = $this->randomName(16);
+    $name = $this->randomMachineName(16);
     $edit = array(
       'predefined_langcode' => 'custom',
       'langcode' => $langcode,
@@ -171,10 +171,10 @@ function testLanguageList() {
    */
   function testLanguageStates() {
     // Add some languages, and also lock some of them.
-    language_save(new Language(array('name' => $this->randomName(), 'id' => 'l1')));
-    language_save(new Language(array('name' => $this->randomName(), 'id' => 'l2', 'locked' => TRUE)));
-    language_save(new Language(array('name' => $this->randomName(), 'id' => 'l3')));
-    language_save(new Language(array('name' => $this->randomName(), 'id' => 'l4', 'locked' => TRUE)));
+    language_save(new Language(array('name' => $this->randomMachineName(), 'id' => 'l1')));
+    language_save(new Language(array('name' => $this->randomMachineName(), 'id' => 'l2', 'locked' => TRUE)));
+    language_save(new Language(array('name' => $this->randomMachineName(), 'id' => 'l3')));
+    language_save(new Language(array('name' => $this->randomMachineName(), 'id' => 'l4', 'locked' => TRUE)));
     $expected_locked_languages = array('l4' => 'l4', 'l2' => 'l2', 'und' => 'und', 'zxx' => 'zxx');
     $expected_all_languages = array('l4' => 'l4', 'l3' => 'l3', 'l2' => 'l2', 'l1' => 'l1', 'en' => 'en', 'und' => 'und', 'zxx' => 'zxx');
     $expected_conf_languages = array('l3' => 'l3', 'l1' => 'l1', 'en' => 'en');
diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageSwitchingTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageSwitchingTest.php
index b4c4616..0581384 100644
--- a/core/modules/language/lib/Drupal/language/Tests/LanguageSwitchingTest.php
+++ b/core/modules/language/lib/Drupal/language/Tests/LanguageSwitchingTest.php
@@ -46,7 +46,7 @@ function testLanguageBlock() {
     $block = $this->drupalPlaceBlock('language_block:' . Language::TYPE_INTERFACE, array(
       'id' => 'test_language_block',
       // Ensure a 2-byte UTF-8 sequence is in the tested output.
-      'label' => $this->randomName(8) . '×',
+      'label' => $this->randomMachineName(8) . '×',
     ));
 
     // Add language.
diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageUrlRewritingTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageUrlRewritingTest.php
index 39ad3f8..4a3252e 100644
--- a/core/modules/language/lib/Drupal/language/Tests/LanguageUrlRewritingTest.php
+++ b/core/modules/language/lib/Drupal/language/Tests/LanguageUrlRewritingTest.php
@@ -55,7 +55,7 @@ function setUp() {
   function testUrlRewritingEdgeCases() {
     // Check URL rewriting with a non-installed language.
     $non_existing = \Drupal::languageManager()->getDefaultLanguage();
-    $non_existing->id = $this->randomName();
+    $non_existing->id = $this->randomMachineName();
     $this->checkUrl($non_existing, 'Path language is ignored if language is not installed.', 'URL language negotiation does not work with non-installed languages');
 
     $request = $this->prepareRequestForGenerator();
@@ -89,7 +89,7 @@ private function checkUrl($language, $message1, $message2) {
     // If the rewritten URL has not a language prefix we pick a random prefix so
     // we can always check the prefixed URL.
     $prefixes = language_negotiation_url_prefixes();
-    $stored_prefix = isset($prefixes[$language->id]) ? $prefixes[$language->id] : $this->randomName();
+    $stored_prefix = isset($prefixes[$language->id]) ? $prefixes[$language->id] : $this->randomMachineName();
     if ($this->assertNotEqual($stored_prefix, $prefix, $message1)) {
       $prefix = $stored_prefix;
     }
diff --git a/core/modules/link/lib/Drupal/link/Tests/LinkFieldTest.php b/core/modules/link/lib/Drupal/link/Tests/LinkFieldTest.php
index e335fd7..6442686 100644
--- a/core/modules/link/lib/Drupal/link/Tests/LinkFieldTest.php
+++ b/core/modules/link/lib/Drupal/link/Tests/LinkFieldTest.php
@@ -66,7 +66,7 @@ function setUp() {
    * Tests link field URL validation.
    */
   function testURLValidation() {
-    $field_name = drupal_strtolower($this->randomName());
+    $field_name = drupal_strtolower($this->randomMachineName());
     // Create a field with settings to validate.
     $this->field = entity_create('field_config', array(
       'name' => $field_name,
@@ -153,7 +153,7 @@ protected function assertValidEntries($field_name, array $valid_entries) {
     foreach ($valid_entries as $value) {
       $edit = array(
         'user_id' => 1,
-        'name' => $this->randomName(),
+        'name' => $this->randomMachineName(),
         "{$field_name}[0][url]" => $value,
       );
       $this->drupalPostForm('entity_test/add', $edit, t('Save'));
@@ -176,7 +176,7 @@ protected function assertInvalidEntries($field_name, array $invalid_entries) {
     foreach ($invalid_entries as $invalid_value) {
       $edit = array(
         'user_id' => 1,
-        'name' => $this->randomName(),
+        'name' => $this->randomMachineName(),
         "{$field_name}[0][url]" => $invalid_value,
       );
       $this->drupalPostForm('entity_test/add', $edit, t('Save'));
@@ -188,7 +188,7 @@ protected function assertInvalidEntries($field_name, array $invalid_entries) {
    * Tests the link title settings of a link field.
    */
   function testLinkTitle() {
-    $field_name = drupal_strtolower($this->randomName());
+    $field_name = drupal_strtolower($this->randomMachineName());
     // Create a field with settings to validate.
     $this->field = entity_create('field_config', array(
       'name' => $field_name,
@@ -275,7 +275,7 @@ function testLinkTitle() {
     $value = 'http://www.example.com/';
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$field_name}[0][url]" => $value,
       "{$field_name}[0][title]" => '',
     );
@@ -289,10 +289,10 @@ function testLinkTitle() {
     $this->assertRaw($expected_link);
 
     // Verify that a link with text is rendered using the link text.
-    $title = $this->randomName();
+    $title = $this->randomMachineName();
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$field_name}[0][title]" => $title,
     );
     $this->drupalPostForm("entity_test/manage/$id", $edit, t('Save'));
@@ -307,7 +307,7 @@ function testLinkTitle() {
    * Tests the default 'link' formatter.
    */
   function testLinkFormatter() {
-    $field_name = drupal_strtolower($this->randomName());
+    $field_name = drupal_strtolower($this->randomMachineName());
     // Create a field with settings to validate.
     $this->field = entity_create('field_config', array(
       'name' => $field_name,
@@ -352,7 +352,7 @@ function testLinkFormatter() {
     $title2 = 'A very long & strange example title that could break the nice layout of the site';
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$field_name}[0][url]" => $url1,
       // Note that $title1 is not submitted.
       "{$field_name}[0][title]" => '',
@@ -450,7 +450,7 @@ function testLinkFormatter() {
    * merged, since they involve different configuration and output.
    */
   function testLinkSeparateFormatter() {
-    $field_name = drupal_strtolower($this->randomName());
+    $field_name = drupal_strtolower($this->randomMachineName());
     // Create a field with settings to validate.
     $this->field = entity_create('field_config', array(
       'name' => $field_name,
@@ -493,7 +493,7 @@ function testLinkSeparateFormatter() {
     $title2 = 'A very long & strange example title that could break the nice layout of the site';
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$field_name}[0][url]" => $url1,
       "{$field_name}[1][url]" => $url2,
       "{$field_name}[1][title]" => $title2,
diff --git a/core/modules/link/lib/Drupal/link/Tests/LinkFieldUITest.php b/core/modules/link/lib/Drupal/link/Tests/LinkFieldUITest.php
index 97fda35..071281d 100644
--- a/core/modules/link/lib/Drupal/link/Tests/LinkFieldUITest.php
+++ b/core/modules/link/lib/Drupal/link/Tests/LinkFieldUITest.php
@@ -45,7 +45,7 @@ function testFieldUI() {
     $type_path = 'admin/structure/types/manage/' . $type->type;
 
     // Add a link field to the newly-created type.
-    $label = $this->randomName();
+    $label = $this->randomMachineName();
     $field_name = drupal_strtolower($label);
     $edit = array(
       'fields[_add_new_field][label]' => $label,
diff --git a/core/modules/link/lib/Drupal/link/Tests/LinkItemTest.php b/core/modules/link/lib/Drupal/link/Tests/LinkItemTest.php
index 8125790..1662051 100644
--- a/core/modules/link/lib/Drupal/link/Tests/LinkItemTest.php
+++ b/core/modules/link/lib/Drupal/link/Tests/LinkItemTest.php
@@ -56,13 +56,13 @@ public function testLinkItem() {
     $entity = entity_create('entity_test');
     $url = 'http://www.drupal.org?test_param=test_value';
     $parsed_url = UrlHelper::parse($url);
-    $title = $this->randomName();
-    $class = $this->randomName();
+    $title = $this->randomMachineName();
+    $class = $this->randomMachineName();
     $entity->field_test->url = $parsed_url['path'];
     $entity->field_test->title = $title;
     $entity->field_test->first()->get('options')->set('query', $parsed_url['query']);
     $entity->field_test->first()->get('options')->set('attributes', array('class' => $class));
-    $entity->name->value = $this->randomName();
+    $entity->name->value = $this->randomMachineName();
     $entity->save();
 
     // Verify that the field value is changed.
@@ -79,7 +79,7 @@ public function testLinkItem() {
 
     // Update only the entity name property to check if the link field data will
     // remain intact.
-    $entity->name->value = $this->randomName();
+    $entity->name->value = $this->randomMachineName();
     $entity->save();
     $id = $entity->id();
     $entity = entity_load('entity_test', $id);
@@ -89,8 +89,8 @@ public function testLinkItem() {
 
     // Verify changing the field value.
     $new_url = 'http://drupal.org';
-    $new_title = $this->randomName();
-    $new_class = $this->randomName();
+    $new_title = $this->randomMachineName();
+    $new_class = $this->randomMachineName();
     $entity->field_test->url = $new_url;
     $entity->field_test->title = $new_title;
     $entity->field_test->first()->get('options')->set('query', NULL);
diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleConfigTranslationTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleConfigTranslationTest.php
index a4ee53a..844f259 100644
--- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleConfigTranslationTest.php
+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleConfigTranslationTest.php
@@ -51,7 +51,7 @@ function testConfigTranslation() {
     $langcode = 'xx';
     $admin_user = $this->drupalCreateUser(array('administer languages', 'access administration pages', 'translate interface', 'administer modules', 'access site-wide contact form', 'administer contact forms'));
     $this->drupalLogin($admin_user);
-    $name = $this->randomName(16);
+    $name = $this->randomMachineName(16);
     $edit = array(
       'predefined_langcode' => 'custom',
       'langcode' => $langcode,
@@ -68,7 +68,7 @@ function testConfigTranslation() {
     $this->assertTrue($string, 'Configuration strings have been created upon installation.');
 
     // Translate using the UI so configuration is refreshed.
-    $site_name = $this->randomName(20);
+    $site_name = $this->randomMachineName(20);
     $search = array(
       'string' => $string->source,
       'langcode' => $langcode,
@@ -144,7 +144,7 @@ function testConfigTranslation() {
     $this->assertTrue(count($translations) == 1 && $translation->source == $string->source && empty($translation->translation), 'Got only one string for image configuration and has no translation.');
 
     // Translate using the UI so configuration is refreshed.
-    $image_style_label = $this->randomName(20);
+    $image_style_label = $this->randomMachineName(20);
     $search = array(
       'string' => $string->source,
       'langcode' => $langcode,
@@ -183,7 +183,7 @@ function testConfigTranslation() {
     $this->assertTrue($override->isNew(), 'Translated configuration for image module removed.');
 
     // Translate default category using the UI so configuration is refreshed.
-    $category_label = $this->randomName(20);
+    $category_label = $this->randomMachineName(20);
     $search = array(
       'string' => 'Website feedback',
       'langcode' => $langcode,
diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php
index 093da50..0e51be4 100644
--- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php
+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php
@@ -75,7 +75,7 @@ function testContentTypeLanguageConfiguration() {
     // Code for the language.
     $langcode = 'xx';
     // The English name for the language.
-    $name = $this->randomName(16);
+    $name = $this->randomMachineName(16);
     $edit = array(
       'predefined_langcode' => 'custom',
       'langcode' => $langcode,
@@ -109,8 +109,8 @@ function testContentTypeLanguageConfiguration() {
     $this->assertText($name, 'Language present.');
 
     // Create a node.
-    $node_title = $this->randomName();
-    $node_body =  $this->randomName();
+    $node_title = $this->randomMachineName();
+    $node_body =  $this->randomMachineName();
     $edit = array(
       'type' => $type2->type,
       'title' => $node_title,
diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleImportFunctionalTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleImportFunctionalTest.php
index d822f10..3d85b1e 100644
--- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleImportFunctionalTest.php
+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleImportFunctionalTest.php
@@ -94,7 +94,7 @@ function testStandalonePoFile() {
     $this->assertRaw(t('One translation file could not be imported. <a href="@url">See the log</a> for details.', array('@url' => url('admin/reports/dblog'))), 'The empty translation file was successfully imported.');
 
     // Try importing a .po file which doesn't exist.
-    $name = $this->randomName(16);
+    $name = $this->randomMachineName(16);
     $this->drupalPostForm('admin/config/regional/translate/import', array(
       'langcode' => 'fr',
       'files[file]' => $name,
@@ -267,7 +267,7 @@ function testConfigPoFile() {
     $edit = array(
       'predefined_langcode' => 'custom',
       'langcode' => $langcode,
-      'name' => $this->randomName(16),
+      'name' => $this->randomMachineName(16),
       'direction' => '0',
     );
     $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php
index aacf2e4..6352096 100644
--- a/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php
+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php
@@ -49,7 +49,7 @@ function testPathLanguageConfiguration() {
     // Code for the language.
     $langcode = 'xx';
     // The English name for the language.
-    $name = $this->randomName(16);
+    $name = $this->randomMachineName(16);
     // The domain prefix.
     $prefix = $langcode;
     $edit = array(
@@ -74,7 +74,7 @@ function testPathLanguageConfiguration() {
 
     // Create a path alias in default language (English).
     $path = 'admin/config/search/path/add';
-    $english_path = $this->randomName(8);
+    $english_path = $this->randomMachineName(8);
     $edit = array(
       'source'   => 'node/' . $node->id(),
       'alias'    => $english_path,
@@ -83,7 +83,7 @@ function testPathLanguageConfiguration() {
     $this->drupalPostForm($path, $edit, t('Save'));
 
     // Create a path alias in new custom language.
-    $custom_language_path = $this->randomName(8);
+    $custom_language_path = $this->randomMachineName(8);
     $edit = array(
       'source'   => 'node/' . $node->id(),
       'alias'    => $custom_language_path,
@@ -100,7 +100,7 @@ function testPathLanguageConfiguration() {
     $this->assertText($node->label(), 'Custom language alias works.');
 
     // Create a custom path.
-    $custom_path = $this->randomName(8);
+    $custom_path = $this->randomMachineName(8);
 
     // Check priority of language for alias by source path.
     $edit = array(
diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleStringTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleStringTest.php
index 865023e..b844a66 100644
--- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleStringTest.php
+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleStringTest.php
@@ -129,9 +129,9 @@ function testStringSearchAPI() {
     // Source 1 will have all translations, not customized.
     // Source 2 will have all translations, customized.
     // Source 3 will have no translations.
-    $prefix = $this->randomName(100);
-    $source1 = $this->buildSourceString(array('source' => $prefix . $this->randomName(100)))->save();
-    $source2 = $this->buildSourceString(array('source' => $prefix . $this->randomName(100)))->save();
+    $prefix = $this->randomMachineName(100);
+    $source1 = $this->buildSourceString(array('source' => $prefix . $this->randomMachineName(100)))->save();
+    $source2 = $this->buildSourceString(array('source' => $prefix . $this->randomMachineName(100)))->save();
     $source3 = $this->buildSourceString()->save();
     // Load all source strings.
     $strings = $this->storage->getStrings(array());
@@ -185,8 +185,8 @@ function testStringSearchAPI() {
    */
   function buildSourceString($values = array()) {
     return $this->storage->createString($values += array(
-      'source' => $this->randomName(100),
-      'context' => $this->randomName(20),
+      'source' => $this->randomMachineName(100),
+      'context' => $this->randomMachineName(20),
     ));
   }
 
@@ -208,7 +208,7 @@ function createTranslation($source, $langcode, $values = array()) {
     return $this->storage->createTranslation($values += array(
       'lid' => $source->lid,
       'language' => $langcode,
-      'translation' => $this->randomName(100),
+      'translation' => $this->randomMachineName(100),
     ))->save();
   }
 }
diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleTranslationUiTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleTranslationUiTest.php
index fa33010..9ad21de 100644
--- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleTranslationUiTest.php
+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleTranslationUiTest.php
@@ -54,10 +54,10 @@ function testStringTranslation() {
     // Code for the language.
     $langcode = 'xx';
     // The English name for the language. This will be translated.
-    $name = $this->randomName(16);
+    $name = $this->randomMachineName(16);
     // This will be the translation of $name.
-    $translation = $this->randomName(16);
-    $translation_to_en = $this->randomName(16);
+    $translation = $this->randomMachineName(16);
+    $translation_to_en = $this->randomMachineName(16);
 
     // Add custom language.
     $this->drupalLogin($admin_user);
@@ -215,7 +215,7 @@ function testJavaScriptTranslation() {
 
     $langcode = 'xx';
     // The English name for the language. This will be translated.
-    $name = $this->randomName(16);
+    $name = $this->randomMachineName(16);
 
     // Add custom language.
     $edit = array(
@@ -248,7 +248,7 @@ function testJavaScriptTranslation() {
     $textarea = current($this->xpath('//textarea'));
     $lid = (string) $textarea[0]['name'];
     $edit = array(
-      $lid => $this->randomName(),
+      $lid => $this->randomMachineName(),
     );
     $this->drupalPostForm('admin/config/regional/translate', $edit, t('Save translations'));
 
@@ -276,16 +276,16 @@ function testStringValidation() {
     $this->drupalLogin($admin_user);
     $langcode = 'xx';
     // The English name for the language. This will be translated.
-    $name = $this->randomName(16);
+    $name = $this->randomMachineName(16);
 
     // These will be the invalid translations of $name.
-    $key = $this->randomName(16);
+    $key = $this->randomMachineName(16);
     $bad_translations[$key] = "<script>alert('xss');</script>" . $key;
-    $key = $this->randomName(16);
+    $key = $this->randomMachineName(16);
     $bad_translations[$key] = '<img SRC="javascript:alert(\'xss\');">' . $key;
-    $key = $this->randomName(16);
+    $key = $this->randomMachineName(16);
     $bad_translations[$key] = '<<SCRIPT>alert("xss");//<</SCRIPT>' . $key;
-    $key = $this->randomName(16);
+    $key = $this->randomMachineName(16);
     $bad_translations[$key] ="<BODY ONLOAD=alert('xss')>" . $key;
 
     // Add custom language.
@@ -333,9 +333,9 @@ function testStringSearch() {
     // Code for the language.
     $langcode = 'xx';
     // The English name for the language. This will be translated.
-    $name = $this->randomName(16);
+    $name = $this->randomMachineName(16);
     // This will be the translation of $name.
-    $translation = $this->randomName(16);
+    $translation = $this->randomMachineName(16);
 
     // Add custom language.
     $this->drupalLogin($admin_user);
@@ -350,7 +350,7 @@ function testStringSearch() {
     $edit = array(
       'predefined_langcode' => 'custom',
       'langcode' => 'yy',
-      'name' => $this->randomName(16),
+      'name' => $this->randomMachineName(16),
       'direction' => '0',
     );
     $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
@@ -453,7 +453,7 @@ function testStringSearch() {
     $this->assertText(t('No strings available.'), "Search didn't find the translation.");
 
     // Search for a string that isn't in the system.
-    $unavailable_string = $this->randomName(16);
+    $unavailable_string = $this->randomMachineName(16);
     $search = array(
       'string' => $unavailable_string,
       'langcode' => $langcode,
@@ -474,15 +474,15 @@ function testUICustomizedStrings(){
 
     // Create test source string
     $string = $this->container->get('locale.storage')->createString(array(
-      'source' => $this->randomName(100),
-      'context' => $this->randomName(20),
+      'source' => $this->randomMachineName(100),
+      'context' => $this->randomMachineName(20),
     ))->save();
 
     // Create translation for new string and save it as non-customized.
     $translation = $this->container->get('locale.storage')->createTranslation(array(
       'lid' => $string->lid,
       'language' => 'de',
-      'translation' => $this->randomName(100),
+      'translation' => $this->randomMachineName(100),
       'customized' => 0,
     ))->save();
 
@@ -522,7 +522,7 @@ function testUICustomizedStrings(){
     $textarea = current($this->xpath('//textarea'));
     $lid = (string) $textarea[0]['name'];
     $edit = array(
-      $lid => $this->randomName(100),
+      $lid => $this->randomMachineName(100),
     );
     $this->drupalPostForm('admin/config/regional/translate', $edit, t('Save translations'));
 
diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleUpdateTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleUpdateTest.php
index 81a1ac6..b6e0f5c 100644
--- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleUpdateTest.php
+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleUpdateTest.php
@@ -405,7 +405,7 @@ function testEnableCustomLanguage() {
     // Create and enable a custom language with language code 'xx' and a random
     // name.
     $langcode = 'xx';
-    $name = $this->randomName(16);
+    $name = $this->randomMachineName(16);
     $edit = array(
       'predefined_langcode' => 'custom',
       'langcode' => $langcode,
diff --git a/core/modules/menu/lib/Drupal/menu/Tests/MenuLanguageTest.php b/core/modules/menu/lib/Drupal/menu/Tests/MenuLanguageTest.php
index 9e9af49..040ea38 100644
--- a/core/modules/menu/lib/Drupal/menu/Tests/MenuLanguageTest.php
+++ b/core/modules/menu/lib/Drupal/menu/Tests/MenuLanguageTest.php
@@ -44,7 +44,7 @@ function setUp() {
     foreach (array('aa', 'bb', 'cc', 'cs') as $language_code) {
       $language = new Language(array(
         'id' => $language_code,
-        'name' => $this->randomName(),
+        'name' => $this->randomMachineName(),
       ));
       language_save($language);
     }
@@ -56,7 +56,7 @@ function setUp() {
   function testMenuLanguage() {
     // Create a test menu to test the various language-related settings.
     // Machine name has to be lowercase.
-    $menu_name = Unicode::strtolower($this->randomName(16));
+    $menu_name = Unicode::strtolower($this->randomMachineName(16));
     $label = $this->randomString();
     $edit = array(
       'id' => $menu_name,
@@ -164,7 +164,7 @@ function testMenuLanguage() {
   function testMenuLanguageRemovedEnglish() {
     // Create a test menu to test language settings.
     // Machine name has to be lowercase.
-    $menu_name = Unicode::strtolower($this->randomName(16));
+    $menu_name = Unicode::strtolower($this->randomMachineName(16));
     $edit = array(
       'id' => $menu_name,
       'description' => '',
diff --git a/core/modules/menu/lib/Drupal/menu/Tests/MenuNodeTest.php b/core/modules/menu/lib/Drupal/menu/Tests/MenuNodeTest.php
index d8fdea8..002596b 100644
--- a/core/modules/menu/lib/Drupal/menu/Tests/MenuNodeTest.php
+++ b/core/modules/menu/lib/Drupal/menu/Tests/MenuNodeTest.php
@@ -58,7 +58,7 @@ function testMenuNodeFormWidget() {
     $this->drupalGet('node/add/page');
     $this->assertText(t('Create Basic page'));
     $this->assertNoText(t('Menu settings'));
-    $node_title = $this->randomName();
+    $node_title = $this->randomMachineName();
     $edit = array(
       'title[0][value]' => $node_title,
       'body[0][value]' => $this->randomString(),
@@ -76,7 +76,7 @@ function testMenuNodeFormWidget() {
     $this->drupalPostForm('admin/structure/types/manage/page', $edit, t('Save content type'));
 
     // Create a node.
-    $node_title = $this->randomName();
+    $node_title = $this->randomMachineName();
     $edit = array(
       'title[0][value]' => $node_title,
       'body[0][value]' => $this->randomString(),
@@ -122,7 +122,7 @@ function testMenuNodeFormWidget() {
     // Add a menu link to the Administration menu.
     $item = entity_create('menu_link', array(
       'link_path' => 'node/' . $node->id(),
-      'link_title' => $this->randomName(16),
+      'link_title' => $this->randomMachineName(16),
       'menu_name' => 'admin',
     ));
     $item->save();
@@ -144,7 +144,7 @@ function testMenuNodeFormWidget() {
     // Assign a menu link to the second node, being a child of the first one.
     $child_item = entity_create('menu_link', array(
       'link_path' => 'node/'. $child_node->id(),
-      'link_title' => $this->randomName(16),
+      'link_title' => $this->randomMachineName(16),
       'plid' => $item['mlid'],
     ));
     $child_item->save();
diff --git a/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php b/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php
index f984aa7..daed89d 100644
--- a/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php
+++ b/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php
@@ -113,7 +113,7 @@ function testMenu() {
     $this->modifyMenuLink($item);
     $item = entity_load('menu_link', $item['mlid']);
     // Verify that a change to the description is saved.
-    $description = $this->randomName(16);
+    $description = $this->randomMachineName(16);
     $item['options']['attributes']['title']  = $description;
     $return_value = menu_link_save($item);
     // Save the menu link again to test the return value of the procedural save
@@ -129,8 +129,8 @@ function testMenu() {
    */
   function addCustomMenuCRUD() {
     // Add a new custom menu.
-    $menu_name = substr(hash('sha256', $this->randomName(16)), 0, MENU_MAX_MENU_NAME_LENGTH_UI);
-    $label = $this->randomName(16);
+    $menu_name = substr(hash('sha256', $this->randomMachineName(16)), 0, MENU_MAX_MENU_NAME_LENGTH_UI);
+    $label = $this->randomMachineName(16);
 
     $menu = entity_create('menu', array(
       'id' => $menu_name,
@@ -144,7 +144,7 @@ function addCustomMenuCRUD() {
     $this->assertRaw($label, 'Custom menu was added.');
 
     // Edit the menu.
-    $new_label = $this->randomName(16);
+    $new_label = $this->randomMachineName(16);
     $menu->set('label', $new_label);
     $menu->save();
     $this->drupalGet('admin/structure/menu/manage/' . $menu_name);
@@ -160,8 +160,8 @@ function addCustomMenuCRUD() {
   function addCustomMenu() {
     // Try adding a menu using a menu_name that is too long.
     $this->drupalGet('admin/structure/menu/add');
-    $menu_name = substr(hash('sha256', $this->randomName(16)), 0, MENU_MAX_MENU_NAME_LENGTH_UI + 1);
-    $label = $this->randomName(16);
+    $menu_name = substr(hash('sha256', $this->randomMachineName(16)), 0, MENU_MAX_MENU_NAME_LENGTH_UI + 1);
+    $label = $this->randomMachineName(16);
     $edit = array(
       'id' => $menu_name,
       'description' => '',
@@ -178,7 +178,7 @@ function addCustomMenu() {
     )));
 
     // Change the menu_name so it no longer exceeds the maximum length.
-    $menu_name = substr(hash('sha256', $this->randomName(16)), 0, MENU_MAX_MENU_NAME_LENGTH_UI);
+    $menu_name = substr(hash('sha256', $this->randomMachineName(16)), 0, MENU_MAX_MENU_NAME_LENGTH_UI);
     $edit['id'] = $menu_name;
     $this->drupalPostForm('admin/structure/menu/add', $edit, t('Save'));
 
@@ -426,7 +426,7 @@ function testMenuQueryAndFragment() {
   function testSystemMenuRename() {
     $this->drupalLogin($this->admin_user);
     $edit = array(
-      'label' => $this->randomName(16),
+      'label' => $this->randomMachineName(16),
     );
     $this->drupalPostForm('admin/structure/menu/manage/main', $edit, t('Save'));
 
@@ -505,7 +505,7 @@ public function testMenuBundles() {
     $this->assertNotEqual($moved_item->bundle(), $item->bundle(), 'Menu link bundle was changed');
     $this->assertEqual($moved_item->bundle(), $menu->id(), 'Menu link bundle matches the menu');
 
-    $unsaved_item = entity_create('menu_link', array('menu_name' => $menu->id(), 'link_title' => $this->randomName(16), 'link_path' => '<front>'));
+    $unsaved_item = entity_create('menu_link', array('menu_name' => $menu->id(), 'link_title' => $this->randomMachineName(16), 'link_path' => '<front>'));
     $this->assertEqual($unsaved_item->bundle(), $menu->id(), 'Unsaved menu link bundle matches the menu');
     $this->assertEqual($unsaved_item->menu_name, $menu->id(), 'Unsaved menu link menu name matches the menu');
   }
@@ -536,7 +536,7 @@ function addMenuLink($plid = 0, $link = '<front>', $menu_name = 'tools', $expand
     $this->drupalGet("admin/structure/menu/manage/$menu_name/add");
     $this->assertResponse(200);
 
-    $title = '!link_' . $this->randomName(16);
+    $title = '!link_' . $this->randomMachineName(16);
     $edit = array(
       'link_path' => $link,
       'link_title' => $title,
@@ -643,7 +643,7 @@ function moveMenuLink($item, $plid, $menu_name) {
    *   Menu link passed by reference.
    */
   function modifyMenuLink(&$item) {
-    $item['link_title'] = $this->randomName(16);
+    $item['link_title'] = $this->randomMachineName(16);
 
     $mlid = $item['mlid'];
     $title = $item['link_title'];
diff --git a/core/modules/migrate/tests/Drupal/migrate/Tests/RowTest.php b/core/modules/migrate/tests/Drupal/migrate/Tests/RowTest.php
index c30375c..e40b07a 100644
--- a/core/modules/migrate/tests/Drupal/migrate/Tests/RowTest.php
+++ b/core/modules/migrate/tests/Drupal/migrate/Tests/RowTest.php
@@ -172,7 +172,7 @@ public function testHashing() {
     $this->assertFalse($row->needsUpdate());
 
     // Set the same hash value and ensure it was not changed.
-    $random = $this->randomName();
+    $random = $this->randomMachineName();
     $test_id_map = array(
       'original_hash' => $random,
       'hash' => $random,
@@ -183,8 +183,8 @@ public function testHashing() {
 
     // Set different has values to ensure it is marked as changed.
     $test_id_map = array(
-      'original_hash' => $this->randomName(),
-      'hash' => $this->randomName(),
+      'original_hash' => $this->randomMachineName(),
+      'hash' => $this->randomMachineName(),
       'source_row_status' => MigrateIdMapInterface::STATUS_NEEDS_UPDATE,
     );
     $row->setIdMap($test_id_map);
diff --git a/core/modules/node/lib/Drupal/node/Tests/Condition/NodeConditionTest.php b/core/modules/node/lib/Drupal/node/Tests/Condition/NodeConditionTest.php
index 065cdca..654ff20 100644
--- a/core/modules/node/lib/Drupal/node/Tests/Condition/NodeConditionTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/Condition/NodeConditionTest.php
@@ -45,11 +45,11 @@ function testConditions() {
     $this->createUser();
 
     // Get some nodes of various types to check against.
-    $page = entity_create('node', array('type' => 'page', 'title' => $this->randomName(), 'uid' => 1));
+    $page = entity_create('node', array('type' => 'page', 'title' => $this->randomMachineName(), 'uid' => 1));
     $page->save();
-    $article = entity_create('node', array('type' => 'article', 'title' => $this->randomName(), 'uid' => 1));
+    $article = entity_create('node', array('type' => 'article', 'title' => $this->randomMachineName(), 'uid' => 1));
     $article->save();
-    $test = entity_create('node', array('type' => 'test', 'title' => $this->randomName(), 'uid' => 1));
+    $test = entity_create('node', array('type' => 'test', 'title' => $this->randomMachineName(), 'uid' => 1));
     $test->save();
 
     // Grab the node type condition and configure it to check against node type
diff --git a/core/modules/node/lib/Drupal/node/Tests/MultiStepNodeFormBasicOptionsTest.php b/core/modules/node/lib/Drupal/node/Tests/MultiStepNodeFormBasicOptionsTest.php
index 67bdbe3..c7e81d5 100644
--- a/core/modules/node/lib/Drupal/node/Tests/MultiStepNodeFormBasicOptionsTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/MultiStepNodeFormBasicOptionsTest.php
@@ -36,7 +36,7 @@ function testMultiStepNodeFormBasicOptions() {
     $this->drupalLogin($web_user);
 
     // Create an unlimited cardinality field.
-    $this->field_name = drupal_strtolower($this->randomName());
+    $this->field_name = drupal_strtolower($this->randomMachineName());
     entity_create('field_config', array(
       'name' => $this->field_name,
       'entity_type' => 'node',
@@ -49,7 +49,7 @@ function testMultiStepNodeFormBasicOptions() {
       'field_name' => $this->field_name,
       'entity_type' => 'node',
       'bundle' => 'page',
-      'label' => $this->randomName() . '_label',
+      'label' => $this->randomMachineName() . '_label',
       'settings' => array(
         'text_processing' => TRUE,
       ),
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessFieldTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessFieldTest.php
index dfcb72f..ad7753e 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessFieldTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessFieldTest.php
@@ -58,7 +58,7 @@ public function setUp() {
     $this->content_admin_user = $this->drupalCreateUser(array('access content', 'administer content types', 'administer node fields'));
 
     // Add a custom field to the page content type.
-    $this->field_name = drupal_strtolower($this->randomName() . '_field_name');
+    $this->field_name = drupal_strtolower($this->randomMachineName() . '_field_name');
     entity_create('field_config', array(
       'name' => $this->field_name,
       'entity_type' => 'node',
@@ -83,7 +83,7 @@ public function setUp() {
   function testNodeAccessAdministerField() {
     // Create a page node.
     $field_data = array();
-    $value = $field_data[0]['value'] = $this->randomName();
+    $value = $field_data[0]['value'] = $this->randomMachineName();
     $node = $this->drupalCreateNode(array($this->field_name => $field_data));
 
     // Log in as the administrator and confirm that the field value is present.
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessPagerTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessPagerTest.php
index ee9f7cd..6a35f0f 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessPagerTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessPagerTest.php
@@ -53,9 +53,9 @@ public function testCommentPager() {
         'entity_id' => $node->id(),
         'entity_type' => 'node',
         'field_name' => 'comment',
-        'subject' => $this->randomName(),
+        'subject' => $this->randomMachineName(),
         'comment_body' => array(
-          array('value' => $this->randomName()),
+          array('value' => $this->randomMachineName()),
         ),
         'status' => CommentInterface::PUBLISHED,
       ));
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAdminTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAdminTest.php
index 576fedf..a79dabd 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeAdminTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeAdminTest.php
@@ -50,7 +50,7 @@ function testContentAdminSort() {
     $changed = REQUEST_TIME;
     foreach (array('dd', 'aa', 'DD', 'bb', 'cc', 'CC', 'AA', 'BB') as $prefix) {
       $changed += 1000;
-      $node = $this->drupalCreateNode(array('title' => $prefix . $this->randomName(6)));
+      $node = $this->drupalCreateNode(array('title' => $prefix . $this->randomMachineName(6)));
       db_update('node_field_data')
         ->fields(array('changed' => $changed))
         ->condition('nid', $node->id())
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php
index c5b4514..c0ded00 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php
@@ -50,8 +50,8 @@ function testNodeCreation() {
     $this->assertUrl('node/add/page');
     // Create a node.
     $edit = array();
-    $edit['title[0][value]'] = $this->randomName(8);
-    $edit['body[0][value]'] = $this->randomName(16);
+    $edit['title[0][value]'] = $this->randomMachineName(8);
+    $edit['body[0][value]'] = $this->randomMachineName(16);
     $this->drupalPostForm('node/add/page', $edit, t('Save'));
 
     // Check that the Basic page has been created.
@@ -128,8 +128,8 @@ function testUnpublishedNodeCreation() {
 
     // Create a node.
     $edit = array();
-    $edit['title[0][value]'] = $this->randomName(8);
-    $edit['body[0][value]'] = $this->randomName(16);
+    $edit['title[0][value]'] = $this->randomMachineName(8);
+    $edit['body[0][value]'] = $this->randomMachineName(16);
     $this->drupalPostForm('node/add/page', $edit, t('Save'));
 
     // Check that the user was redirected to the home page.
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeEntityViewModeAlterTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeEntityViewModeAlterTest.php
index 2fb9918..ee3dec7 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeEntityViewModeAlterTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeEntityViewModeAlterTest.php
@@ -34,7 +34,7 @@ function testNodeViewModeChange() {
 
     // Create a node.
     $edit = array();
-    $edit['title[0][value]'] = $this->randomName(8);
+    $edit['title[0][value]'] = $this->randomMachineName(8);
     $edit['body[0][value]'] = t('Data that should appear only in the body for the node.');
     $edit['body[0][summary]'] = t('Extra data that should appear only in the teaser for the node.');
     $this->drupalPostForm('node/add/page', $edit, t('Save'));
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php b/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php
index 67b34e7..b311dee 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php
@@ -72,9 +72,9 @@ function testMultilingualNodeForm() {
     // Create "Basic page" content.
     $langcode = language_get_default_langcode('node', 'page');
     $title_key = 'title[0][value]';
-    $title_value = $this->randomName(8);
+    $title_value = $this->randomMachineName(8);
     $body_key = 'body[0][value]';
-    $body_value = $this->randomName(16);
+    $body_value = $this->randomMachineName(16);
 
     // Create node to edit.
     $edit = array();
@@ -91,7 +91,7 @@ function testMultilingualNodeForm() {
     $langcode = 'it';
     $this->drupalGet("node/{$node->id()}/edit");
     $edit = array(
-      $title_key => $this->randomName(8),
+      $title_key => $this->randomMachineName(8),
       'langcode' => $langcode,
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -116,9 +116,9 @@ function testMultilingualNodeForm() {
   function testMultilingualDisplaySettings() {
     // Create "Basic page" content.
     $title_key = 'title[0][value]';
-    $title_value = $this->randomName(8);
+    $title_value = $this->randomMachineName(8);
     $body_key = 'body[0][value]';
-    $body_value = $this->randomName(16);
+    $body_value = $this->randomMachineName(16);
 
     // Create node to edit.
     $edit = array();
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeLastChangedTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeLastChangedTest.php
index bf23498..570cce9 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeLastChangedTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeLastChangedTest.php
@@ -42,7 +42,7 @@ public function setUp() {
    * Runs basic tests for node_last_changed function.
    */
   function testNodeLastChanged() {
-    $node = entity_create('node', array('type' => 'article', 'title' => $this->randomName()));
+    $node = entity_create('node', array('type' => 'article', 'title' => $this->randomMachineName()));
     $node->save();
 
     // Test node last changed timestamp.
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodePostSettingsTest.php b/core/modules/node/lib/Drupal/node/Tests/NodePostSettingsTest.php
index a7478a8..0a5a955 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodePostSettingsTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodePostSettingsTest.php
@@ -39,8 +39,8 @@ function testPagePostInfo() {
 
     // Create a node.
     $edit = array();
-    $edit['title[0][value]'] = $this->randomName(8);
-    $edit['body[0][value]'] = $this->randomName(16);
+    $edit['title[0][value]'] = $this->randomMachineName(8);
+    $edit['body[0][value]'] = $this->randomMachineName(16);
     $this->drupalPostForm('node/add/page', $edit, t('Save'));
 
     // Check that the post information is displayed.
@@ -56,8 +56,8 @@ function testPagePostInfo() {
 
     // Create a node.
     $edit = array();
-    $edit['title[0][value]'] = $this->randomName(8);
-    $edit['body[0][value]'] = $this->randomName(16);
+    $edit['title[0][value]'] = $this->randomMachineName(8);
+    $edit['body[0][value]'] = $this->randomMachineName(16);
     $this->drupalPostForm('node/add/page', $edit, t('Save'));
 
     // Check that the post information is displayed.
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeRevisionPermissionsTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeRevisionPermissionsTest.php
index 5c7130b..7609616 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeRevisionPermissionsTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeRevisionPermissionsTest.php
@@ -50,7 +50,7 @@ function setUp() {
         // Create a revision for the same nid and settings with a random log.
         $revision = clone $nodes[$type];
         $revision->setNewRevision();
-        $revision->log = $this->randomName(32);
+        $revision->log = $this->randomMachineName(32);
         $revision->save();
         $this->node_revisions[$type][] = $revision;
       }
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsAllTestCase.php b/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsAllTestCase.php
index abc6668..ec12642 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsAllTestCase.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsAllTestCase.php
@@ -55,12 +55,12 @@ function setUp() {
     // Create three revisions.
     $revision_count = 3;
     for ($i = 0; $i < $revision_count; $i++) {
-      $logs[] = $node->log = $this->randomName(32);
+      $logs[] = $node->log = $this->randomMachineName(32);
 
       // Create revision with a random title and body and update variables.
-      $node->title = $this->randomName();
+      $node->title = $this->randomMachineName();
       $node->body = array(
-        'value' => $this->randomName(32),
+        'value' => $this->randomMachineName(32),
         'format' => filter_default_format(),
       );
       $node->setNewRevision();
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsTest.php
index bcb62fc..0d56361 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsTest.php
@@ -55,12 +55,12 @@ function setUp() {
     // Create three revisions.
     $revision_count = 3;
     for ($i = 0; $i < $revision_count; $i++) {
-      $logs[] = $node->log = $this->randomName(32);
+      $logs[] = $node->log = $this->randomMachineName(32);
 
       // Create revision with a random title and body and update variables.
-      $node->title = $this->randomName();
+      $node->title = $this->randomMachineName();
       $node->body = array(
-        'value' => $this->randomName(32),
+        'value' => $this->randomMachineName(32),
         'format' => filter_default_format(),
       );
       $node->setNewRevision();
@@ -135,7 +135,7 @@ function testRevisions() {
     // Make a new revision and set it to not be default.
     // This will create a new revision that is not "front facing".
     $new_node_revision = clone $node;
-    $new_body = $this->randomName();
+    $new_body = $this->randomMachineName();
     $new_node_revision->body->value = $new_body;
     // Save this as a non-default revision.
     $new_node_revision->setNewRevision();
@@ -165,14 +165,14 @@ function testRevisions() {
    */
   function testNodeRevisionWithoutLogMessage() {
     // Create a node with an initial log message.
-    $log = $this->randomName(10);
+    $log = $this->randomMachineName(10);
     $node = $this->drupalCreateNode(array('log' => $log));
 
     // Save over the same revision and explicitly provide an empty log message
     // (for example, to mimic the case of a node form submitted with no text in
     // the "log message" field), and check that the original log message is
     // preserved.
-    $new_title = $this->randomName(10) . 'testNodeRevisionWithoutLogMessage1';
+    $new_title = $this->randomMachineName(10) . 'testNodeRevisionWithoutLogMessage1';
 
     $node = clone $node;
     $node->title = $new_title;
@@ -190,7 +190,7 @@ function testNodeRevisionWithoutLogMessage() {
 
     // Save a new node revision without providing a log message, and check that
     // this revision has an empty log message.
-    $new_title = $this->randomName(10) . 'testNodeRevisionWithoutLogMessage2';
+    $new_title = $this->randomMachineName(10) . 'testNodeRevisionWithoutLogMessage2';
 
     $node = clone $node;
     $node->title = $new_title;
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeSaveTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeSaveTest.php
index 5164ecf..c104b03 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeSaveTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeSaveTest.php
@@ -48,10 +48,10 @@ function testImport() {
     // Node ID must be a number that is not in the database.
     $max_nid = db_query('SELECT MAX(nid) FROM {node}')->fetchField();
     $test_nid = $max_nid + mt_rand(1000, 1000000);
-    $title = $this->randomName(8);
+    $title = $this->randomMachineName(8);
     $node = array(
       'title' => $title,
-      'body' => array(array('value' => $this->randomName(32))),
+      'body' => array(array('value' => $this->randomMachineName(32))),
       'uid' => $this->web_user->id(),
       'type' => 'article',
       'nid' => $test_nid,
@@ -80,7 +80,7 @@ function testTimestamps() {
     $edit = array(
       'uid' => $this->web_user->id(),
       'type' => 'article',
-      'title' => $this->randomName(8),
+      'title' => $this->randomMachineName(8),
     );
 
     entity_create('node', $edit)->save();
@@ -108,7 +108,7 @@ function testTimestamps() {
     $edit = array(
       'uid' => $this->web_user->id(),
       'type' => 'article',
-      'title' => $this->randomName(8),
+      'title' => $this->randomMachineName(8),
       'created' => 280299600, // Sun, 19 Nov 1978 05:00:00 GMT
       'changed' => 979534800, // Drupal 1.0 release.
     );
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTitleTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTitleTest.php
index 9b503ff..df4fa01 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeTitleTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeTitleTest.php
@@ -44,7 +44,7 @@ function testNodeTitle() {
     // Create "Basic page" content with title.
     // Add the node to the frontpage so we can test if teaser links are clickable.
     $settings = array(
-      'title' => $this->randomName(8),
+      'title' => $this->randomMachineName(8),
       'promote' => 1,
     );
     $node = $this->drupalCreateNode($settings);
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTitleXSSTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTitleXSSTest.php
index 4eb58b7..f9a2fd6 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeTitleXSSTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeTitleXSSTest.php
@@ -28,7 +28,7 @@ function testNodeTitleXSS() {
     $this->drupalLogin($web_user);
 
     $xss = '<script>alert("xss")</script>';
-    $title = $xss . $this->randomName();
+    $title = $xss . $this->randomMachineName();
     $edit = array();
     $edit['title[0][value]'] = $title;
 
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php
index 717abcc..012980d 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php
@@ -63,7 +63,7 @@ function testNodeTokenReplacement() {
       'tnid' => 0,
       'uid' => $account->id(),
       'title' => '<blink>Blinking Text</blink>',
-      'body' => array(array('value' => $this->randomName(32), 'summary' => $this->randomName(16), 'format' => 'plain_text')),
+      'body' => array(array('value' => $this->randomMachineName(32), 'summary' => $this->randomMachineName(16), 'format' => 'plain_text')),
     ));
     $node->save();
 
@@ -110,7 +110,7 @@ function testNodeTokenReplacement() {
       'type' => 'article',
       'uid' => $account->id(),
       'title' => '<blink>Blinking Text</blink>',
-      'body' => array(array('value' => $this->randomName(32), 'format' => 'plain_text')),
+      'body' => array(array('value' => $this->randomMachineName(32), 'format' => 'plain_text')),
     ));
     $node->save();
 
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php
index 95eba8c..d12c474 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php
@@ -77,7 +77,7 @@ protected function getAdministratorPermissions() {
    * Overrides \Drupal\content_translation\Tests\ContentTranslationUITest::getNewEntityValues().
    */
   protected function getNewEntityValues($langcode) {
-    return array('title' => array(array('value' => $this->randomName()))) + parent::getNewEntityValues($langcode);
+    return array('title' => array(array('value' => $this->randomMachineName()))) + parent::getNewEntityValues($langcode);
   }
 
   /**
@@ -200,7 +200,7 @@ function testTranslateLinkContentAdminPage() {
    */
   public function testDisabledBundle() {
     // Create a bundle that does not have translation enabled.
-    $disabledBundle = $this->randomName();
+    $disabledBundle = $this->randomMachineName();
     $this->drupalCreateContentType(array('type' => $disabledBundle, 'name' => $disabledBundle));
 
     // Create a node for each bundle.
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTypeInitialLanguageTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTypeInitialLanguageTest.php
index ae17434..1ff8689 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeTypeInitialLanguageTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeTypeInitialLanguageTest.php
@@ -101,8 +101,8 @@ function testNodeTypeInitialLanguageDefaults() {
   function testLanguageFieldVisibility() {
     // Creates a node to test Language field visibility feature.
     $edit = array(
-      'title[0][value]' => $this->randomName(8),
-      'body[0][value]' => $this->randomName(16),
+      'title[0][value]' => $this->randomMachineName(8),
+      'body[0][value]' => $this->randomMachineName(16),
     );
     $this->drupalPostForm('node/add/article', $edit, t('Save'));
     $node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTypePersistenceTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTypePersistenceTest.php
index 66ea769..71c6ee6 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeTypePersistenceTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeTypePersistenceTest.php
@@ -42,7 +42,7 @@ function testNodeTypeCustomizationPersistence() {
     $this->assertText('forum', 'forum type is found on node/add');
 
     // Customize forum description.
-    $description = $this->randomName();
+    $description = $this->randomMachineName();
     $edit = array('description' => $description);
     $this->drupalPostForm('admin/structure/types/manage/forum', $edit, t('Save content type'));
 
diff --git a/core/modules/node/lib/Drupal/node/Tests/PageEditTest.php b/core/modules/node/lib/Drupal/node/Tests/PageEditTest.php
index 2361d13..412ffb7 100644
--- a/core/modules/node/lib/Drupal/node/Tests/PageEditTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/PageEditTest.php
@@ -39,8 +39,8 @@ function testPageEdit() {
     $body_key = 'body[0][value]';
     // Create node to edit.
     $edit = array();
-    $edit[$title_key] = $this->randomName(8);
-    $edit[$body_key] = $this->randomName(16);
+    $edit[$title_key] = $this->randomMachineName(8);
+    $edit[$body_key] = $this->randomMachineName(16);
     $this->drupalPostForm('node/add/page', $edit, t('Save'));
 
     // Check that the node exists in the database.
@@ -62,8 +62,8 @@ function testPageEdit() {
 
     // Edit the content of the node.
     $edit = array();
-    $edit[$title_key] = $this->randomName(8);
-    $edit[$body_key] = $this->randomName(16);
+    $edit[$title_key] = $this->randomMachineName(8);
+    $edit[$body_key] = $this->randomMachineName(16);
     // Stay on the current page, without reloading.
     $this->drupalPostForm(NULL, $edit, t('Save'));
 
@@ -77,8 +77,8 @@ function testPageEdit() {
     // Edit the same node, creating a new revision.
     $this->drupalGet("node/" . $node->id() . "/edit");
     $edit = array();
-    $edit['title[0][value]'] = $this->randomName(8);
-    $edit[$body_key] = $this->randomName(16);
+    $edit['title[0][value]'] = $this->randomMachineName(8);
+    $edit[$body_key] = $this->randomMachineName(16);
     $edit['revision'] = TRUE;
     $this->drupalPostForm(NULL, $edit, t('Save and keep published'));
 
@@ -104,8 +104,8 @@ function testPageAuthoredBy() {
     // Create node to edit.
     $body_key = 'body[0][value]';
     $edit = array();
-    $edit['title[0][value]'] = $this->randomName(8);
-    $edit[$body_key] = $this->randomName(16);
+    $edit['title[0][value]'] = $this->randomMachineName(8);
+    $edit[$body_key] = $this->randomMachineName(16);
     $this->drupalPostForm('node/add/page', $edit, t('Save and publish'));
 
     // Check that the node was authored by the currently logged in user.
diff --git a/core/modules/node/lib/Drupal/node/Tests/PagePreviewTest.php b/core/modules/node/lib/Drupal/node/Tests/PagePreviewTest.php
index 48a8ea6..38832fa 100644
--- a/core/modules/node/lib/Drupal/node/Tests/PagePreviewTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/PagePreviewTest.php
@@ -44,9 +44,9 @@ function setUp() {
 
     // Add a vocabulary so we can test different view modes.
     $vocabulary = entity_create('taxonomy_vocabulary', array(
-      'name' => $this->randomName(),
-      'description' => $this->randomName(),
-      'vid' => $this->randomName(),
+      'name' => $this->randomMachineName(),
+      'description' => $this->randomMachineName(),
+      'vid' => $this->randomMachineName(),
       'langcode' => Language::LANGCODE_NOT_SPECIFIED,
       'help' => '',
     ));
@@ -56,8 +56,8 @@ function setUp() {
 
     // Add a term to the vocabulary.
     $term = entity_create('taxonomy_term', array(
-      'name' => $this->randomName(),
-      'description' => $this->randomName(),
+      'name' => $this->randomMachineName(),
+      'description' => $this->randomMachineName(),
       'vid' => $this->vocabulary->id(),
       'langcode' => Language::LANGCODE_NOT_SPECIFIED,
     ));
@@ -66,7 +66,7 @@ function setUp() {
     $this->term = $term;
 
     // Set up a field and instance.
-    $this->field_name = drupal_strtolower($this->randomName());
+    $this->field_name = drupal_strtolower($this->randomMachineName());
     entity_create('field_config', array(
       'name' => $this->field_name,
       'entity_type' => 'node',
@@ -116,8 +116,8 @@ function testPagePreview() {
 
     // Fill in node creation form and preview node.
     $edit = array();
-    $edit[$title_key] = $this->randomName(8);
-    $edit[$body_key] = $this->randomName(16);
+    $edit[$title_key] = $this->randomMachineName(8);
+    $edit[$body_key] = $this->randomMachineName(16);
     $edit[$term_key] = $this->term->getName();
     $this->drupalPostForm('node/add/page', $edit, t('Preview'));
 
@@ -148,8 +148,8 @@ function testPagePreview() {
     // Check with two new terms on the edit form, additionally to the existing
     // one.
     $edit = array();
-    $newterm1 = $this->randomName(8);
-    $newterm2 = $this->randomName(8);
+    $newterm1 = $this->randomMachineName(8);
+    $newterm2 = $this->randomMachineName(8);
     $edit[$term_key] = $this->term->getName() . ', ' . $newterm1 . ', ' . $newterm2;
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Preview'));
     $this->assertRaw('>' . $newterm1 . '<', 'First new term displayed.');
@@ -164,7 +164,7 @@ function testPagePreview() {
     // Check with one more new term, keeping old terms, removing the existing
     // one.
     $edit = array();
-    $newterm3 = $this->randomName(8);
+    $newterm3 = $this->randomMachineName(8);
     $edit[$term_key] = $newterm1 . ', ' . $newterm3 . ', ' . $newterm2;
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Preview'));
     $this->assertRaw('>' . $newterm1 . '<', 'First existing term displayed.');
@@ -189,10 +189,10 @@ function testPagePreviewWithRevisions() {
 
     // Fill in node creation form and preview node.
     $edit = array();
-    $edit[$title_key] = $this->randomName(8);
-    $edit[$body_key] = $this->randomName(16);
+    $edit[$title_key] = $this->randomMachineName(8);
+    $edit[$body_key] = $this->randomMachineName(16);
     $edit[$term_key] = $this->term->id();
-    $edit['log'] = $this->randomName(32);
+    $edit['log'] = $this->randomMachineName(32);
     $this->drupalPostForm('node/add/page', $edit, t('Preview'));
 
     // Check that the preview is displaying the title, body and term.
diff --git a/core/modules/node/lib/Drupal/node/Tests/Views/FrontPageTest.php b/core/modules/node/lib/Drupal/node/Tests/Views/FrontPageTest.php
index b1f00ef..ad8b2ae 100644
--- a/core/modules/node/lib/Drupal/node/Tests/Views/FrontPageTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/Views/FrontPageTest.php
@@ -48,7 +48,7 @@ protected function setUp() {
    * Tests the frontpage.
    */
   public function testFrontPage() {
-    $site_name = $this->randomName();
+    $site_name = $this->randomMachineName();
     $this->container->get('config.factory')
       ->get('system.site')
       ->set('name', $site_name)
@@ -68,7 +68,7 @@ public function testFrontPage() {
     for ($i = 0; $i < 20; $i++) {
       $values = array();
       $values['type'] = 'article';
-      $values['title'] = $this->randomName();
+      $values['title'] = $this->randomMachineName();
       $values['promote'] = TRUE;
       $values['status'] = TRUE;
       // Test descending sort order.
@@ -95,7 +95,7 @@ public function testFrontPage() {
 
     $values = array();
     $values['type'] = 'article';
-    $values['title'] = $this->randomName();
+    $values['title'] = $this->randomMachineName();
     $values['status'] = TRUE;
     $values['promote'] = FALSE;
     $node = $this->nodeStorage->create($values);
@@ -104,7 +104,7 @@ public function testFrontPage() {
 
     $values['promote'] = TRUE;
     $values['status'] = FALSE;
-    $values['title'] = $this->randomName();
+    $values['title'] = $this->randomMachineName();
     $node = $this->nodeStorage->create($values);
     $node->save();
     $not_expected_nids[] = $node->id();
@@ -112,7 +112,7 @@ public function testFrontPage() {
     $values['promote'] = TRUE;
     $values['sticky'] = TRUE;
     $values['status'] = FALSE;
-    $values['title'] = $this->randomName();
+    $values['title'] = $this->randomMachineName();
     $node = $this->nodeStorage->create($values);
     $node->save();
     $not_expected_nids[] = $node->id();
diff --git a/core/modules/node/lib/Drupal/node/Tests/Views/RowPluginTest.php b/core/modules/node/lib/Drupal/node/Tests/Views/RowPluginTest.php
index a44a369..8c19ed8 100644
--- a/core/modules/node/lib/Drupal/node/Tests/Views/RowPluginTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/Views/RowPluginTest.php
@@ -67,9 +67,9 @@ protected function setUp() {
           'type' => 'article',
           'body' => array(
             array(
-              'value' => $this->randomName(42),
+              'value' => $this->randomMachineName(42),
               'format' => filter_default_format(),
-              'summary' => $this->randomName(),
+              'summary' => $this->randomMachineName(),
             ),
           ),
         )
@@ -95,11 +95,11 @@ protected function setUp() {
    */
   public function drupalCreateComment(array $settings = array()) {
     $settings += array(
-      'subject' => $this->randomName(),
+      'subject' => $this->randomMachineName(),
       'entity_id' => $settings['entity_id'],
       'field_name' => 'comment',
       'entity_type' => 'node',
-      'comment_body' => $this->randomName(40),
+      'comment_body' => $this->randomMachineName(40),
     );
 
     $comment = entity_create('comment', $settings);
diff --git a/core/modules/options/lib/Drupal/options/Tests/OptionsDynamicValuesTest.php b/core/modules/options/lib/Drupal/options/Tests/OptionsDynamicValuesTest.php
index 70c5273..dc5c4d7 100644
--- a/core/modules/options/lib/Drupal/options/Tests/OptionsDynamicValuesTest.php
+++ b/core/modules/options/lib/Drupal/options/Tests/OptionsDynamicValuesTest.php
@@ -57,7 +57,7 @@ function setUp() {
     // options_test_dynamic_values_callback().
     $values = array(
       'user_id' => mt_rand(1, 10),
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
     );
     $this->entity = entity_create('entity_test_rev', $values);
     $this->entity->save();
diff --git a/core/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php b/core/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php
index dd6d13e..ea8ce9f 100644
--- a/core/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php
+++ b/core/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php
@@ -44,7 +44,7 @@ function setUp() {
     $this->drupalLogin($admin_user);
 
     // Create content type, with underscores.
-    $type_name = 'test_' . strtolower($this->randomName());
+    $type_name = 'test_' . strtolower($this->randomMachineName());
     $this->type_name = $type_name;
     $type = $this->drupalCreateContentType(array('name' => $type_name, 'type' => $type_name));
     $this->type = $type->type;
@@ -175,7 +175,7 @@ function testOptionsAllowedValuesText() {
     $array = array('zero' => 'Zero', 'One' => 'One');
     $this->assertAllowedValuesInput($string, $array, 'Mixed lists are accepted.');
     // Overly long keys.
-    $this->assertAllowedValuesInput("zero|Zero\n" . $this->randomName(256) . "|One", 'each key must be a string at most 255 characters long', 'Overly long keys are rejected.');
+    $this->assertAllowedValuesInput("zero|Zero\n" . $this->randomMachineName(256) . "|One", 'each key must be a string at most 255 characters long', 'Overly long keys are rejected.');
 
     // Create a node with actual data for the field.
     $settings = array(
@@ -214,8 +214,8 @@ function testOptionsAllowedValuesBoolean() {
     $this->createOptionsField('list_boolean');
 
     // Check that the separate 'On' and 'Off' form fields work.
-    $on = $this->randomName();
-    $off = $this->randomName();
+    $on = $this->randomMachineName();
+    $off = $this->randomMachineName();
     $allowed_values = array(1 => $on, 0 => $off);
     $edit = array(
       'on' => $on,
@@ -304,12 +304,12 @@ function assertAllowedValuesInput($input_string, $result, $message) {
    * Tests normal and key formatter display on node display.
    */
   function testNodeDisplay() {
-    $this->field_name = strtolower($this->randomName());
+    $this->field_name = strtolower($this->randomMachineName());
     $this->createOptionsField('list_boolean');
     $node = $this->drupalCreateNode(array('type' => $this->type));
 
-    $on = $this->randomName();
-    $off = $this->randomName();
+    $on = $this->randomMachineName();
+    $off = $this->randomMachineName();
     $edit = array(
       'on' => $on,
       'off' => $off,
diff --git a/core/modules/options/lib/Drupal/options/Tests/OptionsWidgetsTest.php b/core/modules/options/lib/Drupal/options/Tests/OptionsWidgetsTest.php
index a24a7a9..1283c1b 100644
--- a/core/modules/options/lib/Drupal/options/Tests/OptionsWidgetsTest.php
+++ b/core/modules/options/lib/Drupal/options/Tests/OptionsWidgetsTest.php
@@ -124,7 +124,7 @@ function testRadioButtons() {
     // Create an entity.
     $entity = entity_create('entity_test', array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
     ));
     $entity->save();
     $entity_init = clone $entity;
@@ -182,7 +182,7 @@ function testCheckBoxes() {
     // Create an entity.
     $entity = entity_create('entity_test', array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
     ));
     $entity->save();
     $entity_init = clone $entity;
@@ -273,7 +273,7 @@ function testSelectListSingle() {
     // Create an entity.
     $entity = entity_create('entity_test', array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
     ));
     $entity->save();
     $entity_init = clone $entity;
@@ -372,7 +372,7 @@ function testSelectListMultiple() {
     // Create an entity.
     $entity = entity_create('entity_test', array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
     ));
     $entity->save();
     $entity_init = clone $entity;
@@ -492,7 +492,7 @@ function testOnOffCheckbox() {
     // Create an entity.
     $entity = entity_create('entity_test', array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
     ));
     $entity->save();
     $entity_init = clone $entity;
diff --git a/core/modules/path/lib/Drupal/path/Tests/PathAliasTest.php b/core/modules/path/lib/Drupal/path/Tests/PathAliasTest.php
index ab53370..4e3edb3 100644
--- a/core/modules/path/lib/Drupal/path/Tests/PathAliasTest.php
+++ b/core/modules/path/lib/Drupal/path/Tests/PathAliasTest.php
@@ -45,7 +45,7 @@ function testPathCache() {
     // Create alias.
     $edit = array();
     $edit['source'] = 'node/' . $node1->id();
-    $edit['alias'] = $this->randomName(8);
+    $edit['alias'] = $this->randomMachineName(8);
     $this->drupalPostForm('admin/config/search/path/add', $edit, t('Save'));
 
     // Check the path alias whitelist cache.
@@ -76,7 +76,7 @@ function testAdminAlias() {
     // Create alias.
     $edit = array();
     $edit['source'] = 'node/' . $node1->id();
-    $edit['alias'] = $this->randomName(8);
+    $edit['alias'] = $this->randomMachineName(8);
     $this->drupalPostForm('admin/config/search/path/add', $edit, t('Save'));
 
     // Confirm that the alias works.
@@ -127,7 +127,7 @@ function testAdminAlias() {
     // Create a really long alias.
     $edit = array();
     $edit['source'] = 'node/' . $node1->id();
-    $alias = $this->randomName(128);
+    $alias = $this->randomMachineName(128);
     $edit['alias'] = $alias;
     // The alias is shortened to 50 characters counting the elipsis.
     $truncated_alias = substr($alias, 0, 47);
@@ -146,7 +146,7 @@ function testNodeAlias() {
 
     // Create alias.
     $edit = array();
-    $edit['path[alias]'] = $this->randomName(8);
+    $edit['path[alias]'] = $this->randomMachineName(8);
     $this->drupalPostForm('node/' . $node1->id() . '/edit', $edit, t('Save'));
 
     // Confirm that the alias works.
@@ -216,7 +216,7 @@ function testDuplicateNodeAlias() {
     // Create one node with a random alias.
     $node_one = $this->drupalCreateNode();
     $edit = array();
-    $edit['path[alias]'] = $this->randomName();
+    $edit['path[alias]'] = $this->randomMachineName();
     $this->drupalPostForm('node/' . $node_one->id() . '/edit', $edit, t('Save'));
 
     // Now create another node and try to set the same alias.
diff --git a/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php b/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php
index a2fcbb7..a536b3c 100644
--- a/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php
+++ b/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php
@@ -78,7 +78,7 @@ function setUp() {
    */
   function testAliasTranslation() {
     $english_node = $this->drupalCreateNode(array('type' => 'page', 'langcode' => 'en'));
-    $english_alias = $this->randomName();
+    $english_alias = $this->randomMachineName();
     $translatable = !$english_node->isNew() && $english_node->isTranslatable() && count($english_node->getTranslationLanguages()) > 1 && ($field = $english_node->getFieldDefinition('status')) && $field->isTranslatable();
 
     // Edit the node to set language and path.
@@ -95,9 +95,9 @@ function testAliasTranslation() {
     $this->clickLink(t('Add'));
 
     $edit = array();
-    $edit['title[0][value]'] = $this->randomName();
-    $edit['body[0][value]'] = $this->randomName();
-    $french_alias = $this->randomName();
+    $edit['title[0][value]'] = $this->randomMachineName();
+    $edit['body[0][value]'] = $this->randomMachineName();
+    $french_alias = $this->randomMachineName();
     $edit['path[alias]'] = $french_alias;
     $this->drupalPostForm(NULL, $edit, t('Save') . ' ' . ($translatable ? t('(this translation)') : t('(all translations)')));
 
diff --git a/core/modules/path/lib/Drupal/path/Tests/PathLanguageUiTest.php b/core/modules/path/lib/Drupal/path/Tests/PathLanguageUiTest.php
index 5c97eff..6ba129d 100644
--- a/core/modules/path/lib/Drupal/path/Tests/PathLanguageUiTest.php
+++ b/core/modules/path/lib/Drupal/path/Tests/PathLanguageUiTest.php
@@ -49,7 +49,7 @@ function setUp() {
    * Tests that a language-neutral URL alias works.
    */
   function testLanguageNeutralUrl() {
-    $name = $this->randomName(8);
+    $name = $this->randomMachineName(8);
     $edit = array();
     $edit['source'] = 'admin/config/search/path';
     $edit['alias'] = $name;
@@ -63,7 +63,7 @@ function testLanguageNeutralUrl() {
    * Tests that a default language URL alias works.
    */
   function testDefaultLanguageUrl() {
-    $name = $this->randomName(8);
+    $name = $this->randomMachineName(8);
     $edit = array();
     $edit['source'] = 'admin/config/search/path';
     $edit['alias'] = $name;
@@ -78,7 +78,7 @@ function testDefaultLanguageUrl() {
    * Tests that a non-default language URL alias works.
    */
   function testNonDefaultUrl() {
-    $name = $this->randomName(8);
+    $name = $this->randomMachineName(8);
     $edit = array();
     $edit['source'] = 'admin/config/search/path';
     $edit['alias'] = $name;
diff --git a/core/modules/path/lib/Drupal/path/Tests/PathTaxonomyTermTest.php b/core/modules/path/lib/Drupal/path/Tests/PathTaxonomyTermTest.php
index d2fd278..3c4810b 100644
--- a/core/modules/path/lib/Drupal/path/Tests/PathTaxonomyTermTest.php
+++ b/core/modules/path/lib/Drupal/path/Tests/PathTaxonomyTermTest.php
@@ -48,11 +48,11 @@ function setUp() {
   function testTermAlias() {
     // Create a term in the default 'Tags' vocabulary with URL alias.
     $vocabulary = entity_load('taxonomy_vocabulary', 'tags');
-    $description = $this->randomName();
+    $description = $this->randomMachineName();
     $edit = array(
-      'name[0][value]' => $this->randomName(),
+      'name[0][value]' => $this->randomMachineName(),
       'description[0][value]' => $description,
-      'path[alias]' => $this->randomName(),
+      'path[alias]' => $this->randomMachineName(),
     );
     $this->drupalPostForm('admin/structure/taxonomy/manage/' . $vocabulary->id() . '/add', $edit, t('Save'));
     $tid = db_query("SELECT tid FROM {taxonomy_term_data} WHERE name = :name", array(':name' => $edit['name[0][value]']))->fetchField();
@@ -69,7 +69,7 @@ function testTermAlias() {
 
     // Change the term's URL alias.
     $edit2 = array();
-    $edit2['path[alias]'] = $this->randomName();
+    $edit2['path[alias]'] = $this->randomMachineName();
     $this->drupalPostForm('taxonomy/term/' . $tid . '/edit', $edit2, t('Save'));
 
     // Confirm that the changed alias works.
diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php
index f152e0b..39fc697 100644
--- a/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php
+++ b/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php
@@ -160,7 +160,7 @@ public function testCommentRdfaMarkup() {
 
     // Posts comment #2 as anonymous user.
     $anonymous_user = array();
-    $anonymous_user['name'] = $this->randomName();
+    $anonymous_user['name'] = $this->randomMachineName();
     $anonymous_user['mail'] = 'tester@simpletest.org';
     $anonymous_user['homepage'] = 'http://example.org/';
     $comment2 = $this->saveComment($this->node->id(), NULL, $anonymous_user);
@@ -336,8 +336,8 @@ function saveComment($nid, $uid, $contact = NULL, $pid = 0) {
       'field_name' => 'comment',
       'uid' => $uid,
       'pid' => $pid,
-      'subject' => $this->randomName(),
-      'comment_body' => $this->randomName(),
+      'subject' => $this->randomMachineName(),
+      'comment_body' => $this->randomMachineName(),
       'status' => 1,
     );
     if ($contact) {
diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/Field/FieldRdfaDatatypeCallbackTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/Field/FieldRdfaDatatypeCallbackTest.php
index b6e6413..3f98a44 100644
--- a/core/modules/rdf/lib/Drupal/rdf/Tests/Field/FieldRdfaDatatypeCallbackTest.php
+++ b/core/modules/rdf/lib/Drupal/rdf/Tests/Field/FieldRdfaDatatypeCallbackTest.php
@@ -44,7 +44,7 @@ public function setUp() {
     ))->save();
 
     // Set up test values.
-    $this->test_value = $this->randomName();
+    $this->test_value = $this->randomMachineName();
     $this->entity = entity_create('entity_test');
     $this->entity->{$this->fieldName}->value = $this->test_value;
     $this->entity->save();
diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/Field/TaxonomyTermReferenceRdfaTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/Field/TaxonomyTermReferenceRdfaTest.php
index 00ac9d7..a9e34af 100644
--- a/core/modules/rdf/lib/Drupal/rdf/Tests/Field/TaxonomyTermReferenceRdfaTest.php
+++ b/core/modules/rdf/lib/Drupal/rdf/Tests/Field/TaxonomyTermReferenceRdfaTest.php
@@ -53,8 +53,8 @@ public function setUp() {
     $this->installSchema('taxonomy', array('taxonomy_term_data', 'taxonomy_term_hierarchy'));
 
     $vocabulary = entity_create('taxonomy_vocabulary', array(
-      'name' => $this->randomName(),
-      'vid' => drupal_strtolower($this->randomName()),
+      'name' => $this->randomMachineName(),
+      'vid' => drupal_strtolower($this->randomMachineName()),
       'langcode' => Language::LANGCODE_NOT_SPECIFIED,
     ));
     $vocabulary->save();
@@ -80,7 +80,7 @@ public function setUp() {
     ))->save();
 
     $this->term = entity_create('taxonomy_term', array(
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       'vid' => $vocabulary->id(),
       'langcode' => Language::LANGCODE_NOT_SPECIFIED,
     ));
diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/FileFieldAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/FileFieldAttributesTest.php
index cc738e4..7b62dec 100644
--- a/core/modules/rdf/lib/Drupal/rdf/Tests/FileFieldAttributesTest.php
+++ b/core/modules/rdf/lib/Drupal/rdf/Tests/FileFieldAttributesTest.php
@@ -53,7 +53,7 @@ public static function getInfo() {
 
   public function setUp() {
     parent::setUp();
-    $this->fieldName = strtolower($this->randomName());
+    $this->fieldName = strtolower($this->randomMachineName());
 
     $type_name = 'article';
     $this->createFileField($this->fieldName, 'node', $type_name);
diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/NodeAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/NodeAttributesTest.php
index 76e1af6..3cef1a0 100644
--- a/core/modules/rdf/lib/Drupal/rdf/Tests/NodeAttributesTest.php
+++ b/core/modules/rdf/lib/Drupal/rdf/Tests/NodeAttributesTest.php
@@ -55,7 +55,7 @@ function testNodeAttributes() {
     // escaped more than once.
     $node = $this->drupalCreateNode(array(
       'type' => 'article',
-      'title' => $this->randomName(8) . "'",
+      'title' => $this->randomMachineName(8) . "'",
     ));
 
     $node_uri = url('node/' . $node->id(), array('absolute' => TRUE));
diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/StandardProfileTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/StandardProfileTest.php
index 5919d54..32a6403 100644
--- a/core/modules/rdf/lib/Drupal/rdf/Tests/StandardProfileTest.php
+++ b/core/modules/rdf/lib/Drupal/rdf/Tests/StandardProfileTest.php
@@ -130,8 +130,8 @@ public function setUp() {
 
     // Create term.
     $this->term = entity_create('taxonomy_term', array(
-      'name' => $this->randomName(),
-      'description' => $this->randomName(),
+      'name' => $this->randomMachineName(),
+      'description' => $this->randomMachineName(),
       'vid' => 'tags',
     ));
     $this->term->save();
@@ -507,8 +507,8 @@ protected function saveComment($nid, $uid, $contact = NULL, $pid = 0) {
       'field_name' => 'comment',
       'uid' => $uid,
       'pid' => $pid,
-      'subject' => $this->randomName(),
-      'comment_body' => $this->randomName(),
+      'subject' => $this->randomMachineName(),
+      'comment_body' => $this->randomMachineName(),
       'status' => 1,
     );
     if ($contact) {
diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/TrackerAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/TrackerAttributesTest.php
index fa7f673..270c2a4 100644
--- a/core/modules/rdf/lib/Drupal/rdf/Tests/TrackerAttributesTest.php
+++ b/core/modules/rdf/lib/Drupal/rdf/Tests/TrackerAttributesTest.php
@@ -168,8 +168,8 @@ function _testBasicTrackerRdfaMarkup(NodeInterface $node) {
 
     // Adds new comment to ensure the tracker is updated accordingly.
     $comment = array(
-      'subject' => $this->randomName(),
-      'comment_body[0][value]' => $this->randomName(),
+      'subject' => $this->randomMachineName(),
+      'comment_body[0][value]' => $this->randomMachineName(),
     );
     $this->drupalPostForm('comment/reply/node/' . $node->id() .'/comment', $comment, t('Save'));
 
diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/UserAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/UserAttributesTest.php
index 847d893..5ca7912 100644
--- a/core/modules/rdf/lib/Drupal/rdf/Tests/UserAttributesTest.php
+++ b/core/modules/rdf/lib/Drupal/rdf/Tests/UserAttributesTest.php
@@ -54,9 +54,9 @@ function testUserAttributesInMarkup() {
     $user1 = $this->drupalCreateUser(array('access user profiles'));
 
     $authors = array(
-      $this->drupalCreateUser(array(), $this->randomName(30)),
-      $this->drupalCreateUser(array(), $this->randomName(20)),
-      $this->drupalCreateUser(array(), $this->randomName(5))
+      $this->drupalCreateUser(array(), $this->randomMachineName(30)),
+      $this->drupalCreateUser(array(), $this->randomMachineName(20)),
+      $this->drupalCreateUser(array(), $this->randomMachineName(5))
     );
 
     $this->drupalLogin($user1);
diff --git a/core/modules/rdf/tests/Drupal/rdf/Tests/RdfMappingConfigEntityUnitTest.php b/core/modules/rdf/tests/Drupal/rdf/Tests/RdfMappingConfigEntityUnitTest.php
index abe8c07..8aab621 100644
--- a/core/modules/rdf/tests/Drupal/rdf/Tests/RdfMappingConfigEntityUnitTest.php
+++ b/core/modules/rdf/tests/Drupal/rdf/Tests/RdfMappingConfigEntityUnitTest.php
@@ -62,7 +62,7 @@ public static function getInfo() {
    * {@inheritdoc}
    */
   public function setUp() {
-    $this->entityTypeId = $this->randomName();
+    $this->entityTypeId = $this->randomMachineName();
 
     $this->entityType = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
     $this->entityType->expects($this->any())
@@ -84,7 +84,7 @@ public function setUp() {
    * @covers ::calculateDependencies
    */
   public function testCalculateDependencies() {
-    $target_entity_type_id = $this->randomName(16);
+    $target_entity_type_id = $this->randomMachineName(16);
 
     $target_entity_type = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
     $target_entity_type->expects($this->any())
@@ -114,15 +114,15 @@ public function testCalculateDependencies() {
    * @covers ::calculateDependencies
    */
   public function testCalculateDependenciesWithEntityBundle() {
-    $target_entity_type_id = $this->randomName(16);
+    $target_entity_type_id = $this->randomMachineName(16);
     $target_entity_type = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
     $target_entity_type->expects($this->any())
                      ->method('getProvider')
                      ->will($this->returnValue('test_module'));
-    $bundle_id = $this->randomName(10);
+    $bundle_id = $this->randomMachineName(10);
     $values = array('targetEntityType' => $target_entity_type_id , 'bundle' => $bundle_id);
 
-    $bundle_entity_type_id = $this->randomName(17);
+    $bundle_entity_type_id = $this->randomMachineName(17);
     $bundle_entity = $this->getMock('\Drupal\Core\Config\Entity\ConfigEntityInterface');
     $bundle_entity
       ->expects($this->once())
diff --git a/core/modules/responsive_image/lib/Drupal/responsive_image/Tests/ResponsiveImageFieldDisplayTest.php b/core/modules/responsive_image/lib/Drupal/responsive_image/Tests/ResponsiveImageFieldDisplayTest.php
index cd96caf..248d27e 100644
--- a/core/modules/responsive_image/lib/Drupal/responsive_image/Tests/ResponsiveImageFieldDisplayTest.php
+++ b/core/modules/responsive_image/lib/Drupal/responsive_image/Tests/ResponsiveImageFieldDisplayTest.php
@@ -116,7 +116,7 @@ public function testResponsiveImageFieldFormattersPrivate() {
    * Test responsive image formatters on node display.
    */
   public function _testResponsiveImageFieldFormatters($scheme) {
-    $field_name = drupal_strtolower($this->randomName());
+    $field_name = drupal_strtolower($this->randomMachineName());
     $this->createImageField($field_name, 'article', array('uri_scheme' => $scheme));
     // Create a new node with an image attached.
     $test_image = current($this->drupalGetTestFiles('image'));
diff --git a/core/modules/responsive_image/tests/Drupal/responsive_image/Tests/ResponsiveImageMappingEntityTest.php b/core/modules/responsive_image/tests/Drupal/responsive_image/Tests/ResponsiveImageMappingEntityTest.php
index 43ccb05..e61b279 100644
--- a/core/modules/responsive_image/tests/Drupal/responsive_image/Tests/ResponsiveImageMappingEntityTest.php
+++ b/core/modules/responsive_image/tests/Drupal/responsive_image/Tests/ResponsiveImageMappingEntityTest.php
@@ -83,8 +83,8 @@ public static function getInfo() {
    * {@inheritdoc}
    */
   public function setUp() {
-    $this->entityTypeId = $this->randomName();
-    $this->provider = $this->randomName();
+    $this->entityTypeId = $this->randomMachineName();
+    $this->provider = $this->randomMachineName();
     $this->entityType = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
     $this->entityType->expects($this->any())
                      ->method('getProvider')
@@ -98,7 +98,7 @@ public function setUp() {
 
     $this->uuid = $this->getMock('\Drupal\Component\Uuid\UuidInterface');
 
-    $this->breakpointGroupId = $this->randomName(9);
+    $this->breakpointGroupId = $this->randomMachineName(9);
     $this->breakpointGroup = $this->getMock('Drupal\breakpoint\Entity\BreakpointGroup', array(), array(array('id' => $this->breakpointGroupId)));
 
     $this->breakpointGroupStorage = $this->getMock('\Drupal\Core\Config\Entity\ConfigEntityStorageInterface');
diff --git a/core/modules/rest/lib/Drupal/rest/Tests/CreateTest.php b/core/modules/rest/lib/Drupal/rest/Tests/CreateTest.php
index e33aebc..e7717a8 100644
--- a/core/modules/rest/lib/Drupal/rest/Tests/CreateTest.php
+++ b/core/modules/rest/lib/Drupal/rest/Tests/CreateTest.php
@@ -103,7 +103,7 @@ public function testCreate() {
 
       // Try to send invalid data to trigger the entity validation constraints.
       // Send a UUID that is too long.
-      $entity->set('uuid', $this->randomName(129));
+      $entity->set('uuid', $this->randomMachineName(129));
       $invalid_serialized = $serializer->serialize($entity, $this->defaultFormat);
       $response = $this->httpRequest('entity/' . $entity_type, 'POST', $invalid_serialized, $this->defaultMimeType);
       $this->assertResponse(422);
diff --git a/core/modules/rest/lib/Drupal/rest/Tests/RESTTestBase.php b/core/modules/rest/lib/Drupal/rest/Tests/RESTTestBase.php
index fdf56d9..5b1f1df 100644
--- a/core/modules/rest/lib/Drupal/rest/Tests/RESTTestBase.php
+++ b/core/modules/rest/lib/Drupal/rest/Tests/RESTTestBase.php
@@ -186,7 +186,7 @@ protected function entityValues($entity_type) {
     switch ($entity_type) {
       case 'entity_test':
         return array(
-          'name' => $this->randomName(),
+          'name' => $this->randomMachineName(),
           'user_id' => 1,
           'field_test_text' => array(0 => array(
             'value' => $this->randomString(),
@@ -198,10 +198,10 @@ protected function entityValues($entity_type) {
       case 'node_type':
         return array(
           'type' => 'article',
-          'name' => $this->randomName(),
+          'name' => $this->randomMachineName(),
         );
       case 'user':
-        return array('name' => $this->randomName());
+        return array('name' => $this->randomMachineName());
       default:
         return array();
     }
diff --git a/core/modules/rest/lib/Drupal/rest/Tests/UpdateTest.php b/core/modules/rest/lib/Drupal/rest/Tests/UpdateTest.php
index adff21d..b505be7 100644
--- a/core/modules/rest/lib/Drupal/rest/Tests/UpdateTest.php
+++ b/core/modules/rest/lib/Drupal/rest/Tests/UpdateTest.php
@@ -145,7 +145,7 @@ public function testPatchUpdate() {
 
     // Try to send invalid data to trigger the entity validation constraints.
     // Send a UUID that is too long.
-    $entity->set('uuid', $this->randomName(129));
+    $entity->set('uuid', $this->randomMachineName(129));
     $invalid_serialized = $serializer->serialize($entity, $this->defaultFormat);
     $response = $this->httpRequest($entity->getSystemPath(), 'PATCH', $invalid_serialized, $this->defaultMimeType);
     $this->assertResponse(422);
diff --git a/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php b/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php
index 2a72be5..465aa24 100644
--- a/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php
+++ b/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php
@@ -204,9 +204,9 @@ public function testUIFieldAlias() {
 
     // Test a random aliases for fields, they should be replaced.
     $alias_map = array(
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       // Use # to produce an invalid character for the validation.
-      'nothing' => '#' . $this->randomName(),
+      'nothing' => '#' . $this->randomMachineName(),
       'created' => 'created',
     );
 
@@ -215,7 +215,7 @@ public function testUIFieldAlias() {
     $this->assertText(t('The machine-readable name must contain only letters, numbers, dashes and underscores.'));
 
     // Change the map alias value to a valid one.
-    $alias_map['nothing'] = $this->randomName();
+    $alias_map['nothing'] = $this->randomMachineName();
 
     $edit = array('row_options[field_options][name][alias]' => $alias_map['name'], 'row_options[field_options][nothing][alias]' => $alias_map['nothing']);
     $this->drupalPostForm($row_options, $edit, t('Apply'));
diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchCommentCountToggleTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchCommentCountToggleTest.php
index 5f77bd0..12706ec 100644
--- a/core/modules/search/lib/Drupal/search/Tests/SearchCommentCountToggleTest.php
+++ b/core/modules/search/lib/Drupal/search/Tests/SearchCommentCountToggleTest.php
@@ -61,8 +61,8 @@ function setUp() {
 
     // Create a comment array
     $edit_comment = array();
-    $edit_comment['subject'] = $this->randomName();
-    $edit_comment['comment_body[0][value]'] = $this->randomName();
+    $edit_comment['subject'] = $this->randomMachineName();
+    $edit_comment['comment_body[0][value]'] = $this->randomMachineName();
 
     // Post comment to the test node with comment
     $this->drupalPostForm('comment/reply/node/' . $this->searchable_nodes['1 comment']->id() . '/comment', $edit_comment, t('Save'));
diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchConfigSettingsFormTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchConfigSettingsFormTest.php
index 97030a6..77a6847 100644
--- a/core/modules/search/lib/Drupal/search/Tests/SearchConfigSettingsFormTest.php
+++ b/core/modules/search/lib/Drupal/search/Tests/SearchConfigSettingsFormTest.php
@@ -87,7 +87,7 @@ function testSearchSettingsPage() {
 
     // Test that the form does not save with an invalid word length.
     $edit = array(
-      'minimum_word_size' => $this->randomName(3),
+      'minimum_word_size' => $this->randomMachineName(3),
     );
     $this->drupalPostForm('admin/config/search/settings', $edit, t('Save configuration'));
     $this->assertNoText(t('The configuration options have been saved.'), 'Form does not save with an invalid word length.');
@@ -228,8 +228,8 @@ public function testMultipleSearchPages() {
 
     $first = array();
     $first['label'] = $this->randomString();
-    $first_id = $first['id'] = strtolower($this->randomName(8));
-    $first['path'] = strtolower($this->randomName(8));
+    $first_id = $first['id'] = strtolower($this->randomMachineName(8));
+    $first['path'] = strtolower($this->randomMachineName(8));
     $this->drupalPostForm(NULL, $first, t('Add search page'));
     $this->assertDefaultSearch($first_id, 'The default page matches the only search page.');
     $this->assertRaw(t('The %label search page has been added.', array('%label' => $first['label'])));
@@ -240,7 +240,7 @@ public function testMultipleSearchPages() {
     $this->drupalPostForm(NULL, $edit, t('Add new page'));
     $edit = array();
     $edit['label'] = $this->randomString();
-    $edit['id'] = strtolower($this->randomName(8));
+    $edit['id'] = strtolower($this->randomMachineName(8));
     $edit['path'] = $first['path'];
     $this->drupalPostForm(NULL, $edit, t('Add search page'));
     $this->assertText(t('The search page path must be unique.'));
@@ -248,8 +248,8 @@ public function testMultipleSearchPages() {
     // Add a second search page.
     $second = array();
     $second['label'] = $this->randomString();
-    $second_id = $second['id'] = strtolower($this->randomName(8));
-    $second['path'] = strtolower($this->randomName(8));
+    $second_id = $second['id'] = strtolower($this->randomMachineName(8));
+    $second['path'] = strtolower($this->randomMachineName(8));
     $this->drupalPostForm(NULL, $second, t('Add search page'));
     $this->assertDefaultSearch($first_id, 'The default page matches the only search page.');
 
diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchKeywordsConditionsTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchKeywordsConditionsTest.php
index bbb2e4d..4374fc4 100644
--- a/core/modules/search/lib/Drupal/search/Tests/SearchKeywordsConditionsTest.php
+++ b/core/modules/search/lib/Drupal/search/Tests/SearchKeywordsConditionsTest.php
@@ -48,19 +48,19 @@ function testSearchKeyswordsConditions() {
     $this->drupalGet('search/dummy_path');
     $this->assertNoText('Dummy search snippet to display');
     // With keys - get results.
-    $keys = 'bike shed ' . $this->randomName();
+    $keys = 'bike shed ' . $this->randomMachineName();
     $this->drupalGet("search/dummy_path/{$keys}");
     $this->assertText("Dummy search snippet to display. Keywords: {$keys}");
-    $keys = 'blue drop ' . $this->randomName();
+    $keys = 'blue drop ' . $this->randomMachineName();
     $this->drupalGet("search/dummy_path", array('query' => array('keys' => $keys)));
     $this->assertText("Dummy search snippet to display. Keywords: {$keys}");
     // Add some conditions and keys.
-    $keys = 'moving drop ' . $this->randomName();
+    $keys = 'moving drop ' . $this->randomMachineName();
     $this->drupalGet("search/dummy_path/bike", array('query' => array('search_conditions' => $keys)));
     $this->assertText("Dummy search snippet to display.");
     $this->assertRaw(print_r(array('search_conditions' => $keys), TRUE));
     // Add some conditions and no keys.
-    $keys = 'drop kick ' . $this->randomName();
+    $keys = 'drop kick ' . $this->randomMachineName();
     $this->drupalGet("search/dummy_path", array('query' => array('search_conditions' => $keys)));
     $this->assertText("Dummy search snippet to display.");
     $this->assertRaw(print_r(array('search_conditions' => $keys), TRUE));
diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchLanguageTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchLanguageTest.php
index 8dcec89..876daf9 100644
--- a/core/modules/search/lib/Drupal/search/Tests/SearchLanguageTest.php
+++ b/core/modules/search/lib/Drupal/search/Tests/SearchLanguageTest.php
@@ -57,19 +57,19 @@ function setUp() {
       array(
         'title' => 'First node en',
         'type' => 'page',
-        'body' => array(array('value' => $this->randomName(32), 'format' => $default_format)),
+        'body' => array(array('value' => $this->randomMachineName(32), 'format' => $default_format)),
         'langcode' => 'en',
       ),
       array(
         'title' => 'Second node this is the Spanish title',
         'type' => 'page',
-        'body' => array(array('value' => $this->randomName(32), 'format' => $default_format)),
+        'body' => array(array('value' => $this->randomMachineName(32), 'format' => $default_format)),
         'langcode' => 'es',
       ),
       array(
         'title' => 'Third node en',
         'type' => 'page',
-        'body' => array(array('value' => $this->randomName(32), 'format' => $default_format)),
+        'body' => array(array('value' => $this->randomMachineName(32), 'format' => $default_format)),
         'langcode' => 'en',
       ),
     );
@@ -80,12 +80,12 @@ function setUp() {
 
     // Add English translation to the second node.
     $translation = $this->searchable_nodes[1]->addTranslation('en', array('title' => 'Second node en'));
-    $translation->body->value = $this->randomName(32);
+    $translation->body->value = $this->randomMachineName(32);
     $this->searchable_nodes[1]->save();
 
     // Add Spanish translation to the third node.
     $translation = $this->searchable_nodes[2]->addTranslation('es', array('title' => 'Third node es'));
-    $translation->body->value = $this->randomName(32);
+    $translation->body->value = $this->randomMachineName(32);
     $this->searchable_nodes[2]->save();
 
     // Update the index and then run the shutdown method.
diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchMultilingualEntityTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchMultilingualEntityTest.php
index 7a54b58..3cfca8b 100644
--- a/core/modules/search/lib/Drupal/search/Tests/SearchMultilingualEntityTest.php
+++ b/core/modules/search/lib/Drupal/search/Tests/SearchMultilingualEntityTest.php
@@ -68,19 +68,19 @@ function setUp() {
       array(
         'title' => 'First node en',
         'type' => 'page',
-        'body' => array(array('value' => $this->randomName(32), 'format' => $default_format)),
+        'body' => array(array('value' => $this->randomMachineName(32), 'format' => $default_format)),
         'langcode' => 'en',
       ),
       array(
         'title' => 'Second node this is the English title',
         'type' => 'page',
-        'body' => array(array('value' => $this->randomName(32), 'format' => $default_format)),
+        'body' => array(array('value' => $this->randomMachineName(32), 'format' => $default_format)),
         'langcode' => 'en',
       ),
       array(
         'title' => 'Third node en',
         'type' => 'page',
-        'body' => array(array('value' => $this->randomName(32), 'format' => $default_format)),
+        'body' => array(array('value' => $this->randomMachineName(32), 'format' => $default_format)),
         'langcode' => 'en',
       ),
     );
@@ -91,14 +91,14 @@ function setUp() {
 
     // Add a single translation to the second node.
     $translation = $this->searchable_nodes[1]->addTranslation('hu', array('title' => 'Second node hu'));
-    $translation->body->value = $this->randomName(32);
+    $translation->body->value = $this->randomMachineName(32);
     $this->searchable_nodes[1]->save();
 
     // Add two translations to the third node.
     $translation = $this->searchable_nodes[2]->addTranslation('hu', array('title' => 'Third node this is the Hungarian title'));
-    $translation->body->value = $this->randomName(32);
+    $translation->body->value = $this->randomMachineName(32);
     $translation = $this->searchable_nodes[2]->addTranslation('sv', array('title' => 'Third node sv'));
-    $translation->body->value = $this->randomName(32);
+    $translation->body->value = $this->randomMachineName(32);
     $this->searchable_nodes[2]->save();
 
     // Create a user who can administer search and do searches.
diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchPageOverrideTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchPageOverrideTest.php
index b49f096..1581a0f 100644
--- a/core/modules/search/lib/Drupal/search/Tests/SearchPageOverrideTest.php
+++ b/core/modules/search/lib/Drupal/search/Tests/SearchPageOverrideTest.php
@@ -41,7 +41,7 @@ function setUp() {
   }
 
   function testSearchPageHook() {
-    $keys = 'bike shed ' . $this->randomName();
+    $keys = 'bike shed ' . $this->randomMachineName();
     $this->drupalGet("search/dummy_path/{$keys}");
     $this->assertText('Dummy search snippet', 'Dummy search snippet is shown');
     $this->assertText('Test page text is here', 'Page override is working');
diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchPageTextTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchPageTextTest.php
index 771976f..db03ad9 100644
--- a/core/modules/search/lib/Drupal/search/Tests/SearchPageTextTest.php
+++ b/core/modules/search/lib/Drupal/search/Tests/SearchPageTextTest.php
@@ -40,7 +40,7 @@ function testSearchText() {
     $this->assertTitle($title, 'Search page title is correct');
 
     $edit = array();
-    $edit['keys'] = 'bike shed ' . $this->randomName();
+    $edit['keys'] = 'bike shed ' . $this->randomMachineName();
     $this->drupalPostForm('search/node', $edit, t('Search'));
     $this->assertText(t('Consider loosening your query with OR. bike OR shed will often show more results than bike shed.'), 'Help text is displayed when search returns no results.');
     $this->assertText(t('Search'));
@@ -56,7 +56,7 @@ function testSearchText() {
 
     // Test that search keywords containing slashes are correctly loaded
     // from the path and displayed in the search form.
-    $arg = $this->randomName() . '/' . $this->randomName();
+    $arg = $this->randomMachineName() . '/' . $this->randomMachineName();
     $this->drupalGet('search/node/' . $arg);
     $input = $this->xpath("//input[@id='edit-keys' and @value='{$arg}']");
     $this->assertFalse(empty($input), 'Search keys with a / are correctly set as the default value in the search box.');
@@ -66,7 +66,7 @@ function testSearchText() {
     $limit = \Drupal::config('search.settings')->get('and_or_limit');
     $keys = array();
     for ($i = 0; $i < $limit + 1; $i++) {
-      $keys[] = $this->randomName(3);
+      $keys[] = $this->randomMachineName(3);
       if ($i % 2 == 0) {
         $keys[] = 'OR';
       }
diff --git a/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php b/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php
index 865704d..1c7a0b4 100644
--- a/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php
+++ b/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php
@@ -57,10 +57,10 @@ protected function setUp() {
 
     // Create a test entity to serialize.
     $this->values = array(
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       'user_id' => \Drupal::currentUser()->id(),
       'field_test_text' => array(
-        'value' => $this->randomName(),
+        'value' => $this->randomMachineName(),
         'format' => 'full_html',
       ),
     );
diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutLinksTest.php b/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutLinksTest.php
index 67f40ad..7658b26 100644
--- a/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutLinksTest.php
+++ b/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutLinksTest.php
@@ -36,7 +36,7 @@ public function testShortcutLinkAdd() {
     // Create an alias for the node so we can test aliases.
     $path = array(
       'source' => 'node/' . $this->node->id(),
-      'alias' => $this->randomName(8),
+      'alias' => $this->randomMachineName(8),
     );
     $this->container->get('path.alias_storage')->save($path['source'], $path['alias']);
 
@@ -53,7 +53,7 @@ public function testShortcutLinkAdd() {
 
     // Check that each new shortcut links where it should.
     foreach ($test_cases as $test) {
-      $title = $this->randomName();
+      $title = $this->randomMachineName();
       $form_data = array(
         'title[0][value]' => $title,
         'path' => $test['path'],
@@ -105,7 +105,7 @@ public function testShortcutLinkRename() {
     $set = $this->set;
 
     // Attempt to rename shortcut link.
-    $new_link_name = $this->randomName();
+    $new_link_name = $this->randomMachineName();
 
     $shortcuts = $set->getShortcuts();
     $shortcut = reset($shortcuts);
diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutSetsTest.php b/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutSetsTest.php
index 2a31535..71c9355 100644
--- a/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutSetsTest.php
+++ b/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutSetsTest.php
@@ -27,8 +27,8 @@ function testShortcutSetAdd() {
     $this->drupalGet('admin/config/user-interface/shortcut');
     $this->clickLink(t('Add shortcut set'));
     $edit = array(
-      'label' => $this->randomName(),
-      'id' => strtolower($this->randomName()),
+      'label' => $this->randomMachineName(),
+      'id' => strtolower($this->randomMachineName()),
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
     $new_set = $this->container->get('entity.manager')->getStorage('shortcut_set')->load($edit['id']);
@@ -41,7 +41,7 @@ function testShortcutSetAdd() {
    * Tests switching a user's own shortcut set.
    */
   function testShortcutSetSwitchOwn() {
-    $new_set = $this->generateShortcutSet($this->randomName());
+    $new_set = $this->generateShortcutSet($this->randomMachineName());
 
     // Attempt to switch the default shortcut set to the newly created shortcut
     // set.
@@ -55,7 +55,7 @@ function testShortcutSetSwitchOwn() {
    * Tests switching another user's shortcut set.
    */
   function testShortcutSetAssign() {
-    $new_set = $this->generateShortcutSet($this->randomName());
+    $new_set = $this->generateShortcutSet($this->randomMachineName());
 
     shortcut_set_assign_user($new_set, $this->shortcut_user);
     $current_set = shortcut_current_displayed_set($this->shortcut_user);
@@ -68,7 +68,7 @@ function testShortcutSetAssign() {
   function testShortcutSetSwitchCreate() {
     $edit = array(
       'set' => 'new',
-      'id' => strtolower($this->randomName()),
+      'id' => strtolower($this->randomMachineName()),
       'label' => $this->randomString(),
     );
     $this->drupalPostForm('user/' . $this->admin_user->id() . '/shortcuts', $edit, t('Change set'));
@@ -94,7 +94,7 @@ function testShortcutSetSwitchNoSetName() {
   function testShortcutSetRename() {
     $set = $this->set;
 
-    $new_label = $this->randomName();
+    $new_label = $this->randomMachineName();
     $this->drupalGet('admin/config/user-interface/shortcut');
     $this->clickLink(t('Edit shortcut set'));
     $this->drupalPostForm(NULL, array('label' => $new_label), t('Save'));
@@ -106,7 +106,7 @@ function testShortcutSetRename() {
    * Tests renaming a shortcut set to the same name as another set.
    */
   function testShortcutSetRenameAlreadyExists() {
-    $set = $this->generateShortcutSet($this->randomName());
+    $set = $this->generateShortcutSet($this->randomMachineName());
     $existing_label = $this->set->label();
     $this->drupalPostForm('admin/config/user-interface/shortcut/manage/' . $set->id(), array('label' => $existing_label), t('Save'));
     $this->assertRaw(t('The shortcut set %name already exists. Choose another name.', array('%name' => $existing_label)));
@@ -118,7 +118,7 @@ function testShortcutSetRenameAlreadyExists() {
    * Tests unassigning a shortcut set.
    */
   function testShortcutSetUnassign() {
-    $new_set = $this->generateShortcutSet($this->randomName());
+    $new_set = $this->generateShortcutSet($this->randomMachineName());
 
     shortcut_set_assign_user($new_set, $this->shortcut_user);
     shortcut_set_unassign_user($this->shortcut_user);
@@ -131,7 +131,7 @@ function testShortcutSetUnassign() {
    * Tests deleting a shortcut set.
    */
   function testShortcutSetDelete() {
-    $new_set = $this->generateShortcutSet($this->randomName());
+    $new_set = $this->generateShortcutSet($this->randomMachineName());
 
     $this->drupalPostForm('admin/config/user-interface/shortcut/manage/' . $new_set->id() . '/delete', array(), t('Delete'));
     $sets = entity_load_multiple('shortcut_set');
@@ -150,7 +150,7 @@ function testShortcutSetDeleteDefault() {
    * Tests creating a new shortcut set with a defined set name.
    */
   function testShortcutSetCreateWithSetName() {
-    $random_name = $this->randomName();
+    $random_name = $this->randomMachineName();
     $new_set = $this->generateShortcutSet($random_name, $random_name);
     $sets = entity_load_multiple('shortcut_set');
     $this->assertTrue(isset($sets[$random_name]), 'Successfully created a shortcut set with a defined set name.');
diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutTestBase.php b/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutTestBase.php
index de9e110..f30da9f 100644
--- a/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutTestBase.php
+++ b/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutTestBase.php
@@ -88,7 +88,7 @@ function setUp() {
    */
   function generateShortcutSet($label = '', $id = NULL) {
     $set = entity_create('shortcut_set', array(
-      'id' => isset($id) ? $id : strtolower($this->randomName()),
+      'id' => isset($id) ? $id : strtolower($this->randomMachineName()),
       'label' => empty($label) ? $this->randomString() : $label,
     ));
     $set->save();
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/InstallerTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/InstallerTestBase.php
index 899c7d8..d3535e4 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/InstallerTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/InstallerTestBase.php
@@ -75,7 +75,7 @@ protected function setUp() {
       'uid' => 1,
       'name' => 'admin',
       'mail' => 'admin@example.com',
-      'pass_raw' => $this->randomName(),
+      'pass_raw' => $this->randomMachineName(),
     ));
 
     // If any $settings are defined for this test, copy and prepare an actual
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
index 4005305..6aac70c 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
@@ -1353,7 +1353,7 @@ protected function settingsSet($name, $value) {
    *
    * Do not use this method when special characters are not possible (e.g., in
    * machine or file names that have already been validated); instead, use
-   * \Drupal\simpletest\TestBase::randomName().
+   * \Drupal\simpletest\TestBase::randomMachineName().
    *
    * @param int $length
    *   Length of random string to generate.
@@ -1414,7 +1414,7 @@ public function randomStringValidate($string) {
    *
    * @see \Drupal\Component\Utility\Random::name()
    */
-  public function randomName($length = 8) {
+  public function randomMachineName($length = 8) {
     return $this->getRandomGenerator()->name($length, TRUE);
   }
 
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/MailCaptureTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/MailCaptureTest.php
index 8cce823..c4d7198 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/MailCaptureTest.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/MailCaptureTest.php
@@ -59,7 +59,7 @@ function testMailSend() {
         'id' => 'drupal_mail_test_' . $index,
         'headers' => array('Content-type'=> 'text/html'),
         'subject' => $this->randomString(64),
-        'to' => $this->randomName(32) . '@example.com',
+        'to' => $this->randomMachineName(32) . '@example.com',
         'body' => $this->randomString(512),
       );
       drupal_mail_system('drupal_mail_test', $index)->mail($message);
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
index 5c57230..60b9e85 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
@@ -205,7 +205,7 @@ function __construct($test_id = NULL) {
    * Get a node from the database based on its title.
    *
    * @param $title
-   *   A node title, usually generated by $this->randomName().
+   *   A node title, usually generated by $this->randomMachineName().
    * @param $reset
    *   (optional) Whether to reset the entity cache.
    *
@@ -239,7 +239,7 @@ function drupalGetNodeByTitle($title, $reset = FALSE) {
    *   - body: Random string using the default filter format:
    *     @code
    *       $settings['body'][0] = array(
-   *         'value' => $this->randomName(32),
+   *         'value' => $this->randomMachineName(32),
    *         'format' => filter_default_format(),
    *       );
    *     @endcode
@@ -262,7 +262,7 @@ protected function drupalCreateNode(array $settings = array()) {
     // Populate defaults array.
     $settings += array(
       'body'      => array(array()),
-      'title'     => $this->randomName(8),
+      'title'     => $this->randomMachineName(8),
       'promote'   => NODE_NOT_PROMOTED,
       'revision'  => 1,
       'log'       => '',
@@ -291,7 +291,7 @@ protected function drupalCreateNode(array $settings = array()) {
 
     // Merge body field value and format separately.
     $settings['body'][0] += array(
-      'value' => $this->randomName(32),
+      'value' => $this->randomMachineName(32),
       'format' => filter_default_format(),
     );
 
@@ -318,7 +318,7 @@ protected function drupalCreateContentType(array $values = array()) {
     // Find a non-existent random type name.
     if (!isset($values['type'])) {
       do {
-        $id = strtolower($this->randomName(8));
+        $id = strtolower($this->randomMachineName(8));
       } while (node_type_load($id));
     }
     else {
@@ -373,9 +373,9 @@ protected function drupalPlaceBlock($plugin_id, array $settings = array()) {
     $settings += array(
       'plugin' => $plugin_id,
       'region' => 'sidebar_first',
-      'id' => strtolower($this->randomName(8)),
+      'id' => strtolower($this->randomMachineName(8)),
       'theme' => \Drupal::config('system.theme')->get('default'),
-      'label' => $this->randomName(8),
+      'label' => $this->randomMachineName(8),
       'visibility' => array(),
       'weight' => 0,
       'cache' => array(
@@ -525,7 +525,7 @@ protected function drupalCreateUser(array $permissions = array(), $name = NULL)
 
     // Create a user assigned to that role.
     $edit = array();
-    $edit['name']   = !empty($name) ? $name : $this->randomName();
+    $edit['name']   = !empty($name) ? $name : $this->randomMachineName();
     $edit['mail']   = $edit['name'] . '@example.com';
     $edit['pass']   = user_password();
     $edit['status'] = 1;
@@ -565,7 +565,7 @@ protected function drupalCreateUser(array $permissions = array(), $name = NULL)
   protected function drupalCreateRole(array $permissions, $rid = NULL, $name = NULL, $weight = NULL) {
     // Generate a random, lowercase machine name if none was passed.
     if (!isset($rid)) {
-      $rid = strtolower($this->randomName(8));
+      $rid = strtolower($this->randomMachineName(8));
     }
     // Generate a random label.
     if (!isset($name)) {
@@ -767,7 +767,7 @@ protected function setUp() {
       'uid' => 1,
       'name' => 'admin',
       'mail' => 'admin@example.com',
-      'pass_raw' => $this->randomName(),
+      'pass_raw' => $this->randomMachineName(),
     ));
 
     // Reset the static batch to remove Simpletest's batch operations.
diff --git a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php
index 3effaf5..768ae8b 100644
--- a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php
+++ b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php
@@ -50,7 +50,7 @@ function setUp() {
     $this->auth_user = $this->drupalCreateUser(array('access content', 'create page content', 'edit own page content'));
 
     // Ensure we have a node page to access.
-    $this->node = $this->drupalCreateNode(array('title' => $this->randomName(255), 'uid' => $this->auth_user->id()));
+    $this->node = $this->drupalCreateNode(array('title' => $this->randomMachineName(255), 'uid' => $this->auth_user->id()));
 
     // Enable access logging.
     \Drupal::config('statistics.settings')
diff --git a/core/modules/system/lib/Drupal/system/Tests/Action/ActionUnitTest.php b/core/modules/system/lib/Drupal/system/Tests/Action/ActionUnitTest.php
index 6f97da1..6a16375 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Action/ActionUnitTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Action/ActionUnitTest.php
@@ -69,7 +69,7 @@ public function testOperations() {
     $this->assertTrue($action instanceof ActionInterface, 'The action implements the correct interface.');
 
     // Create a new unsaved user.
-    $name = $this->randomName();
+    $name = $this->randomMachineName();
     $user_storage = $this->container->get('entity.manager')->getStorage('user');
     $account = $user_storage->create(array('name' => $name, 'bundle' => 'user'));
     $loaded_accounts = $user_storage->loadMultiple();
diff --git a/core/modules/system/lib/Drupal/system/Tests/Block/SystemMenuBlockTest.php b/core/modules/system/lib/Drupal/system/Tests/Block/SystemMenuBlockTest.php
index 943a7cc..eda899d 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Block/SystemMenuBlockTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Block/SystemMenuBlockTest.php
@@ -38,8 +38,8 @@ public static function getInfo() {
    */
   public function testSystemMenuBlockConfigDependencies() {
     // Add a new custom menu.
-    $menu_name = $this->randomName(16);
-    $label = $this->randomName(16);
+    $menu_name = $this->randomMachineName(16);
+    $label = $this->randomMachineName(16);
 
     $menu = entity_create('menu', array(
       'id' => $menu_name,
diff --git a/core/modules/system/lib/Drupal/system/Tests/Cache/ClearTest.php b/core/modules/system/lib/Drupal/system/Tests/Cache/ClearTest.php
index f8e9499..e3bde08 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Cache/ClearTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Cache/ClearTest.php
@@ -24,7 +24,7 @@ public static function getInfo() {
 
   function setUp() {
     $this->default_bin = 'render';
-    $this->default_value = $this->randomName(10);
+    $this->default_value = $this->randomMachineName(10);
 
     parent::setUp();
   }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Cache/GenericCacheBackendUnitTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Cache/GenericCacheBackendUnitTestBase.php
index e558816..2abd433 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Cache/GenericCacheBackendUnitTestBase.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Cache/GenericCacheBackendUnitTestBase.php
@@ -107,7 +107,7 @@ public function tearDownCacheBackend() {
 
   public function setUp() {
     $this->cachebackends = array();
-    $this->defaultValue = $this->randomName(10);
+    $this->defaultValue = $this->randomMachineName(10);
 
     parent::setUp();
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/AddFeedTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/AddFeedTest.php
index b871710..0000b66 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/AddFeedTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/AddFeedTest.php
@@ -25,13 +25,13 @@ public static function getInfo() {
    * Tests drupal_add_feed() with paths, URLs, and titles.
    */
   function testBasicFeedAddNoTitle() {
-    $path = $this->randomName(12);
-    $external_url = 'http://' . $this->randomName(12) . '/' . $this->randomName(12);
-    $fully_qualified_local_url = url($this->randomName(12), array('absolute' => TRUE));
+    $path = $this->randomMachineName(12);
+    $external_url = 'http://' . $this->randomMachineName(12) . '/' . $this->randomMachineName(12);
+    $fully_qualified_local_url = url($this->randomMachineName(12), array('absolute' => TRUE));
 
-    $path_for_title = $this->randomName(12);
-    $external_for_title = 'http://' . $this->randomName(12) . '/' . $this->randomName(12);
-    $fully_qualified_for_title = url($this->randomName(12), array('absolute' => TRUE));
+    $path_for_title = $this->randomMachineName(12);
+    $external_for_title = 'http://' . $this->randomMachineName(12) . '/' . $this->randomMachineName(12);
+    $fully_qualified_for_title = url($this->randomMachineName(12), array('absolute' => TRUE));
 
     // Possible permutations of drupal_add_feed() to test.
     // - 'input_url': the path passed to drupal_add_feed(),
@@ -56,17 +56,17 @@ function testBasicFeedAddNoTitle() {
       'path with title' => array(
         'input_url' => $path_for_title,
         'output_url' => url($path_for_title, array('absolute' => TRUE)),
-        'title' => $this->randomName(12),
+        'title' => $this->randomMachineName(12),
       ),
       'external URL with title' => array(
         'input_url' => $external_for_title,
         'output_url' => $external_for_title,
-        'title' => $this->randomName(12),
+        'title' => $this->randomMachineName(12),
       ),
       'local URL with title' => array(
         'input_url' => $fully_qualified_for_title,
         'output_url' => $fully_qualified_for_title,
-        'title' => $this->randomName(12),
+        'title' => $this->randomMachineName(12),
       ),
     );
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/RegionContentTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/RegionContentTest.php
index e8b8201..0a5a9c7 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/RegionContentTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/RegionContentTest.php
@@ -28,13 +28,13 @@ function testRegions() {
     global $theme_key;
 
     $block_regions = array_keys(system_region_list($theme_key));
-    $delimiter = $this->randomName(32);
+    $delimiter = $this->randomMachineName(32);
     $values = array();
     // Set some random content for each region available.
     foreach ($block_regions as $region) {
-      $first_chunk = $this->randomName(32);
+      $first_chunk = $this->randomMachineName(32);
       drupal_add_region_content($region, $first_chunk);
-      $second_chunk = $this->randomName(32);
+      $second_chunk = $this->randomMachineName(32);
       drupal_add_region_content($region, $second_chunk);
       // Store the expected result for a drupal_get_region_content call for this region.
       $values[$region] = $first_chunk . $delimiter . $second_chunk;
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php
index 28528e1..83277d0 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php
@@ -285,8 +285,8 @@ function testDrupalRenderBasics() {
    * Tests sorting by weight.
    */
   function testDrupalRenderSorting() {
-    $first = $this->randomName();
-    $second = $this->randomName();
+    $first = $this->randomMachineName();
+    $second = $this->randomMachineName();
     // Build an array with '#weight' set for each element.
     $elements = array(
       'second' => array(
@@ -397,8 +397,8 @@ function testDrupalRenderThemeArguments() {
     $this->assertEqual(drupal_render($element), 'foobar', 'Defaults work');
     $element = array(
       '#theme' => 'common_test_foo',
-      '#foo' => $this->randomName(),
-      '#bar' => $this->randomName(),
+      '#foo' => $this->randomMachineName(),
+      '#bar' => $this->randomMachineName(),
     );
     // Tests that passing arguments to the theme function works.
     $this->assertEqual(drupal_render($element), $element['#foo'] . $element['#bar'], 'Passing arguments to theme functions works');
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/RenderWebTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/RenderWebTest.php
index 8168b96..a4466a6 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/RenderWebTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/RenderWebTest.php
@@ -36,63 +36,63 @@ function testDrupalRenderFormElements() {
     // Define a series of form elements.
     $element = array(
       '#type' => 'button',
-      '#value' => $this->randomName(),
+      '#value' => $this->randomMachineName(),
     );
     $this->assertRenderedElement($element, '//input[@type=:type]', array(':type' => 'submit'));
 
     $element = array(
       '#type' => 'textfield',
-      '#title' => $this->randomName(),
-      '#value' => $this->randomName(),
+      '#title' => $this->randomMachineName(),
+      '#value' => $this->randomMachineName(),
     );
     $this->assertRenderedElement($element, '//input[@type=:type]', array(':type' => 'text'));
 
     $element = array(
       '#type' => 'password',
-      '#title' => $this->randomName(),
+      '#title' => $this->randomMachineName(),
     );
     $this->assertRenderedElement($element, '//input[@type=:type]', array(':type' => 'password'));
 
     $element = array(
       '#type' => 'textarea',
-      '#title' => $this->randomName(),
-      '#value' => $this->randomName(),
+      '#title' => $this->randomMachineName(),
+      '#value' => $this->randomMachineName(),
     );
     $this->assertRenderedElement($element, '//textarea');
 
     $element = array(
       '#type' => 'radio',
-      '#title' => $this->randomName(),
+      '#title' => $this->randomMachineName(),
       '#value' => FALSE,
     );
     $this->assertRenderedElement($element, '//input[@type=:type]', array(':type' => 'radio'));
 
     $element = array(
       '#type' => 'checkbox',
-      '#title' => $this->randomName(),
+      '#title' => $this->randomMachineName(),
     );
     $this->assertRenderedElement($element, '//input[@type=:type]', array(':type' => 'checkbox'));
 
     $element = array(
       '#type' => 'select',
-      '#title' => $this->randomName(),
+      '#title' => $this->randomMachineName(),
       '#options' => array(
-        0 => $this->randomName(),
-        1 => $this->randomName(),
+        0 => $this->randomMachineName(),
+        1 => $this->randomMachineName(),
       ),
     );
     $this->assertRenderedElement($element, '//select');
 
     $element = array(
       '#type' => 'file',
-      '#title' => $this->randomName(),
+      '#title' => $this->randomMachineName(),
     );
     $this->assertRenderedElement($element, '//input[@type=:type]', array(':type' => 'file'));
 
     $element = array(
       '#type' => 'item',
-      '#title' => $this->randomName(),
-      '#markup' => $this->randomName(),
+      '#title' => $this->randomMachineName(),
+      '#markup' => $this->randomMachineName(),
     );
     $this->assertRenderedElement($element, '//div[contains(@class, :class) and contains(., :markup)]/label[contains(., :label)]', array(
       ':class' => 'form-type-item',
@@ -102,15 +102,15 @@ function testDrupalRenderFormElements() {
 
     $element = array(
       '#type' => 'hidden',
-      '#title' => $this->randomName(),
-      '#value' => $this->randomName(),
+      '#title' => $this->randomMachineName(),
+      '#value' => $this->randomMachineName(),
     );
     $this->assertRenderedElement($element, '//input[@type=:type]', array(':type' => 'hidden'));
 
     $element = array(
       '#type' => 'link',
-      '#title' => $this->randomName(),
-      '#href' => $this->randomName(),
+      '#title' => $this->randomMachineName(),
+      '#href' => $this->randomMachineName(),
       '#options' => array(
         'absolute' => TRUE,
       ),
@@ -123,7 +123,7 @@ function testDrupalRenderFormElements() {
     $element = array(
       '#type' => 'details',
       '#open' => TRUE,
-      '#title' => $this->randomName(),
+      '#title' => $this->randomMachineName(),
     );
     $this->assertRenderedElement($element, '//details/summary[contains(., :title)]', array(
       ':title' => $element['#title'],
@@ -132,14 +132,14 @@ function testDrupalRenderFormElements() {
     $element = array(
       '#type' => 'details',
       '#open' => TRUE,
-      '#title' => $this->randomName(),
+      '#title' => $this->randomMachineName(),
     );
     $this->assertRenderedElement($element, '//details');
 
     $element['item'] = array(
       '#type' => 'item',
-      '#title' => $this->randomName(),
-      '#markup' => $this->randomName(),
+      '#title' => $this->randomMachineName(),
+      '#markup' => $this->randomMachineName(),
     );
     $this->assertRenderedElement($element, '//details/div/div[contains(@class, :class) and contains(., :markup)]', array(
       ':class' => 'form-type-item',
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/UrlTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/UrlTest.php
index 3487fd4..8fadfd8 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/UrlTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/UrlTest.php
@@ -35,7 +35,7 @@ public static function getInfo() {
    */
   function testLinkXSS() {
     // Test l().
-    $text = $this->randomName();
+    $text = $this->randomMachineName();
     $path = "<SCRIPT>alert('XSS')</SCRIPT>";
     $link = l($text, $path);
     $sanitized_path = check_url(url($path));
@@ -44,7 +44,7 @@ function testLinkXSS() {
     // Test #type 'link'.
     $link_array =  array(
       '#type' => 'link',
-      '#title' => $this->randomName(),
+      '#title' => $this->randomMachineName(),
       '#href' => $path,
     );
     $type_link = drupal_render($link_array);
@@ -116,15 +116,15 @@ function testLinkAttributes() {
 
     // Test adding a custom class in links produced by l() and #type 'link'.
     // Test l().
-    $class_l = $this->randomName();
-    $link_l = l($this->randomName(), current_path(), array('attributes' => array('class' => array($class_l))));
+    $class_l = $this->randomMachineName();
+    $link_l = l($this->randomMachineName(), current_path(), array('attributes' => array('class' => array($class_l))));
     $this->assertTrue($this->hasAttribute('class', $link_l, $class_l), format_string('Custom class @class is present on link when requested by l()', array('@class' => $class_l)));
 
     // Test #type.
-    $class_theme = $this->randomName();
+    $class_theme = $this->randomMachineName();
     $type_link = array(
       '#type' => 'link',
-      '#title' => $this->randomName(),
+      '#title' => $this->randomMachineName(),
       '#href' => current_path(),
       '#options' => array(
         'attributes' => array(
@@ -269,7 +269,7 @@ function testExternalUrls() {
 
     // Verify fragment can be overidden in an external URL.
     $url = $test_url . '#drupal';
-    $fragment = $this->randomName(10);
+    $fragment = $this->randomMachineName(10);
     $result = url($url, array('fragment' => $fragment));
     $this->assertEqual($test_url . '#' . $fragment, $result, 'External URL fragment is overidden with a custom fragment in $options.');
 
@@ -280,13 +280,13 @@ function testExternalUrls() {
 
     // Verify external URL can be extended with a query string.
     $url = $test_url;
-    $query = array($this->randomName(5) => $this->randomName(5));
+    $query = array($this->randomMachineName(5) => $this->randomMachineName(5));
     $result = url($url, array('query' => $query));
     $this->assertEqual($url . '?' . http_build_query($query, '', '&'), $result, 'External URL can be extended with a query string in $options.');
 
     // Verify query string can be extended in an external URL.
     $url = $test_url . '?drupal=awesome';
-    $query = array($this->randomName(5) => $this->randomName(5));
+    $query = array($this->randomMachineName(5) => $this->randomMachineName(5));
     $result = url($url, array('query' => $query));
     $this->assertEqual($url . '&' . http_build_query($query, '', '&'), $result, 'External URL query string can be extended with a custom query string in $options.');
   }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/WriteRecordTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/WriteRecordTest.php
index ffe5fdb..5f67527 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/WriteRecordTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/WriteRecordTest.php
@@ -138,7 +138,7 @@ function testDrupalWriteRecord() {
     $node_access = new \stdClass();
     $node_access->nid = mt_rand();
     $node_access->gid = mt_rand();
-    $node_access->realm = $this->randomName();
+    $node_access->realm = $this->randomMachineName();
     $insert_result = drupal_write_record('node_access', $node_access);
     $this->assertTrue($insert_result == SAVED_NEW, 'Correct value returned when a record is inserted with drupal_write_record() for a table with a multi-field primary key.');
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/Condition/ConditionFormTest.php b/core/modules/system/lib/Drupal/system/Tests/Condition/ConditionFormTest.php
index 2ad0d06..a0ec69c 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Condition/ConditionFormTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Condition/ConditionFormTest.php
@@ -34,7 +34,7 @@ public static function getInfo() {
   function testConfigForm() {
     $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Page'));
     $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
-    $article = entity_create('node', array('type' => 'article', 'title' => $this->randomName()));
+    $article = entity_create('node', array('type' => 'article', 'title' => $this->randomMachineName()));
     $article->save();
     $this->drupalGet('condition_test');
     $this->assertField('bundles[article]', 'There is an article bundle selector.');
diff --git a/core/modules/system/lib/Drupal/system/Tests/Database/ConnectionTest.php b/core/modules/system/lib/Drupal/system/Tests/Database/ConnectionTest.php
index c20d83d..03acb17 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Database/ConnectionTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Database/ConnectionTest.php
@@ -46,7 +46,7 @@ function testConnectionRouting() {
     $this->assertIdentical($db2, $db2b, 'A second call to getConnection() returns the same object.');
 
     // Try to open an unknown target.
-    $unknown_target = $this->randomName();
+    $unknown_target = $this->randomMachineName();
     $db3 = Database::getConnection($unknown_target, 'default');
     $this->assertNotNull($db3, 'Opening an unknown target returns a real connection object.');
     $this->assertIdentical($db1, $db3, 'An unknown target opens the default connection.');
diff --git a/core/modules/system/lib/Drupal/system/Tests/Database/SelectComplexTest.php b/core/modules/system/lib/Drupal/system/Tests/Database/SelectComplexTest.php
index 7e7d24d..6c3c6b8 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Database/SelectComplexTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Database/SelectComplexTest.php
@@ -333,8 +333,8 @@ function testJoinSubquery() {
     $this->enableModules(array('field', 'user'));
 
     $account = entity_create('user', array(
-      'name' => $this->randomName(),
-      'mail' => $this->randomName() . '@example.com',
+      'name' => $this->randomMachineName(),
+      'mail' => $this->randomMachineName() . '@example.com',
     ));
 
     $query = db_select('test_task', 'tt', array('target' => 'slave'));
diff --git a/core/modules/system/lib/Drupal/system/Tests/Database/SelectTest.php b/core/modules/system/lib/Drupal/system/Tests/Database/SelectTest.php
index 7b90e07..10dac6e 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Database/SelectTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Database/SelectTest.php
@@ -327,7 +327,7 @@ function testRandomOrder() {
     // after shuffling it (in other words, nearly impossible).
     $number_of_items = 52;
     while (db_query("SELECT MAX(id) FROM {test}")->fetchField() < $number_of_items) {
-      db_insert('test')->fields(array('name' => $this->randomName()))->execute();
+      db_insert('test')->fields(array('name' => $this->randomMachineName()))->execute();
     }
 
     // First select the items in order and make sure we get an ordered list.
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/ConfigEntityQueryTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/ConfigEntityQueryTest.php
index d0d8b36..25663cc 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/ConfigEntityQueryTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/ConfigEntityQueryTest.php
@@ -66,7 +66,7 @@ protected function setUp() {
     // The tests match array.level1.level2.
     $array['level1']['level2'] = 1;
     $entity = entity_create('config_query_test', array(
-      'label' => $this->randomName(),
+      'label' => $this->randomMachineName(),
       'id' => '1',
       'number' => 31,
       'array' => $array,
@@ -77,7 +77,7 @@ protected function setUp() {
 
     $array['level1']['level2'] = 2;
     $entity = entity_create('config_query_test', array(
-      'label' => $this->randomName(),
+      'label' => $this->randomMachineName(),
       'id' => '2',
       'number' => 41,
       'array' => $array,
@@ -88,7 +88,7 @@ protected function setUp() {
 
     $array['level1']['level2'] = 1;
     $entity = entity_create('config_query_test', array(
-      'label' => 'test_prefix_' . $this->randomName(),
+      'label' => 'test_prefix_' . $this->randomMachineName(),
       'id' => '3',
       'number' => 59,
       'array' => $array,
@@ -99,7 +99,7 @@ protected function setUp() {
 
     $array['level1']['level2'] = 2;
     $entity = entity_create('config_query_test', array(
-      'label' => $this->randomName() . '_test_suffix',
+      'label' => $this->randomMachineName() . '_test_suffix',
       'id' => '4',
       'number' => 26,
       'array' => $array,
@@ -110,7 +110,7 @@ protected function setUp() {
 
     $array['level1']['level2'] = 3;
     $entity = entity_create('config_query_test', array(
-      'label' => $this->randomName() . '_TEST_contains_' . $this->randomName(),
+      'label' => $this->randomMachineName() . '_TEST_contains_' . $this->randomMachineName(),
       'id' => '5',
       'number' => 53,
       'array' => $array,
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCacheTagsTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCacheTagsTestBase.php
index e4a6a52..c047756 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCacheTagsTestBase.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCacheTagsTestBase.php
@@ -66,7 +66,7 @@ public function setUp() {
     if ($this->entity->getEntityType()->isFieldable()) {
       // Add field, so we can modify the Field and FieldInstance entities to
       // verify that changes to those indeed clear cache tags.
-      $field_name = drupal_strtolower($this->randomName());
+      $field_name = drupal_strtolower($this->randomMachineName());
       entity_create('field_config', array(
         'name' => 'configurable_field',
         'entity_type' => $this->entity->getEntityTypeId(),
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php
index 4a05431..fe59283 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php
@@ -66,9 +66,9 @@ public function setUp() {
    * @return \Drupal\Core\Entity\EntityInterface
    */
   protected function createTestEntity($entity_type) {
-    $this->entity_name = $this->randomName();
+    $this->entity_name = $this->randomMachineName();
     $this->entity_user = $this->createUser();
-    $this->entity_field_text = $this->randomName();
+    $this->entity_field_text = $this->randomMachineName();
 
     // Pass in the value of the name field when creating. With the user
     // field we test setting a field after creation.
@@ -110,12 +110,12 @@ protected function assertReadWrite($entity_type) {
     $this->assertEqual($entity->name->getValue(), array(0 => array('value' => $this->entity_name)), format_string('%entity_type: Plain field value returned.', array('%entity_type' => $entity_type)));
 
     // Change the name.
-    $new_name = $this->randomName();
+    $new_name = $this->randomMachineName();
     $entity->name->value = $new_name;
     $this->assertEqual($new_name, $entity->name->value, format_string('%entity_type: Name can be updated and read.', array('%entity_type' => $entity_type)));
     $this->assertEqual($entity->name->getValue(), array(0 => array('value' => $new_name)), format_string('%entity_type: Plain field value reflects the update.', array('%entity_type' => $entity_type)));
 
-    $new_name = $this->randomName();
+    $new_name = $this->randomMachineName();
     $entity->name[0]->value = $new_name;
     $this->assertEqual($new_name, $entity->name->value, format_string('%entity_type: Name can be updated and read through list access.', array('%entity_type' => $entity_type)));
 
@@ -205,16 +205,16 @@ protected function assertReadWrite($entity_type) {
 
     // Access the text field and test updating.
     $this->assertEqual($entity->field_test_text->value, $this->entity_field_text, format_string('%entity_type: Text field can be read.', array('%entity_type' => $entity_type)));
-    $new_text = $this->randomName();
+    $new_text = $this->randomMachineName();
     $entity->field_test_text->value = $new_text;
     $this->assertEqual($entity->field_test_text->value, $new_text, format_string('%entity_type: Updated text field can be read.', array('%entity_type' => $entity_type)));
 
     // Test creating the entity by passing in plain values.
-    $this->entity_name = $this->randomName();
+    $this->entity_name = $this->randomMachineName();
     $name_item[0]['value'] = $this->entity_name;
     $this->entity_user = $this->createUser();
     $user_item[0]['target_id'] = $this->entity_user->id();
-    $this->entity_field_text = $this->randomName();
+    $this->entity_field_text = $this->randomMachineName();
     $text_item[0]['value'] = $this->entity_field_text;
 
     $entity = entity_create($entity_type, array(
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFormTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFormTest.php
index 66940a7..12d8b9a 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFormTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFormTest.php
@@ -63,13 +63,13 @@ function testEntityFormDisplayAlter() {
    *   The entity type to run the tests with.
    */
   protected function assertFormCRUD($entity_type) {
-    $name1 = $this->randomName(8);
-    $name2 = $this->randomName(10);
+    $name1 = $this->randomMachineName(8);
+    $name2 = $this->randomMachineName(10);
 
     $edit = array(
       'name' => $name1,
       'user_id' => mt_rand(0, 128),
-      'field_test_text[0][value]' => $this->randomName(16),
+      'field_test_text[0][value]' => $this->randomMachineName(16),
     );
 
     $this->drupalPostForm($entity_type . '/add', $edit, t('Save'));
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityLanguageTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityLanguageTestBase.php
index bd2ceb9..54ab27b 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityLanguageTestBase.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityLanguageTestBase.php
@@ -69,10 +69,10 @@ function setUp() {
     $this->state->set('entity_test.translation', TRUE);
 
     // Create a translatable test field.
-    $this->field_name = drupal_strtolower($this->randomName() . '_field_name');
+    $this->field_name = drupal_strtolower($this->randomMachineName() . '_field_name');
 
     // Create an untranslatable test field.
-    $this->untranslatable_field_name = drupal_strtolower($this->randomName() . '_field_name');
+    $this->untranslatable_field_name = drupal_strtolower($this->randomMachineName() . '_field_name');
 
     // Create field instances in all entity variations.
     foreach (entity_test_entity_types() as $entity_type) {
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php
index e5d8cf4..e12b7c1 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php
@@ -75,11 +75,11 @@ public function setUp() {
     // We want a taxonomy term reference field. It needs a vocabulary, terms,
     // a field and an instance. First, create the vocabulary.
     $vocabulary = entity_create('taxonomy_vocabulary', array(
-      'vid' => drupal_strtolower($this->randomName()),
+      'vid' => drupal_strtolower($this->randomMachineName()),
     ));
     $vocabulary->save();
     // Second, create the field.
-    $this->fieldName = strtolower($this->randomName());
+    $this->fieldName = strtolower($this->randomMachineName());
     $field = array(
       'name' => $this->fieldName,
       'entity_type' => 'entity_test',
@@ -97,7 +97,7 @@ public function setUp() {
     // Create two terms and also two accounts.
     for ($i = 0; $i <= 1; $i++) {
       $term = entity_create('taxonomy_term', array(
-        'name' => $this->randomName(),
+        'name' => $this->randomMachineName(),
         'vid' => $vocabulary->id(),
       ));
       $term->save();
@@ -109,7 +109,7 @@ public function setUp() {
     // 1st account and 1st term.
     for ($i = 0; $i <= 2; $i++) {
       $entity = entity_create('entity_test', array('type' => 'test_bundle'));
-      $entity->name->value = $this->randomName();
+      $entity->name->value = $this->randomMachineName();
       $index = $i ? 1 : 0;
       $entity->user_id->target_id = $this->accounts[$index]->id();
       $entity->{$this->fieldName}->target_id = $this->terms[$index]->id();
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php
index 07ee0e9..8cb67ed 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php
@@ -60,8 +60,8 @@ function setUp() {
     $this->installSchema('entity_test', array('entity_test_mulrev', 'entity_test_mulrev_revision', 'entity_test_mulrev_property_data', 'entity_test_mulrev_property_revision'));
     $this->installConfig(array('language'));
 
-    $figures = drupal_strtolower($this->randomName());
-    $greetings = drupal_strtolower($this->randomName());
+    $figures = drupal_strtolower($this->randomMachineName());
+    $greetings = drupal_strtolower($this->randomMachineName());
     foreach (array($figures => 'shape', $greetings => 'text') as $field_name => $field_type) {
       $field = entity_create('field_config', array(
         'name' => $field_name,
@@ -78,7 +78,7 @@ function setUp() {
       // For the sake of tablesort, make sure the second bundle is higher than
       // the first one. Beware: MySQL is not case sensitive.
       do {
-        $bundle = $this->randomName();
+        $bundle = $this->randomMachineName();
       } while ($bundles && strtolower($bundles[0]) >= strtolower($bundle));
       entity_test_create_bundle($bundle);
       foreach ($fields as $field) {
@@ -132,12 +132,12 @@ function setUp() {
     for ($i = 1; $i <= 15; $i++) {
       $entity = entity_create('entity_test_mulrev', array(
         'type' => $bundles[$i & 1],
-        'name' => $this->randomName(),
+        'name' => $this->randomMachineName(),
         'langcode' => 'en',
       ));
       // Make sure the name is set for every language that we might create.
       foreach (array('tr', 'pl') as $langcode) {
-        $entity->getTranslation($langcode)->name = $this->randomName();
+        $entity->getTranslation($langcode)->name = $this->randomMachineName();
       }
       foreach (array_reverse(str_split(decbin($i))) as $key => $bit) {
         if ($bit) {
@@ -438,7 +438,7 @@ protected function testCount() {
       'translatable' => TRUE,
     ));
     $field->save();
-    $bundle = $this->randomName();
+    $bundle = $this->randomMachineName();
     entity_create('field_instance_config', array(
       'field_name' => $field_name,
       'entity_type' => 'entity_test',
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityRevisionsTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityRevisionsTest.php
index b64ec89..7476cbd 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityRevisionsTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityRevisionsTest.php
@@ -79,8 +79,8 @@ protected function assertRevisions($entity_type) {
 
       $entity = entity_load($entity_type, $entity->id->value);
       $entity->setNewRevision(TRUE);
-      $names[] = $entity->name->value = $this->randomName(32);
-      $texts[] = $entity->field_test_text->value = $this->randomName(32);
+      $names[] = $entity->name->value = $this->randomMachineName(32);
+      $texts[] = $entity->field_test_text->value = $this->randomMachineName(32);
       $entity->save();
       $revision_ids[] = $entity->revision_id->value;
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationFormTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationFormTest.php
index 46b81bf..3a2364d 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationFormTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationFormTest.php
@@ -60,8 +60,8 @@ function testEntityFormLanguage() {
 
     // Create a node with language Language::LANGCODE_NOT_SPECIFIED.
     $edit = array();
-    $edit['title[0][value]'] = $this->randomName(8);
-    $edit['body[0][value]'] = $this->randomName(16);
+    $edit['title[0][value]'] = $this->randomMachineName(8);
+    $edit['body[0][value]'] = $this->randomMachineName(16);
 
     $this->drupalGet('node/add/page');
     $form_langcode = \Drupal::state()->get('entity_test.form_langcode') ?: FALSE;
@@ -91,8 +91,8 @@ function testEntityFormLanguage() {
     // Create a node with language.
     $edit = array();
     $langcode = $this->langcodes[0];
-    $edit['title[0][value]'] = $this->randomName(8);
-    $edit['body[0][value]'] = $this->randomName(16);
+    $edit['title[0][value]'] = $this->randomMachineName(8);
+    $edit['body[0][value]'] = $this->randomMachineName(16);
     $edit['langcode'] = $langcode;
     $this->drupalPostForm('node/add/page', $edit, t('Save'));
     $this->assertRaw(t('Basic page %title has been created.', array('%title' => $edit['title[0][value]'])), 'Basic page created.');
@@ -110,7 +110,7 @@ function testEntityFormLanguage() {
 
     // Create a body translation and check the form language.
     $langcode2 = $this->langcodes[1];
-    $node->getTranslation($langcode2)->body->value = $this->randomName(16);
+    $node->getTranslation($langcode2)->body->value = $this->randomMachineName(16);
     $node->save();
     $this->drupalGet($langcode2 . '/node/' . $node->id() . '/edit');
     $form_langcode = \Drupal::state()->get('entity_test.form_langcode') ?: FALSE;
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php
index 58ad4c3..08b394b 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php
@@ -143,7 +143,7 @@ public function testMultilingualProperties() {
    *   The entity type to run the tests with.
    */
   protected function _testMultilingualProperties($entity_type) {
-    $name = $this->randomName();
+    $name = $this->randomMachineName();
     $uid = mt_rand(0, 127);
     $langcode = $this->langcodes[0];
 
@@ -195,7 +195,7 @@ protected function _testMultilingualProperties($entity_type) {
     foreach ($this->langcodes as $langcode) {
       if ($langcode != $default_langcode) {
         $properties[$langcode] = array(
-          'name' => array(0 => $this->randomName()),
+          'name' => array(0 => $this->randomMachineName()),
           'user_id' => array(0 => mt_rand(128, 256)),
         );
       }
@@ -296,7 +296,7 @@ function testEntityTranslationAPI() {
     $langcode = $this->langcodes[1];
     $entity = $this->entityManager
       ->getStorage('entity_test_mul')
-      ->create(array('name' => $this->randomName()));
+      ->create(array('name' => $this->randomMachineName()));
 
     $entity->save();
     $hooks = $this->getHooksInfo();
@@ -314,9 +314,9 @@ function testEntityTranslationAPI() {
 
     // Create a translation and verify that the translation object and the
     // original object behave independently.
-    $name = $default_langcode . '_' . $this->randomName();
+    $name = $default_langcode . '_' . $this->randomMachineName();
     $entity->name->value = $name;
-    $name_translated = $langcode . '_' . $this->randomName();
+    $name_translated = $langcode . '_' . $this->randomMachineName();
     $translation = $entity->addTranslation($langcode);
     $this->assertNotIdentical($entity, $translation, 'The entity and the translation object differ from one another.');
     $this->assertTrue($entity->hasTranslation($langcode), 'The new translation exists.');
@@ -358,7 +358,7 @@ function testEntityTranslationAPI() {
     foreach (array('get', 'set', '__get', '__set', 'createDuplicate') as $method) {
       $message = format_string('The @method method raises an exception when trying to manipulate a removed translation.', array('@method' => $method));
       try {
-        $translation->{$method}('name', $this->randomName());
+        $translation->{$method}('name', $this->randomMachineName());
         $this->fail($message);
       }
       catch (\Exception $e) {
@@ -377,7 +377,7 @@ function testEntityTranslationAPI() {
 
     // Check that removing an invalid translation causes an exception to be
     // thrown.
-    foreach (array($default_langcode, Language::LANGCODE_DEFAULT, $this->randomName()) as $invalid_langcode) {
+    foreach (array($default_langcode, Language::LANGCODE_DEFAULT, $this->randomMachineName()) as $invalid_langcode) {
       $message = format_string('Removing an invalid translation (@langcode) causes an exception to be thrown.', array('@langcode' => $invalid_langcode));
       try {
         $entity->removeTranslation($invalid_langcode);
@@ -401,12 +401,12 @@ function testEntityTranslationAPI() {
     $entity = $this->reloadEntity($entity);
     $translation = $entity->getTranslation($langcode);
     $entity = unserialize(serialize($entity));
-    $entity->name->value = $this->randomName();
-    $name = $default_langcode . '_' . $this->randomName();
+    $entity->name->value = $this->randomMachineName();
+    $name = $default_langcode . '_' . $this->randomMachineName();
     $entity->getTranslation($default_langcode)->name->value = $name;
     $this->assertEqual($entity->name->value, $name, 'No stale reference for the translation object corresponding to the original language.');
     $translation2 = $entity->getTranslation($langcode);
-    $translation2->name->value .= $this->randomName();
+    $translation2->name->value .= $this->randomMachineName();
     $this->assertNotEqual($translation->name->value, $translation2->name->value, 'No stale reference for the actual translation object.');
     $this->assertEqual($entity, $translation2->getUntranslated(), 'No stale reference in the actual translation object.');
 
@@ -424,7 +424,7 @@ function testEntityTranslationAPI() {
     // Check that untranslatable field references keep working after serializing
     // and cloning the entity.
     $entity = $this->reloadEntity($entity);
-    $type = $this->randomName();
+    $type = $this->randomMachineName();
     $entity->getTranslation($langcode)->type->value = $type;
     $entity = unserialize(serialize($entity));
     $cloned = clone $entity;
@@ -453,7 +453,7 @@ function testLanguageFallback() {
 
     $values = array();
     foreach ($this->langcodes as $langcode) {
-      $values[$langcode]['name'] = $this->randomName();
+      $values[$langcode]['name'] = $this->randomMachineName();
       $values[$langcode]['user_id'] = mt_rand(0, 127);
     }
 
@@ -557,8 +557,8 @@ public function testLanguageChange() {
     // translatability.
     $values = array(
       'langcode' => $langcode,
-      $this->field_name => $this->randomName(),
-      $this->untranslatable_field_name => $this->randomName(),
+      $this->field_name => $this->randomMachineName(),
+      $this->untranslatable_field_name => $this->randomMachineName(),
     );
     $entity = $controller->create($values);
     foreach (array($this->field_name, $this->untranslatable_field_name) as $field_name) {
@@ -576,7 +576,7 @@ public function testLanguageChange() {
     // Check that entity translation does not affect the language of original
     // field values and untranslatable ones.
     $langcode = $this->langcodes[0];
-    $entity->addTranslation($this->langcodes[2], array($this->field_name => $this->randomName()));
+    $entity->addTranslation($this->langcodes[2], array($this->field_name => $this->randomMachineName()));
     $entity->langcode->value = $langcode;
     foreach (array($this->field_name, $this->untranslatable_field_name) as $field_name) {
       $this->assertEqual($entity->get($field_name)->getLangcode(), $langcode, 'Field language works as expected after translating the entity and changing language.');
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUUIDTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUUIDTest.php
index ec7134c..c50e6aa 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUUIDTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUUIDTest.php
@@ -56,7 +56,7 @@ protected function assertCRUD($entity_type) {
     $uuid_service = $this->container->get('uuid');
     $uuid = $uuid_service->generate();
     $custom_entity = entity_create($entity_type, array(
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       'uuid' => $uuid,
     ));
     $this->assertIdentical($custom_entity->uuid(), $uuid);
@@ -64,7 +64,7 @@ protected function assertCRUD($entity_type) {
     $custom_entity->save();
 
     // Verify that a new UUID is generated upon creating an entity.
-    $entity = entity_create($entity_type, array('name' => $this->randomName()));
+    $entity = entity_create($entity_type, array('name' => $this->randomMachineName()));
     $uuid = $entity->uuid();
     $this->assertTrue($uuid);
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUnitTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUnitTestBase.php
index 99fe76a..49ef951 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUnitTestBase.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUnitTestBase.php
@@ -64,8 +64,8 @@ protected function createUser($values = array(), $permissions = array()) {
     if ($permissions) {
       // Create a new role and apply permissions to it.
       $role = entity_create('user_role', array(
-        'id' => strtolower($this->randomName(8)),
-        'label' => $this->randomName(8),
+        'id' => strtolower($this->randomMachineName(8)),
+        'label' => $this->randomMachineName(8),
       ));
       $role->save();
       user_role_grant_permissions($role->id(), $permissions);
@@ -73,7 +73,7 @@ protected function createUser($values = array(), $permissions = array()) {
     }
 
     $account = entity_create('user', $values + array(
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       'status' => 1,
     ));
     $account->enforceIsNew();
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityValidationTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityValidationTest.php
index 09e1e54..aefb4a1 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityValidationTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityValidationTest.php
@@ -61,9 +61,9 @@ public function setUp() {
    *   The created test entity.
    */
   protected function createTestEntity($entity_type) {
-    $this->entity_name = $this->randomName();
+    $this->entity_name = $this->randomMachineName();
     $this->entity_user = $this->createUser();
-    $this->entity_field_text = $this->randomName();
+    $this->entity_field_text = $this->randomMachineName();
 
     // Pass in the value of the name field when creating. With the user
     // field we test setting a field after creation.
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityViewBuilderTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityViewBuilderTest.php
index 6ac4a62..d61b05a 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityViewBuilderTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityViewBuilderTest.php
@@ -169,7 +169,7 @@ public function testEntityViewBuilderCacheToggling() {
   protected function createTestEntity($entity_type) {
     $data = array(
       'bundle' => $entity_type,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
     );
     return $this->container->get('entity.manager')->getStorage($entity_type)->create($data);
   }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityViewControllerTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityViewControllerTest.php
index 102eeb7..5d009dc 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityViewControllerTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityViewControllerTest.php
@@ -40,7 +40,7 @@ function setUp() {
     parent::setUp();
     // Create some dummy entity_test entities.
     for ($i = 0; $i < 2; $i++) {
-      $random_label = $this->randomName();
+      $random_label = $this->randomMachineName();
       $data = array('bundle' => 'entity_test', 'name' => $random_label);
       $entity_test = $this->container->get('entity.manager')->getStorage('entity_test')->create($data);
       $entity_test->save();
@@ -78,7 +78,7 @@ public function testFieldItemAttributes() {
       ->save();
 
     // Create an entity and save test value in field_test_text.
-    $test_value = $this->randomName();
+    $test_value = $this->randomMachineName();
     $entity = entity_create('entity_test');
     $entity->field_test_text = $test_value;
     $entity->save();
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/FieldAccessTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/FieldAccessTest.php
index 7395dfa..3acb61d 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/FieldAccessTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/FieldAccessTest.php
@@ -57,7 +57,7 @@ protected function setUp() {
    */
   function testFieldAccess() {
     $values = array(
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       'user_id' => 1,
       'field_test_text' => array(
         'value' => 'no access value',
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/FieldSqlStorageTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/FieldSqlStorageTest.php
index 82e63b2..05e2e7a 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/FieldSqlStorageTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/FieldSqlStorageTest.php
@@ -69,7 +69,7 @@ function setUp() {
     $this->installSchema('entity_test', array('entity_test_rev', 'entity_test_rev_revision'));
     $entity_type = 'entity_test_rev';
 
-    $this->field_name = strtolower($this->randomName());
+    $this->field_name = strtolower($this->randomMachineName());
     $this->field_cardinality = 4;
     $this->field = entity_create('field_config', array(
       'name' => $this->field_name,
@@ -262,7 +262,7 @@ function testLongNames() {
     $storage = $this->container->get('entity.manager')->getStorage($entity_type);
 
     // Create two fields with instances, and generate randome values.
-    $name_base = drupal_strtolower($this->randomName(FieldConfig::NAME_MAX_LENGTH - 1));
+    $name_base = drupal_strtolower($this->randomMachineName(FieldConfig::NAME_MAX_LENGTH - 1));
     $field_names = array();
     $values = array();
     for ($i = 0; $i < 2; $i++) {
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/FieldTranslationSqlStorageTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/FieldTranslationSqlStorageTest.php
index 2e68569..8f4ae76 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/FieldTranslationSqlStorageTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/FieldTranslationSqlStorageTest.php
@@ -33,8 +33,8 @@ public function testFieldSqlStorage() {
 
     $controller = $this->entityManager->getStorage($entity_type);
     $values = array(
-      $this->field_name => $this->randomName(),
-      $this->untranslatable_field_name => $this->randomName(),
+      $this->field_name => $this->randomMachineName(),
+      $this->untranslatable_field_name => $this->randomMachineName(),
     );
     $entity = $controller->create($values);
     $entity->save();
@@ -67,7 +67,7 @@ public function testFieldSqlStorage() {
     $entity = $this->reloadEntity($entity);
     $entity->langcode->value = $this->langcodes[0];
     $translation = $entity->addTranslation($this->langcodes[1]);
-    $translated_value = $this->randomName();
+    $translated_value = $this->randomMachineName();
     $translation->get($this->field_name)->value = $translated_value;
     $translation->save();
     $this->toggleFieldTranslatability($entity_type);
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/DirectoryTest.php b/core/modules/system/lib/Drupal/system/Tests/File/DirectoryTest.php
index d17db20..c6701cb 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/DirectoryTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/File/DirectoryTest.php
@@ -27,8 +27,8 @@ function testFileCheckLocalDirectoryHandling() {
 
     // Check a new recursively created local directory for correct file system
     // permissions.
-    $parent = $this->randomName();
-    $child = $this->randomName();
+    $parent = $this->randomMachineName();
+    $child = $this->randomMachineName();
 
     // Files directory already exists.
     $this->assertTrue(is_dir($directory), t('Files directory already exists.'), 'File');
@@ -52,7 +52,7 @@ function testFileCheckLocalDirectoryHandling() {
     $this->assertDirectoryPermissions($directory, $old_mode);
 
     // Check creating a directory using an absolute path.
-    $absolute_path = drupal_realpath($directory) . DIRECTORY_SEPARATOR . $this->randomName() . DIRECTORY_SEPARATOR . $this->randomName();
+    $absolute_path = drupal_realpath($directory) . DIRECTORY_SEPARATOR . $this->randomMachineName() . DIRECTORY_SEPARATOR . $this->randomMachineName();
     $this->assertTrue(drupal_mkdir($absolute_path, 0775, TRUE), 'No error reported when creating new absolute directories.', 'File');
     $this->assertDirectoryPermissions($absolute_path, 0775);
   }
@@ -62,7 +62,7 @@ function testFileCheckLocalDirectoryHandling() {
    */
   function testFileCheckDirectoryHandling() {
     // A directory to operate on.
-    $directory = file_default_scheme() . '://' . $this->randomName() . '/' . $this->randomName();
+    $directory = file_default_scheme() . '://' . $this->randomMachineName() . '/' . $this->randomMachineName();
     $this->assertFalse(is_dir($directory), 'Directory does not exist prior to testing.');
 
     // Non-existent directory.
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/FileTestBase.php b/core/modules/system/lib/Drupal/system/Tests/File/FileTestBase.php
index 40a00e2..d939255 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/FileTestBase.php
+++ b/core/modules/system/lib/Drupal/system/Tests/File/FileTestBase.php
@@ -129,7 +129,7 @@ function assertDirectoryPermissions($directory, $expected_mode, $message = NULL)
   function createDirectory($path = NULL) {
     // A directory to operate on.
     if (!isset($path)) {
-      $path = file_default_scheme() . '://' . $this->randomName();
+      $path = file_default_scheme() . '://' . $this->randomMachineName();
     }
     $this->assertTrue(drupal_mkdir($path) && is_dir($path), 'Directory was created successfully.');
     return $path;
@@ -154,7 +154,7 @@ function createUri($filepath = NULL, $contents = NULL, $scheme = NULL) {
     if (!isset($filepath)) {
       // Prefix with non-latin characters to ensure that all file-related
       // tests work with international filenames.
-      $filepath = 'Файл для тестирования ' . $this->randomName();
+      $filepath = 'Файл для тестирования ' . $this->randomMachineName();
     }
     if (!isset($scheme)) {
       $scheme = file_default_scheme();
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/NameMungingTest.php b/core/modules/system/lib/Drupal/system/Tests/File/NameMungingTest.php
index 9c0d3d9..1d57c06 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/NameMungingTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/File/NameMungingTest.php
@@ -22,7 +22,7 @@ public static function getInfo() {
   function setUp() {
     parent::setUp();
     $this->bad_extension = 'php';
-    $this->name = $this->randomName() . '.' . $this->bad_extension . '.txt';
+    $this->name = $this->randomMachineName() . '.' . $this->bad_extension . '.txt';
   }
 
   /**
@@ -41,7 +41,7 @@ function testMunging() {
    * Tests munging with a null byte in the filename.
    */
   function testMungeNullByte() {
-    $prefix = $this->randomName();
+    $prefix = $this->randomMachineName();
     $filename = $prefix . '.' . $this->bad_extension . "\0.txt";
     $this->assertEqual(file_munge_filename($filename, ''), $prefix . '.' . $this->bad_extension . '_.txt', 'A filename with a null byte is correctly munged to remove the null byte.');
   }
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/ReadOnlyStreamWrapperTest.php b/core/modules/system/lib/Drupal/system/Tests/File/ReadOnlyStreamWrapperTest.php
index e02cd07..9374080 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/ReadOnlyStreamWrapperTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/File/ReadOnlyStreamWrapperTest.php
@@ -39,7 +39,7 @@ public static function getInfo() {
    */
   function testWriteFunctions() {
     // Generate a test file
-    $filename = $this->randomName();
+    $filename = $this->randomMachineName();
     $filepath = conf_path() . '/files/' . $filename;
     file_put_contents($filepath, $filename);
 
@@ -70,7 +70,7 @@ function testWriteFunctions() {
     // Attempt to release a shared lock
     $this->assertTrue(flock($handle, LOCK_UN | LOCK_NB), 'Able to release a shared lock using the read-only stream wrapper.');
     // Attempt to write to the file
-    $this->assertFalse(@fwrite($handle, $this->randomName()), 'Unable to write to file using the read-only stream wrapper.');
+    $this->assertFalse(@fwrite($handle, $this->randomMachineName()), 'Unable to write to file using the read-only stream wrapper.');
     // Attempt to flush output to the file
     $this->assertFalse(@fflush($handle), 'Unable to flush output to file using the read-only stream wrapper.');
     // Attempt to close the stream.  (Suppress errors, as fclose triggers fflush.)
@@ -82,7 +82,7 @@ function testWriteFunctions() {
     $this->assertTrue(file_exists($filepath), 'Unlink File was not actually deleted.');
 
     // Test the mkdir() function by attempting to create a directory.
-    $dirname = $this->randomName();
+    $dirname = $this->randomMachineName();
     $dir = conf_path() . '/files/' . $dirname;
     $readonlydir = $this->scheme . '://' . $dirname;
     $this->assertFalse(@drupal_mkdir($readonlydir, 0775, 0), 'Unable to create directory with read-only stream wrapper.');
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedCopyTest.php b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedCopyTest.php
index ee8afff..2cfeb32 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedCopyTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedCopyTest.php
@@ -29,7 +29,7 @@ function testNormal() {
     $uri = $this->createUri();
 
     // Copying to a new name.
-    $desired_filepath = 'public://' . $this->randomName();
+    $desired_filepath = 'public://' . $this->randomMachineName();
     $new_filepath = file_unmanaged_copy($uri, $desired_filepath, FILE_EXISTS_ERROR);
     $this->assertTrue($new_filepath, 'Copy was successful.');
     $this->assertEqual($new_filepath, $desired_filepath, 'Returned expected filepath.');
@@ -38,7 +38,7 @@ function testNormal() {
     $this->assertFilePermissions($new_filepath, Settings::get('file_chmod_file', FILE_CHMOD_FILE));
 
     // Copying with rename.
-    $desired_filepath = 'public://' . $this->randomName();
+    $desired_filepath = 'public://' . $this->randomMachineName();
     $this->assertTrue(file_put_contents($desired_filepath, ' '), 'Created a file so a rename will have to happen.');
     $newer_filepath = file_unmanaged_copy($uri, $desired_filepath, FILE_EXISTS_RENAME);
     $this->assertTrue($newer_filepath, 'Copy was successful.');
@@ -56,9 +56,9 @@ function testNormal() {
    */
   function testNonExistent() {
     // Copy non-existent file
-    $desired_filepath = $this->randomName();
+    $desired_filepath = $this->randomMachineName();
     $this->assertFalse(file_exists($desired_filepath), "Randomly named file doesn't exists.");
-    $new_filepath = file_unmanaged_copy($desired_filepath, $this->randomName());
+    $new_filepath = file_unmanaged_copy($desired_filepath, $this->randomMachineName());
     $this->assertFalse($new_filepath, 'Copying a missing file fails.');
   }
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteRecursiveTest.php b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteRecursiveTest.php
index 2a93ac6..bf35519 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteRecursiveTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteRecursiveTest.php
@@ -24,7 +24,7 @@ public static function getInfo() {
    */
   function testSingleFile() {
     // Create a file for testing
-    $filepath = file_default_scheme() . '://' . $this->randomName();
+    $filepath = file_default_scheme() . '://' . $this->randomMachineName();
     file_put_contents($filepath, '');
 
     // Delete the file.
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteTest.php b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteTest.php
index 005cba0..9ed79de 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteTest.php
@@ -36,7 +36,7 @@ function testNormal() {
    */
   function testMissing() {
     // Try to delete a non-existing file
-    $this->assertTrue(file_unmanaged_delete(file_default_scheme() . '/' . $this->randomName()), 'Returns true when deleting a non-existent file.');
+    $this->assertTrue(file_unmanaged_delete(file_default_scheme() . '/' . $this->randomMachineName()), 'Returns true when deleting a non-existent file.');
   }
 
   /**
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedMoveTest.php b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedMoveTest.php
index 60e6bbe..57c0940 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedMoveTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedMoveTest.php
@@ -29,7 +29,7 @@ function testNormal() {
     $uri = $this->createUri();
 
     // Moving to a new name.
-    $desired_filepath = 'public://' . $this->randomName();
+    $desired_filepath = 'public://' . $this->randomMachineName();
     $new_filepath = file_unmanaged_move($uri, $desired_filepath, FILE_EXISTS_ERROR);
     $this->assertTrue($new_filepath, 'Move was successful.');
     $this->assertEqual($new_filepath, $desired_filepath, 'Returned expected filepath.');
@@ -38,7 +38,7 @@ function testNormal() {
     $this->assertFilePermissions($new_filepath, Settings::get('file_chmod_file', FILE_CHMOD_FILE));
 
     // Moving with rename.
-    $desired_filepath = 'public://' . $this->randomName();
+    $desired_filepath = 'public://' . $this->randomMachineName();
     $this->assertTrue(file_exists($new_filepath), 'File exists before moving.');
     $this->assertTrue(file_put_contents($desired_filepath, ' '), 'Created a file so a rename will have to happen.');
     $newer_filepath = file_unmanaged_move($new_filepath, $desired_filepath, FILE_EXISTS_RENAME);
@@ -57,7 +57,7 @@ function testNormal() {
    */
   function testMissing() {
     // Move non-existent file.
-    $new_filepath = file_unmanaged_move($this->randomName(), $this->randomName());
+    $new_filepath = file_unmanaged_move($this->randomMachineName(), $this->randomMachineName());
     $this->assertFalse($new_filepath, 'Moving a missing file fails.');
   }
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedSaveDataTest.php b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedSaveDataTest.php
index 8590e52..3fefccd 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedSaveDataTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedSaveDataTest.php
@@ -23,7 +23,7 @@ public static function getInfo() {
    * Test the file_unmanaged_save_data() function.
    */
   function testFileSaveData() {
-    $contents = $this->randomName(8);
+    $contents = $this->randomMachineName(8);
     $this->settingsSet('file_chmod_file', 0777);
 
     // No filename.
diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/ElementsTableSelectTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/ElementsTableSelectTest.php
index 9ce3fb2..218fcc5 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Form/ElementsTableSelectTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Form/ElementsTableSelectTest.php
@@ -212,7 +212,7 @@ function testMultipleFalseOptionchecker() {
    *   An array containing the processed form, the form_state and any errors.
    */
   private function formSubmitHelper($form, $edit) {
-    $form_id = $this->randomName();
+    $form_id = $this->randomMachineName();
     $form_state = form_state_defaults();
 
     $form['op'] = array('#type' => 'submit', '#value' => t('Submit'));
diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/FormCacheTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/FormCacheTest.php
index db904e3..8055e10 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Form/FormCacheTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Form/FormCacheTest.php
@@ -34,12 +34,12 @@ public function setUp() {
     parent::setUp();
     $this->installSchema('system', array('key_value_expire'));
 
-    $this->form_build_id = $this->randomName();
+    $this->form_build_id = $this->randomMachineName();
     $this->form = array(
-      '#property' => $this->randomName(),
+      '#property' => $this->randomMachineName(),
     );
     $this->form_state = form_state_defaults();
-    $this->form_state['example'] = $this->randomName();
+    $this->form_state['example'] = $this->randomMachineName();
   }
 
   /**
@@ -65,7 +65,7 @@ function testCacheToken() {
     $this->assertTrue(empty($cached_form_state['example']));
 
     // Test that loading the cache with a different form_id fails.
-    $wrong_form_build_id = $this->randomName(9);
+    $wrong_form_build_id = $this->randomMachineName(9);
     $cached_form_state = form_state_defaults();
     $this->assertFalse(form_get_cache($wrong_form_build_id, $cached_form_state), 'No form returned from cache');
     $this->assertTrue(empty($cached_form_state['example']), 'Cached form state was not loaded');
@@ -77,7 +77,7 @@ function testCacheToken() {
   function testNoCacheToken() {
     $this->container->set('current_user', new UserSession(array('uid' => 0)));
 
-    $this->form_state['example'] = $this->randomName();
+    $this->form_state['example'] = $this->randomMachineName();
     form_set_cache($this->form_build_id, $this->form, $this->form_state);
 
     $cached_form_state = form_state_defaults();
diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/FormTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/FormTest.php
index b006591..090c77f 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Form/FormTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Form/FormTest.php
@@ -57,43 +57,43 @@ function testRequiredFields() {
     $empty_arrays = array('array()' => array());
     $empty_checkbox = array(NULL);
 
-    $elements['textfield']['element'] = array('#title' => $this->randomName(), '#type' => 'textfield');
+    $elements['textfield']['element'] = array('#title' => $this->randomMachineName(), '#type' => 'textfield');
     $elements['textfield']['empty_values'] = $empty_strings;
 
-    $elements['telephone']['element'] = array('#title' => $this->randomName(), '#type' => 'tel');
+    $elements['telephone']['element'] = array('#title' => $this->randomMachineName(), '#type' => 'tel');
     $elements['telephone']['empty_values'] = $empty_strings;
 
-    $elements['url']['element'] = array('#title' => $this->randomName(), '#type' => 'url');
+    $elements['url']['element'] = array('#title' => $this->randomMachineName(), '#type' => 'url');
     $elements['url']['empty_values'] = $empty_strings;
 
-    $elements['search']['element'] = array('#title' => $this->randomName(), '#type' => 'search');
+    $elements['search']['element'] = array('#title' => $this->randomMachineName(), '#type' => 'search');
     $elements['search']['empty_values'] = $empty_strings;
 
-    $elements['password']['element'] = array('#title' => $this->randomName(), '#type' => 'password');
+    $elements['password']['element'] = array('#title' => $this->randomMachineName(), '#type' => 'password');
     $elements['password']['empty_values'] = $empty_strings;
 
-    $elements['password_confirm']['element'] = array('#title' => $this->randomName(), '#type' => 'password_confirm');
+    $elements['password_confirm']['element'] = array('#title' => $this->randomMachineName(), '#type' => 'password_confirm');
     // Provide empty values for both password fields.
     foreach ($empty_strings as $key => $value) {
       $elements['password_confirm']['empty_values'][$key] = array('pass1' => $value, 'pass2' => $value);
     }
 
-    $elements['textarea']['element'] = array('#title' => $this->randomName(), '#type' => 'textarea');
+    $elements['textarea']['element'] = array('#title' => $this->randomMachineName(), '#type' => 'textarea');
     $elements['textarea']['empty_values'] = $empty_strings;
 
-    $elements['radios']['element'] = array('#title' => $this->randomName(), '#type' => 'radios', '#options' => array('' => t('None'), $this->randomName(), $this->randomName(), $this->randomName()));
+    $elements['radios']['element'] = array('#title' => $this->randomMachineName(), '#type' => 'radios', '#options' => array('' => t('None'), $this->randomMachineName(), $this->randomMachineName(), $this->randomMachineName()));
     $elements['radios']['empty_values'] = $empty_arrays;
 
-    $elements['checkbox']['element'] = array('#title' => $this->randomName(), '#type' => 'checkbox', '#required' => TRUE);
+    $elements['checkbox']['element'] = array('#title' => $this->randomMachineName(), '#type' => 'checkbox', '#required' => TRUE);
     $elements['checkbox']['empty_values'] = $empty_checkbox;
 
-    $elements['checkboxes']['element'] = array('#title' => $this->randomName(), '#type' => 'checkboxes', '#options' => array($this->randomName(), $this->randomName(), $this->randomName()));
+    $elements['checkboxes']['element'] = array('#title' => $this->randomMachineName(), '#type' => 'checkboxes', '#options' => array($this->randomMachineName(), $this->randomMachineName(), $this->randomMachineName()));
     $elements['checkboxes']['empty_values'] = $empty_arrays;
 
-    $elements['select']['element'] = array('#title' => $this->randomName(), '#type' => 'select', '#options' => array('' => t('None'), $this->randomName(), $this->randomName(), $this->randomName()));
+    $elements['select']['element'] = array('#title' => $this->randomMachineName(), '#type' => 'select', '#options' => array('' => t('None'), $this->randomMachineName(), $this->randomMachineName(), $this->randomMachineName()));
     $elements['select']['empty_values'] = $empty_strings;
 
-    $elements['file']['element'] = array('#title' => $this->randomName(), '#type' => 'file');
+    $elements['file']['element'] = array('#title' => $this->randomMachineName(), '#type' => 'file');
     $elements['file']['empty_values'] = $empty_strings;
 
     // Regular expression to find the expected marker on required elements.
@@ -103,7 +103,7 @@ function testRequiredFields() {
     foreach ($elements as $type => $data) {
       foreach ($data['empty_values'] as $key => $empty) {
         foreach (array(TRUE, FALSE) as $required) {
-          $form_id = $this->randomName();
+          $form_id = $this->randomMachineName();
           $form = array();
           $form_state = form_state_defaults();
           $form['op'] = array('#type' => 'submit', '#value' => t('Submit'));
diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/LanguageSelectElementTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/LanguageSelectElementTest.php
index 021419a..180fcc7 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Form/LanguageSelectElementTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Form/LanguageSelectElementTest.php
@@ -38,13 +38,13 @@ function testLanguageSelectElementOptions() {
     // Add some languages.
     $language = new Language(array(
       'id' => 'aaa',
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
     ));
     language_save($language);
 
     $language = new Language(array(
       'id' => 'bbb',
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
     ));
     language_save($language);
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/RedirectTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/RedirectTest.php
index faa7c7c..5bf123b 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Form/RedirectTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Form/RedirectTest.php
@@ -40,7 +40,7 @@ function testRedirect() {
     // Test basic redirection.
     $edit = array(
       'redirection' => TRUE,
-      'destination' => $this->randomName(),
+      'destination' => $this->randomMachineName(),
     );
     $this->drupalPostForm($path, $edit, t('Submit'));
     $this->assertUrl($edit['destination'], array(), 'Basic redirection works.');
@@ -56,7 +56,7 @@ function testRedirect() {
     // Test redirection with query parameters.
     $edit = array(
       'redirection' => TRUE,
-      'destination' => $this->randomName(),
+      'destination' => $this->randomMachineName(),
     );
     $this->drupalPostForm($path, $edit, t('Submit'), $options);
     $this->assertUrl($edit['destination'], array(), 'Redirection with query parameters works.');
diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/ValidationTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/ValidationTest.php
index 43f1c88..f91af92 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Form/ValidationTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Form/ValidationTest.php
@@ -182,7 +182,7 @@ function testPatternValidation() {
 
     // Invalid password.
     $edit = array(
-      'password' => $this->randomName(),
+      'password' => $this->randomMachineName(),
     );
     $this->drupalPostForm('form-test/pattern', $edit, 'Submit');
     $this->assertNoRaw($textfield_error);
diff --git a/core/modules/system/lib/Drupal/system/Tests/Installer/SiteNameTest.php b/core/modules/system/lib/Drupal/system/Tests/Installer/SiteNameTest.php
index 6b71e73..b4963d2 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Installer/SiteNameTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Installer/SiteNameTest.php
@@ -33,7 +33,7 @@ public static function getInfo() {
    * Overrides \Drupal\simpletest\WebTestBase::installParameters().
    */
   protected function installParameters() {
-    $this->siteName = $this->randomName();
+    $this->siteName = $this->randomMachineName();
     $parameters = parent::installParameters();
     $parameters['forms']['install_configure_form']['site_name'] = $this->siteName;
     return $parameters;
diff --git a/core/modules/system/lib/Drupal/system/Tests/KeyValueStore/DatabaseStorageExpirableTest.php b/core/modules/system/lib/Drupal/system/Tests/KeyValueStore/DatabaseStorageExpirableTest.php
index 5f7365d..598881d 100644
--- a/core/modules/system/lib/Drupal/system/Tests/KeyValueStore/DatabaseStorageExpirableTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/KeyValueStore/DatabaseStorageExpirableTest.php
@@ -109,7 +109,7 @@ public function testCRUDWithExpiration() {
     $this->assertIdenticalObject($this->objects[5], $stores[1]->get('foo'));
 
     // Test that setWithExpireIfNotExists() succeeds only the first time.
-    $key = $this->randomName();
+    $key = $this->randomMachineName();
     for ($i = 0; $i <= 1; $i++) {
       // setWithExpireIfNotExists() should be TRUE the first time (when $i is
       // 0) and FALSE the second time (when $i is 1).
@@ -148,12 +148,12 @@ public function testExpiration() {
     $this->assertIdentical(count($stores[0]->getMultiple(array('yesterday', 'troubles'))), 1);
 
     // Store items set to expire in the past in various ways.
-    $stores[0]->setWithExpire($this->randomName(), $this->objects[0], -7 * $day);
-    $stores[0]->setWithExpireIfNotExists($this->randomName(), $this->objects[1], -5 * $day);
+    $stores[0]->setWithExpire($this->randomMachineName(), $this->objects[0], -7 * $day);
+    $stores[0]->setWithExpireIfNotExists($this->randomMachineName(), $this->objects[1], -5 * $day);
     $stores[0]->setMultipleWithExpire(
       array(
-        $this->randomName() => $this->objects[2],
-        $this->randomName() => $this->objects[3],
+        $this->randomMachineName() => $this->objects[2],
+        $this->randomMachineName() => $this->objects[3],
       ),
       -3 * $day
     );
diff --git a/core/modules/system/lib/Drupal/system/Tests/KeyValueStore/GarbageCollectionTest.php b/core/modules/system/lib/Drupal/system/Tests/KeyValueStore/GarbageCollectionTest.php
index 2835a47..24536fa 100644
--- a/core/modules/system/lib/Drupal/system/Tests/KeyValueStore/GarbageCollectionTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/KeyValueStore/GarbageCollectionTest.php
@@ -40,7 +40,7 @@ protected function tearDown() {
    * Tests garbage collection.
    */
   public function testGarbageCollection() {
-    $collection = $this->randomName();
+    $collection = $this->randomMachineName();
     $store = new DatabaseStorageExpirable($collection, Database::getConnection());
 
     // Insert some items and confirm that they're set.
diff --git a/core/modules/system/lib/Drupal/system/Tests/KeyValueStore/StorageTestBase.php b/core/modules/system/lib/Drupal/system/Tests/KeyValueStore/StorageTestBase.php
index 4b48cfb..8af590d 100644
--- a/core/modules/system/lib/Drupal/system/Tests/KeyValueStore/StorageTestBase.php
+++ b/core/modules/system/lib/Drupal/system/Tests/KeyValueStore/StorageTestBase.php
@@ -185,7 +185,7 @@ public function testNonExistingKeys() {
   public function testSetIfNotExists() {
     $stores = $this->createStorage();
 
-    $key = $this->randomName();
+    $key = $this->randomMachineName();
     // Test that setIfNotExists() succeeds only the first time.
     for ($i = 0; $i <= 1; $i++) {
       // setIfNotExists() should be TRUE the first time (when $i is 0) and
diff --git a/core/modules/system/lib/Drupal/system/Tests/Mail/WrapMailUnitTest.php b/core/modules/system/lib/Drupal/system/Tests/Mail/WrapMailUnitTest.php
index 3dd0269..7a2697e 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Mail/WrapMailUnitTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Mail/WrapMailUnitTest.php
@@ -27,12 +27,12 @@ public static function getInfo() {
    */
   function testDrupalWrapMail() {
     $delimiter = "End of header\n";
-    $long_file_name = $this->randomName(64) . '.docx';
+    $long_file_name = $this->randomMachineName(64) . '.docx';
     $headers_in_body = 'Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document; name="' . $long_file_name . "\"\n";
     $headers_in_body .= "Content-Transfer-Encoding: base64\n";
     $headers_in_body .= 'Content-Disposition: attachment; filename="' . $long_file_name . "\"\n";
-    $headers_in_body .= 'Content-Description: ' . $this->randomName(64);
-    $body = $this->randomName(76) . ' ' . $this->randomName(6);
+    $headers_in_body .= 'Content-Description: ' . $this->randomMachineName(64);
+    $body = $this->randomMachineName(76) . ' ' . $this->randomMachineName(6);
     $wrapped_text = drupal_wrap_mail($headers_in_body . $delimiter . $body);
     list($processed_headers, $processed_body) = explode($delimiter, $wrapped_text);
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
index bda7efe..a46c8ca 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
@@ -175,7 +175,7 @@ function testBreadCrumbs() {
 
     foreach ($menus as $menu) {
       // Create a parent node in the current menu.
-      $title = $this->randomName();
+      $title = $this->randomMachineName();
       $node2 = $this->drupalCreateNode(array(
         'type' => $type,
         'title' => $title,
diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php
index 03f8ca1..de1532b 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php
@@ -78,7 +78,7 @@ public function testMenuIntegration() {
    */
   protected function doTestHookMenuIntegration() {
     // Generate base path with random argument.
-    $base_path = 'foo/' . $this->randomName(8);
+    $base_path = 'foo/' . $this->randomMachineName(8);
     $this->drupalGet($base_path);
     // Confirm correct controller activated.
     $this->assertText('test1');
diff --git a/core/modules/system/lib/Drupal/system/Tests/ParamConverter/UpcastingTest.php b/core/modules/system/lib/Drupal/system/Tests/ParamConverter/UpcastingTest.php
index 75152e0..00f6c21 100644
--- a/core/modules/system/lib/Drupal/system/Tests/ParamConverter/UpcastingTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/ParamConverter/UpcastingTest.php
@@ -38,7 +38,7 @@ public static function getInfo() {
    * happening.
    */
   public function testUpcasting() {
-    $node = $this->drupalCreateNode(array('title' => $this->randomName(8)));
+    $node = $this->drupalCreateNode(array('title' => $this->randomMachineName(8)));
     $user = $this->drupalCreateUser(array('access content'));
     $foo = 'bar';
 
@@ -61,8 +61,8 @@ public function testUpcasting() {
    * Confirms we can upcast to controller arguments of the same type.
    */
   public function testSameTypes() {
-    $node = $this->drupalCreateNode(array('title' => $this->randomName(8)));
-    $parent = $this->drupalCreateNode(array('title' => $this->randomName(8)));
+    $node = $this->drupalCreateNode(array('title' => $this->randomMachineName(8)));
+    $parent = $this->drupalCreateNode(array('title' => $this->randomMachineName(8)));
     // paramconverter_test/node/{node}/set/parent/{parent}
     // options.parameters.parent.type = entity:node
     $this->drupalGet("paramconverter_test/node/" . $node->id() . "/set/parent/" . $parent->id());
diff --git a/core/modules/system/lib/Drupal/system/Tests/Path/AliasTest.php b/core/modules/system/lib/Drupal/system/Tests/Path/AliasTest.php
index 07bf006..15c75e7 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Path/AliasTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Path/AliasTest.php
@@ -178,28 +178,28 @@ function testWhitelist() {
 
     // Non-existing path roots should be NULL too. Use a length of 7 to avoid
     // possible conflict with random aliases below.
-    $this->assertNull($whitelist->get($this->randomName()));
+    $this->assertNull($whitelist->get($this->randomMachineName()));
 
     // Add an alias for user/1, user should get whitelisted now.
-    $aliasStorage->save('user/1', $this->randomName());
+    $aliasStorage->save('user/1', $this->randomMachineName());
     $aliasManager->cacheClear();
     $this->assertTrue($whitelist->get('user'));
     $this->assertNull($whitelist->get('admin'));
-    $this->assertNull($whitelist->get($this->randomName()));
+    $this->assertNull($whitelist->get($this->randomMachineName()));
 
     // Add an alias for admin, both should get whitelisted now.
-    $aliasStorage->save('admin/something', $this->randomName());
+    $aliasStorage->save('admin/something', $this->randomMachineName());
     $aliasManager->cacheClear();
     $this->assertTrue($whitelist->get('user'));
     $this->assertTrue($whitelist->get('admin'));
-    $this->assertNull($whitelist->get($this->randomName()));
+    $this->assertNull($whitelist->get($this->randomMachineName()));
 
     // Remove the user alias again, whitelist entry should be removed.
     $aliasStorage->delete(array('source' => 'user/1'));
     $aliasManager->cacheClear();
     $this->assertNull($whitelist->get('user'));
     $this->assertTrue($whitelist->get('admin'));
-    $this->assertNull($whitelist->get($this->randomName()));
+    $this->assertNull($whitelist->get($this->randomMachineName()));
 
     // Destruct the whitelist so that the caches are written.
     $whitelist->destruct();
@@ -211,7 +211,7 @@ function testWhitelist() {
     $whitelist = new AliasWhitelist('path_alias_whitelist', $memoryCounterBackend, $this->container->get('lock'), $this->container->get('state'), $aliasStorage);
     $this->assertNull($whitelist->get('user'));
     $this->assertTrue($whitelist->get('admin'));
-    $this->assertNull($whitelist->get($this->randomName()));
+    $this->assertNull($whitelist->get($this->randomMachineName()));
     $this->assertEqual($memoryCounterBackend->getCounter('get', 'path_alias_whitelist'), 1);
     $this->assertEqual($memoryCounterBackend->getCounter('set', 'path_alias_whitelist'), 0);
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/Path/MatchPathTest.php b/core/modules/system/lib/Drupal/system/Tests/Path/MatchPathTest.php
index 4adb5cf..9d929e7 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Path/MatchPathTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Path/MatchPathTest.php
@@ -30,7 +30,7 @@ function setUp() {
     parent::setUp();
 
     // Set up a random site front page to test the '<front>' placeholder.
-    $this->front = $this->randomName();
+    $this->front = $this->randomMachineName();
     \Drupal::config('system.site')->set('page.front', $this->front)->save();
     // Refresh our static variables from the database.
     $this->refreshVariables();
diff --git a/core/modules/system/lib/Drupal/system/Tests/Path/UrlAlterFunctionalTest.php b/core/modules/system/lib/Drupal/system/Tests/Path/UrlAlterFunctionalTest.php
index 5772e0a..f76a246 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Path/UrlAlterFunctionalTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Path/UrlAlterFunctionalTest.php
@@ -69,7 +69,7 @@ function testUrlAlter() {
     $this->assertText('General discussion', 'The community path gets resolved correctly');
     $this->assertUrlOutboundAlter('forum', 'community');
     $forum_vid = \Drupal::config('forum.settings')->get('vocabulary');
-    $term_name = $this->randomName();
+    $term_name = $this->randomMachineName();
     $term = entity_create('taxonomy_term', array(
       'name' => $term_name,
       'vid' => $forum_vid,
diff --git a/core/modules/system/lib/Drupal/system/Tests/Plugin/ContextPluginTest.php b/core/modules/system/lib/Drupal/system/Tests/Plugin/ContextPluginTest.php
index 748487e..d401920 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Plugin/ContextPluginTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Plugin/ContextPluginTest.php
@@ -30,7 +30,7 @@ public static function getInfo() {
    * Tests basic context definition and value getters and setters.
    */
   function testContext() {
-    $name = $this->randomName();
+    $name = $this->randomMachineName();
     $manager = new MockBlockManager();
     $plugin = $manager->createInstance('user_name');
     // Create a node, add it as context, catch the exception.
diff --git a/core/modules/system/lib/Drupal/system/Tests/Queue/QueueTest.php b/core/modules/system/lib/Drupal/system/Tests/Queue/QueueTest.php
index 5161f56..6cb4258 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Queue/QueueTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Queue/QueueTest.php
@@ -38,9 +38,9 @@ public static function getInfo() {
   public function testSystemQueue() {
     $this->installSchema('system', 'queue');
     // Create two queues.
-    $queue1 = new DatabaseQueue($this->randomName(), Database::getConnection());
+    $queue1 = new DatabaseQueue($this->randomMachineName(), Database::getConnection());
     $queue1->createQueue();
-    $queue2 = new DatabaseQueue($this->randomName(), Database::getConnection());
+    $queue2 = new DatabaseQueue($this->randomMachineName(), Database::getConnection());
     $queue2->createQueue();
 
     $this->queueTest($queue1, $queue2);
@@ -51,9 +51,9 @@ public function testSystemQueue() {
    */
   public function testMemoryQueue() {
     // Create two queues.
-    $queue1 = new Memory($this->randomName());
+    $queue1 = new Memory($this->randomMachineName());
     $queue1->createQueue();
-    $queue2 = new Memory($this->randomName());
+    $queue2 = new Memory($this->randomMachineName());
     $queue2->createQueue();
 
     $this->queueTest($queue1, $queue2);
@@ -71,7 +71,7 @@ protected function queueTest($queue1, $queue2) {
     // Create four items.
     $data = array();
     for ($i = 0; $i < 4; $i++) {
-      $data[] = array($this->randomName() => $this->randomName());
+      $data[] = array($this->randomMachineName() => $this->randomMachineName());
     }
 
     // Queue items 1 and 2 in the queue1.
diff --git a/core/modules/system/lib/Drupal/system/Tests/Routing/RouteProviderTest.php b/core/modules/system/lib/Drupal/system/Tests/Routing/RouteProviderTest.php
index 05d1131..5f8d629 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Routing/RouteProviderTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Routing/RouteProviderTest.php
@@ -404,7 +404,7 @@ protected function testRouteByName() {
     }
     $this->assertTrue($exception_thrown, 'Random route was not found.');
 
-    $routes = $provider->getRoutesByNames(array('route_c', 'route_d', $this->randomName()));
+    $routes = $provider->getRoutesByNames(array('route_c', 'route_d', $this->randomMachineName()));
     $this->assertEqual(count($routes), 2, 'Only two valid routes found.');
     $this->assertEqual($routes['route_c']->getPath(), '/path/two');
     $this->assertEqual($routes['route_d']->getPath(), '/path/three');
diff --git a/core/modules/system/lib/Drupal/system/Tests/Routing/RouterTest.php b/core/modules/system/lib/Drupal/system/Tests/Routing/RouterTest.php
index a9e4598..89e5d1e 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Routing/RouterTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Routing/RouterTest.php
@@ -58,7 +58,7 @@ public function testDefaultController() {
    */
   public function testControllerPlaceholders() {
     // Test with 0 and a random value.
-    $values = array("0", $this->randomName());
+    $values = array("0", $this->randomMachineName());
     foreach ($values as $value) {
       $this->drupalGet('router_test/test3/' . $value);
       $this->assertResponse(200);
diff --git a/core/modules/system/lib/Drupal/system/Tests/Session/SessionHttpsTest.php b/core/modules/system/lib/Drupal/system/Tests/Session/SessionHttpsTest.php
index 02523d0..4d91968 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Session/SessionHttpsTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Session/SessionHttpsTest.php
@@ -129,7 +129,7 @@ protected function testHttpsSession() {
 
     $this->curlClose();
     // Start an anonymous session on the insecure site.
-    $session_data = $this->randomName();
+    $session_data = $this->randomMachineName();
     $this->drupalGet('session-test/set/' . $session_data);
     // Check secure cookie on insecure page.
     $this->assertFalse(isset($this->cookies[$secure_session_name]), 'The secure cookie is not sent on insecure pages.');
diff --git a/core/modules/system/lib/Drupal/system/Tests/Session/SessionTest.php b/core/modules/system/lib/Drupal/system/Tests/Session/SessionTest.php
index 634ae1d..d6595b8 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Session/SessionTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Session/SessionTest.php
@@ -86,7 +86,7 @@ function testDataPersistence() {
 
     $this->drupalLogin($user);
 
-    $value_1 = $this->randomName();
+    $value_1 = $this->randomMachineName();
     $this->drupalGet('session-test/set/' . $value_1);
     $this->assertText($value_1, 'The session value was stored.', 'Session');
     $this->drupalGet('session-test/get');
@@ -94,7 +94,7 @@ function testDataPersistence() {
 
     // Attempt to write over val_1. If drupal_save_session(FALSE) is working.
     // properly, val_1 will still be set.
-    $value_2 = $this->randomName();
+    $value_2 = $this->randomMachineName();
     $this->drupalGet('session-test/no-set/' . $value_2);
     $this->assertText($value_2, 'The session value was correctly passed to session-test/no-set.', 'Session');
     $this->drupalGet('session-test/get');
@@ -112,14 +112,14 @@ function testDataPersistence() {
     $this->assertNoText($value_1, "After logout, previous user's session data is not available.", 'Session');
 
     // Now try to store some data as an anonymous user.
-    $value_3 = $this->randomName();
+    $value_3 = $this->randomMachineName();
     $this->drupalGet('session-test/set/' . $value_3);
     $this->assertText($value_3, 'Session data stored for anonymous user.', 'Session');
     $this->drupalGet('session-test/get');
     $this->assertText($value_3, 'Session correctly returned the stored data for an anonymous user.', 'Session');
 
     // Try to store data when drupal_save_session(FALSE).
-    $value_4 = $this->randomName();
+    $value_4 = $this->randomMachineName();
     $this->drupalGet('session-test/no-set/' . $value_4);
     $this->assertText($value_4, 'The session value was correctly passed to session-test/no-set.', 'Session');
     $this->drupalGet('session-test/get');
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/CronQueueTest.php b/core/modules/system/lib/Drupal/system/Tests/System/CronQueueTest.php
index 2bbd872..46e1845 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/CronQueueTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/CronQueueTest.php
@@ -37,7 +37,7 @@ public function testExceptions() {
     $queue = $this->container->get('queue')->get('cron_queue_test_exception');
 
     // Enqueue an item for processing.
-    $queue->createItem(array($this->randomName() => $this->randomName()));
+    $queue->createItem(array($this->randomMachineName() => $this->randomMachineName()));
 
     // Run cron; the worker for this queue should throw an exception and handle
     // it.
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/CronRunTest.php b/core/modules/system/lib/Drupal/system/Tests/System/CronRunTest.php
index 6fe28f2..f370d08 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/CronRunTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/CronRunTest.php
@@ -35,7 +35,7 @@ function testCronRun() {
     $this->assertResponse(404);
 
     // Run cron anonymously with a random cron key.
-    $key = $this->randomName(16);
+    $key = $this->randomMachineName(16);
     $this->drupalGet('cron/' . $key);
     $this->assertResponse(403);
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/DateFormatsMachineNameTest.php b/core/modules/system/lib/Drupal/system/Tests/System/DateFormatsMachineNameTest.php
index 495ab87..2d438f1 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/DateFormatsMachineNameTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/DateFormatsMachineNameTest.php
@@ -70,9 +70,9 @@ public function testDateFormatsMachineNameAllowedValues() {
     $this->assertText(t('The machine-readable name is already in use. It must be unique.'), 'It is not possible to create a date format with the machine name "fallback". It is a built-in format that already exists.');
 
     // Create a date format with a machine name distinct from the previous two.
-    $id = Unicode::strtolower($this->randomName(16));
+    $id = Unicode::strtolower($this->randomMachineName(16));
     $edit = array(
-      'label' => $this->randomName(16),
+      'label' => $this->randomMachineName(16),
       'id' => $id,
       'date_format_pattern' => 'd/m/Y',
     );
@@ -81,7 +81,7 @@ public function testDateFormatsMachineNameAllowedValues() {
 
     // Try to create a date format with same machine name as the previous one.
     $edit = array(
-      'label' => $this->randomName(16),
+      'label' => $this->randomMachineName(16),
       'id' => $id,
       'date_format_pattern' => 'd-m-Y',
     );
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/DateTimeTest.php b/core/modules/system/lib/Drupal/system/Tests/System/DateTimeTest.php
index 8f69047..51e6316 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/DateTimeTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/DateTimeTest.php
@@ -83,7 +83,7 @@ function testDateFormatConfiguration() {
 
     // Add custom date format.
     $this->clickLink(t('Add format'));
-    $date_format_id = strtolower($this->randomName(8));
+    $date_format_id = strtolower($this->randomMachineName(8));
     $name = ucwords($date_format_id);
     $date_format = 'd.m.Y - H:i';
     $edit = array(
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/FrontPageTest.php b/core/modules/system/lib/Drupal/system/Tests/System/FrontPageTest.php
index 336c2cb..d5c59c0 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/FrontPageTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/FrontPageTest.php
@@ -49,7 +49,7 @@ function setUp() {
   public function testDrupalFrontPage() {
     // Create a promoted node to test the <title> tag on the front page view.
     $settings = array(
-      'title' => $this->randomName(8),
+      'title' => $this->randomMachineName(8),
       'promote' => 1,
     );
     $node = $this->drupalCreateNode($settings);
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/PageNotFoundTest.php b/core/modules/system/lib/Drupal/system/Tests/System/PageNotFoundTest.php
index b248ff7..fcf09e7 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/PageNotFoundTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/PageNotFoundTest.php
@@ -32,7 +32,7 @@ function setUp() {
 
   function testPageNotFound() {
     $this->drupalLogin($this->admin_user);
-    $this->drupalGet($this->randomName(10));
+    $this->drupalGet($this->randomMachineName(10));
     $this->assertText(t('Page not found'), 'Found the default 404 page');
 
     // Use a custom 404 page.
@@ -41,7 +41,7 @@ function testPageNotFound() {
     );
     $this->drupalPostForm('admin/config/system/site-information', $edit, t('Save configuration'));
 
-    $this->drupalGet($this->randomName(10));
+    $this->drupalGet($this->randomMachineName(10));
     $this->assertText($this->admin_user->getUsername(), 'Found the custom 404 page');
   }
 }
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/PageTitleTest.php b/core/modules/system/lib/Drupal/system/Tests/System/PageTitleTest.php
index a944f2f..aa49ff2 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/PageTitleTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/PageTitleTest.php
@@ -53,8 +53,8 @@ function testTitleTags() {
     $title = "string with <em>HTML</em>";
     // Generate node content.
     $edit = array(
-      'title[0][value]' => '!SimpleTest! ' . $title . $this->randomName(20),
-      'body[0][value]' => '!SimpleTest! test body' . $this->randomName(200),
+      'title[0][value]' => '!SimpleTest! ' . $title . $this->randomMachineName(20),
+      'body[0][value]' => '!SimpleTest! test body' . $this->randomMachineName(200),
     );
     // Create the node with HTML in the title.
     $this->drupalPostForm('node/add/page', $edit, t('Save'));
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/RetrieveFileTest.php b/core/modules/system/lib/Drupal/system/Tests/System/RetrieveFileTest.php
index a7f7a50..75f9e07 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/RetrieveFileTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/RetrieveFileTest.php
@@ -26,8 +26,8 @@ public static function getInfo() {
    */
   function testFileRetrieving() {
     // Test 404 handling by trying to fetch a randomly named file.
-    drupal_mkdir($sourcedir = 'public://' . $this->randomName());
-    $filename = 'Файл для тестирования ' . $this->randomName();
+    drupal_mkdir($sourcedir = 'public://' . $this->randomMachineName());
+    $filename = 'Файл для тестирования ' . $this->randomMachineName();
     $url = file_create_url($sourcedir . '/' . $filename);
     $retrieved_file = system_retrieve_file($url);
     $this->assertFalse($retrieved_file, 'Non-existent file not fetched.');
@@ -46,7 +46,7 @@ function testFileRetrieving() {
     file_unmanaged_delete($retrieved_file);
 
     // Test downloading file to a different location.
-    drupal_mkdir($targetdir = 'temporary://' . $this->randomName());
+    drupal_mkdir($targetdir = 'temporary://' . $this->randomMachineName());
     $retrieved_file = system_retrieve_file($url, $targetdir);
     $this->assertEqual($retrieved_file, "$targetdir/$encoded_filename", 'Sane path for downloaded file returned (temporary:// scheme).');
     $this->assertTrue(is_file($retrieved_file), 'Downloaded file does exist (temporary:// scheme).');
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/ShutdownFunctionsTest.php b/core/modules/system/lib/Drupal/system/Tests/System/ShutdownFunctionsTest.php
index be463ab..e803293 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/ShutdownFunctionsTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/ShutdownFunctionsTest.php
@@ -41,8 +41,8 @@ protected function tearDown() {
    * Test shutdown functions.
    */
   function testShutdownFunctions() {
-    $arg1 = $this->randomName();
-    $arg2 = $this->randomName();
+    $arg1 = $this->randomMachineName();
+    $arg2 = $this->randomMachineName();
     $this->drupalGet('system-test/shutdown-functions/' . $arg1 . '/' . $arg2);
 
     // If using PHP-FPM then fastcgi_finish_request() will have been fired
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/SystemAuthorizeTest.php b/core/modules/system/lib/Drupal/system/Tests/System/SystemAuthorizeTest.php
index 3b2dc19..5ab5091 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/SystemAuthorizeTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/SystemAuthorizeTest.php
@@ -56,7 +56,7 @@ function drupalGetAuthorizePHP($page_title = 'system-test-auth') {
    * Tests the FileTransfer hooks
    */
   function testFileTransferHooks() {
-    $page_title = $this->randomName(16);
+    $page_title = $this->randomMachineName(16);
     $this->drupalGetAuthorizePHP($page_title);
     $this->assertTitle(strtr('@title | Drupal', array('@title' => $page_title)), 'authorize.php page title is correct.');
     $this->assertNoText('It appears you have reached this page in error.');
diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/EntityFilteringThemeTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/EntityFilteringThemeTest.php
index b2816aa..7da28f2 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Theme/EntityFilteringThemeTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Theme/EntityFilteringThemeTest.php
@@ -118,7 +118,7 @@ function setUp() {
       'field_name' => 'comment',
       'status' => CommentInterface::PUBLISHED,
       'subject' => $this->xss_label,
-      'comment_body' => array($this->randomName()),
+      'comment_body' => array($this->randomMachineName()),
     ));
     $this->comment->save();
   }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Transliteration/TransliterationTest.php b/core/modules/system/lib/Drupal/system/Tests/Transliteration/TransliterationTest.php
index 2e5ed60..416a244 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Transliteration/TransliterationTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Transliteration/TransliterationTest.php
@@ -33,7 +33,7 @@ public static function getInfo() {
    * Tests the PHPTransliteration class.
    */
   public function testPHPTransliteration() {
-    $random = $this->randomName(10);
+    $random = $this->randomMachineName(10);
     // Make some strings with two, three, and four-byte characters for testing.
     // Note that the 3-byte character is overridden by the 'kg' language.
     $two_byte = 'Ä Ö Ü Å Ø äöüåøhello';
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/LegacyTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/LegacyTest.php
index cddfefd..f079ba5 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/LegacyTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/LegacyTest.php
@@ -37,11 +37,11 @@ function testTaxonomyLegacyNode() {
     // Posts an article with a taxonomy term and a date prior to 1970.
     $date = new DrupalDateTime('1969-01-01 00:00:00');
     $edit = array();
-    $edit['title[0][value]'] = $this->randomName();
+    $edit['title[0][value]'] = $this->randomMachineName();
     $edit['created[date]'] = $date->format('Y-m-d');
     $edit['created[time]'] = $date->format('H:i:s');
-    $edit['body[0][value]'] = $this->randomName();
-    $edit['field_tags'] = $this->randomName();
+    $edit['body[0][value]'] = $this->randomMachineName();
+    $edit['field_tags'] = $this->randomMachineName();
     $this->drupalPostForm('node/add/article', $edit, t('Save and publish'));
     // Checks that the node has been saved.
     $node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/RssTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/RssTest.php
index 709d0fa..d8f2f98 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/RssTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/RssTest.php
@@ -94,7 +94,7 @@ function testTaxonomyRss() {
 
     // Post an article.
     $edit = array();
-    $edit['title[0][value]'] = $this->randomName();
+    $edit['title[0][value]'] = $this->randomMachineName();
     $edit[$this->field_name . '[]'] = $term1->id();
     $this->drupalPostForm('node/add/article', $edit, t('Save'));
 
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyImageTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyImageTest.php
index 576b9d1..63e7837 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyImageTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyImageTest.php
@@ -79,7 +79,7 @@ public function testTaxonomyImageAccess() {
     // Create a term and upload the image.
     $files = $this->drupalGetTestFiles('image');
     $image = array_pop($files);
-    $edit['name[0][value]'] = $this->randomName();
+    $edit['name[0][value]'] = $this->randomMachineName();
     $edit['files[field_test_0]'] = drupal_realpath($image->uri);
     $this->drupalPostForm('admin/structure/taxonomy/manage/' . $this->vocabulary->id()  . '/add', $edit, t('Save'));
     $terms = entity_load_multiple_by_properties('taxonomy_term', array('name' => $edit['name[0][value]']));
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermReferenceItemTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermReferenceItemTest.php
index 0a67140..c367fe0 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermReferenceItemTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermReferenceItemTest.php
@@ -46,8 +46,8 @@ public function setUp() {
     $this->installSchema('taxonomy', 'taxonomy_term_hierarchy');
 
     $vocabulary = entity_create('taxonomy_vocabulary', array(
-      'name' => $this->randomName(),
-      'vid' => drupal_strtolower($this->randomName()),
+      'name' => $this->randomMachineName(),
+      'vid' => drupal_strtolower($this->randomMachineName()),
       'langcode' => Language::LANGCODE_NOT_SPECIFIED,
     ));
     $vocabulary->save();
@@ -72,7 +72,7 @@ public function setUp() {
       'bundle' => 'entity_test',
     ))->save();
     $this->term = entity_create('taxonomy_term', array(
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       'vid' => $vocabulary->id(),
       'langcode' => Language::LANGCODE_NOT_SPECIFIED,
     ));
@@ -87,7 +87,7 @@ public function testTaxonomyTermReferenceItem() {
     // Just being able to create the entity like this verifies a lot of code.
     $entity = entity_create('entity_test');
     $entity->field_test_taxonomy->target_id = $this->term->id();
-    $entity->name->value = $this->randomName();
+    $entity->name->value = $this->randomMachineName();
     $entity->save();
 
     $entity = entity_load('entity_test', $entity->id());
@@ -99,7 +99,7 @@ public function testTaxonomyTermReferenceItem() {
     $this->assertEqual($entity->field_test_taxonomy->entity->uuid(), $this->term->uuid(), 'Field item entity contains the expected UUID.');
 
     // Change the name of the term via the reference.
-    $new_name = $this->randomName();
+    $new_name = $this->randomMachineName();
     $entity->field_test_taxonomy->entity->setName($new_name);
     $entity->field_test_taxonomy->entity->save();
     // Verify it is the correct name.
@@ -108,7 +108,7 @@ public function testTaxonomyTermReferenceItem() {
 
     // Make sure the computed term reflects updates to the term id.
     $term2 = entity_create('taxonomy_term', array(
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       'vid' => $this->term->getVocabularyId(),
       'langcode' => Language::LANGCODE_NOT_SPECIFIED,
     ));
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTestBase.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTestBase.php
index 9fd5a34..d76b529 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTestBase.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTestBase.php
@@ -37,9 +37,9 @@ function setUp() {
   function createVocabulary() {
     // Create a vocabulary.
     $vocabulary = entity_create('taxonomy_vocabulary', array(
-      'name' => $this->randomName(),
-      'description' => $this->randomName(),
-      'vid' => drupal_strtolower($this->randomName()),
+      'name' => $this->randomMachineName(),
+      'description' => $this->randomMachineName(),
+      'vid' => drupal_strtolower($this->randomMachineName()),
       'langcode' => Language::LANGCODE_NOT_SPECIFIED,
       'weight' => mt_rand(0, 10),
     ));
@@ -54,9 +54,9 @@ function createTerm($vocabulary) {
     $filter_formats = filter_formats();
     $format = array_pop($filter_formats);
     $term = entity_create('taxonomy_term', array(
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       'description' => array(
-        'value' => $this->randomName(),
+        'value' => $this->randomMachineName(),
         // Use the first available text format.
         'format' => $format->format,
       ),
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldMultipleVocabularyTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldMultipleVocabularyTest.php
index afac0db..a3614dd 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldMultipleVocabularyTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldMultipleVocabularyTest.php
@@ -41,7 +41,7 @@ function setUp() {
     $this->vocabulary2 = $this->createVocabulary();
 
     // Set up a field and instance.
-    $this->field_name = drupal_strtolower($this->randomName());
+    $this->field_name = drupal_strtolower($this->randomMachineName());
     entity_create('field_config', array(
       'name' => $this->field_name,
       'entity_type' => 'entity_test',
@@ -92,7 +92,7 @@ function testTaxonomyTermFieldMultipleVocabularies() {
     $this->assertFieldByName("{$this->field_name}[]", NULL, 'Widget is displayed.');
     $edit = array(
       'user_id' => mt_rand(0, 10),
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$this->field_name}[]" => array($term1->id(), $term2->id()),
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -134,7 +134,7 @@ function testTaxonomyTermFieldMultipleVocabularies() {
     // Term 1 should still pass validation.
     $edit = array(
       'user_id' => mt_rand(0, 10),
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$this->field_name}[]" => array($term1->id()),
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldTest.php
index 1dd0aab..fac2ea1 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldTest.php
@@ -43,7 +43,7 @@ function setUp() {
     $this->vocabulary = $this->createVocabulary();
 
     // Setup a field and instance.
-    $this->field_name = drupal_strtolower($this->randomName());
+    $this->field_name = drupal_strtolower($this->randomMachineName());
     $this->field = entity_create('field_config', array(
       'name' => $this->field_name,
       'entity_type' => 'entity_test',
@@ -108,7 +108,7 @@ function testTaxonomyTermFieldWidgets() {
     // Submit with some value.
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       $this->field_name => array($term->id()),
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -165,7 +165,7 @@ function testTaxonomyTermFieldChangeMachineName() {
     );
     $this->field->save();
     // Change the machine name.
-    $new_name = drupal_strtolower($this->randomName());
+    $new_name = drupal_strtolower($this->randomMachineName());
     $this->vocabulary->vid = $new_name;
     $this->vocabulary->save();
 
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php
index e79d159..2d9fee4 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php
@@ -32,7 +32,7 @@ function setUp() {
     // Create a vocabulary and add two term reference fields to article nodes.
     $this->vocabulary = $this->createVocabulary();
 
-    $this->field_name_1 = drupal_strtolower($this->randomName());
+    $this->field_name_1 = drupal_strtolower($this->randomMachineName());
     entity_create('field_config', array(
       'name' => $this->field_name_1,
       'entity_type' => 'node',
@@ -63,7 +63,7 @@ function setUp() {
       ))
       ->save();
 
-    $this->field_name_2 = drupal_strtolower($this->randomName());
+    $this->field_name_2 = drupal_strtolower($this->randomMachineName());
     entity_create('field_config', array(
       'name' => $this->field_name_2,
       'entity_type' => 'node',
@@ -105,8 +105,8 @@ function testTaxonomyIndex() {
 
     // Post an article.
     $edit = array();
-    $edit['title[0][value]'] = $this->randomName();
-    $edit['body[0][value]'] = $this->randomName();
+    $edit['title[0][value]'] = $this->randomMachineName();
+    $edit['body[0][value]'] = $this->randomMachineName();
     $edit["{$this->field_name_1}[]"] = $term_1->id();
     $edit["{$this->field_name_2}[]"] = $term_1->id();
     $this->drupalPostForm('node/add/article', $edit, t('Save'));
@@ -153,7 +153,7 @@ function testTaxonomyIndex() {
 
     // Redo the above tests without interface.
     $node = node_load($node->id(), TRUE);
-    $node->title = $this->randomName();
+    $node->title = $this->randomMachineName();
 
     // Update the article with no term changed.
     $node->save();
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermLanguageTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermLanguageTest.php
index 256a0a0..94a7314 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermLanguageTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermLanguageTest.php
@@ -38,7 +38,7 @@ function setUp() {
     foreach (array('aa', 'bb', 'cc') as $language_code) {
       $language = new Language(array(
         'id' => $language_code,
-        'name' => $this->randomName(),
+        'name' => $this->randomMachineName(),
       ));
       language_save($language);
     }
@@ -57,7 +57,7 @@ function testTermLanguage() {
     $this->assertField('edit-langcode', t('The language selector field was found on the page.'));
     // Submit the term.
     $edit = array(
-      'name[0][value]' => $this->randomName(),
+      'name[0][value]' => $this->randomMachineName(),
       'langcode' => 'aa',
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php
index d07ab4a..9a06bb8 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php
@@ -115,8 +115,8 @@ function testTaxonomyNode() {
 
     // Post an article.
     $edit = array();
-    $edit['title[0][value]'] = $this->randomName();
-    $edit['body[0][value]'] = $this->randomName();
+    $edit['title[0][value]'] = $this->randomMachineName();
+    $edit['body[0][value]'] = $this->randomMachineName();
     $edit[$this->instance->getName() . '[]'] = $term1->id();
     $this->drupalPostForm('node/add/article', $edit, t('Save'));
 
@@ -159,15 +159,15 @@ function testNodeTermCreationAndDeletion() {
       ))
       ->save();
     $terms = array(
-      'term1' => $this->randomName(),
-      'term2' => $this->randomName(),
-      'term3' => $this->randomName() . ', ' . $this->randomName(),
-      'term4' => $this->randomName(),
+      'term1' => $this->randomMachineName(),
+      'term2' => $this->randomMachineName(),
+      'term3' => $this->randomMachineName() . ', ' . $this->randomMachineName(),
+      'term4' => $this->randomMachineName(),
     );
 
     $edit = array();
-    $edit['title[0][value]'] = $this->randomName();
-    $edit['body[0][value]'] = $this->randomName();
+    $edit['title[0][value]'] = $this->randomMachineName();
+    $edit['body[0][value]'] = $this->randomMachineName();
     // Insert the terms in a comma separated list. Vocabulary 1 is a
     // free-tagging field created by the default profile.
     $edit[$instance->getName()] = Tags::implode($terms);
@@ -232,8 +232,8 @@ function testNodeTermCreationAndDeletion() {
     $this->assertRaw('[{"value":"' . $term_objects['term4']->getName() . '","label":"' . $term_objects['term4']->getName() . '"}', format_string('Autocomplete returns term %term_name after typing the first 3 letters.', array('%term_name' => $term_objects['term4']->getName())));
 
     // Test taxonomy autocomplete with a nonexistent field.
-    $field_name = $this->randomName();
-    $tag = $this->randomName();
+    $field_name = $this->randomMachineName();
+    $tag = $this->randomMachineName();
     $message = t("Taxonomy field @field_name not found.", array('@field_name' => $field_name));
     $this->assertFalse(field_info_field('node', $field_name), format_string('Field %field_name does not exist.', array('%field_name' => $field_name)));
     $this->drupalGet('taxonomy/autocomplete/node/' . $field_name, array('query' => array('q' => $tag)));
@@ -301,8 +301,8 @@ function testTermAutocompletion() {
    */
   function testTermInterface() {
     $edit = array(
-      'name[0][value]' => $this->randomName(12),
-      'description[0][value]' => $this->randomName(100),
+      'name[0][value]' => $this->randomMachineName(12),
+      'description[0][value]' => $this->randomMachineName(100),
     );
     // Explicitly set the parents field to 'root', to ensure that
     // TermFormController::save() handles the invalid term ID correctly.
@@ -327,8 +327,8 @@ function testTermInterface() {
     $this->assertText($edit['description[0][value]'], 'The randomly generated term description is present.');
 
     $edit = array(
-      'name[0][value]' => $this->randomName(14),
-      'description[0][value]' => $this->randomName(102),
+      'name[0][value]' => $this->randomMachineName(14),
+      'description[0][value]' => $this->randomMachineName(102),
     );
 
     // Edit the term.
@@ -357,7 +357,7 @@ function testTermInterface() {
     $this->assertFalse($this->xpath('//div[contains(@class, "field-taxonomy-term--description")]'), 'Term page did not display the term description when description was blank.');
 
     // Check that the description value is processed.
-    $value = $this->randomName();
+    $value = $this->randomMachineName();
     $term->setDescription($value);
     $term->save();
     $this->assertEqual($term->description->processed, "<p>$value</p>\n");
@@ -442,8 +442,8 @@ function testTermMultipleParentsInterface() {
 
     // Add a new term with multiple parents.
     $edit = array(
-      'name[0][value]' => $this->randomName(12),
-      'description[0][value]' => $this->randomName(100),
+      'name[0][value]' => $this->randomMachineName(12),
+      'description[0][value]' => $this->randomMachineName(100),
       'parent[]' => array(0, $parent->id()),
     );
     // Save the new term.
@@ -537,8 +537,8 @@ function testReSavingTags() {
     // Create a term and a node using it.
     $term = $this->createTerm($this->vocabulary);
     $edit = array();
-    $edit['title[0][value]'] = $this->randomName(8);
-    $edit['body[0][value]'] = $this->randomName(16);
+    $edit['title[0][value]'] = $this->randomMachineName(8);
+    $edit['body[0][value]'] = $this->randomMachineName(16);
     $edit[$this->instance->getName()] = $term->getName();
     $this->drupalPostForm('node/add/article', $edit, t('Save'));
 
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTranslationUITest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTranslationUITest.php
index a027ade..fbbffca 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTranslationUITest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTranslationUITest.php
@@ -45,7 +45,7 @@ public static function getInfo() {
   function setUp() {
     $this->entityTypeId = 'taxonomy_term';
     $this->bundle = 'tags';
-    $this->name = $this->randomName();
+    $this->name = $this->randomMachineName();
     parent::setUp();
   }
 
@@ -58,7 +58,7 @@ protected function setupBundle() {
     // Create a vocabulary.
     $this->vocabulary = entity_create('taxonomy_vocabulary', array(
       'name' => $this->bundle,
-      'description' => $this->randomName(),
+      'description' => $this->randomMachineName(),
       'vid' => $this->bundle,
       'langcode' => Language::LANGCODE_NOT_SPECIFIED,
       'weight' => mt_rand(0, 10),
@@ -126,7 +126,7 @@ function testTranslateLinkVocabularyAdminPage() {
     // Create an untranslatable vocabulary.
     $untranslatable_vocabulary = entity_create('taxonomy_vocabulary', array(
       'name' => 'untranslatable_voc',
-      'description' => $this->randomName(),
+      'description' => $this->randomMachineName(),
       'vid' => 'untranslatable_voc',
       'langcode' => Language::LANGCODE_NOT_SPECIFIED,
       'weight' => mt_rand(0, 10),
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyTestBase.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyTestBase.php
index 2cc992e..bb42bca 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyTestBase.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyTestBase.php
@@ -131,8 +131,8 @@ protected function createTerm() {
     $filter_formats = filter_formats();
     $format = array_pop($filter_formats);
     $term = entity_create('taxonomy_term', array(
-      'name' => $this->randomName(),
-      'description' => $this->randomName(),
+      'name' => $this->randomMachineName(),
+      'description' => $this->randomMachineName(),
       // Use the first available text format.
       'format' => $format->format,
       'vid' => $this->vocabulary->id(),
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyLanguageTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyLanguageTest.php
index 5503589..214b616 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyLanguageTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyLanguageTest.php
@@ -34,13 +34,13 @@ function setUp() {
     // Add some custom languages.
     $language = new Language(array(
       'id' => 'aa',
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
     ));
     language_save($language);
 
     $language = new Language(array(
       'id' => 'bb',
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
     ));
     language_save($language);
   }
@@ -55,9 +55,9 @@ function testVocabularyLanguage() {
     $this->assertField('edit-langcode', 'The language selector field was found on the page.');
 
     // Create the vocabulary.
-    $vid = drupal_strtolower($this->randomName());
-    $edit['name'] = $this->randomName();
-    $edit['description'] = $this->randomName();
+    $vid = drupal_strtolower($this->randomMachineName());
+    $edit['name'] = $this->randomMachineName();
+    $edit['description'] = $this->randomMachineName();
     $edit['langcode'] = 'aa';
     $edit['vid'] = $vid;
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -83,8 +83,8 @@ function testVocabularyDefaultLanguageForTerms() {
     // Add a new vocabulary and check that the default language settings are for
     // the terms are saved.
     $edit = array(
-      'name' => $this->randomName(),
-      'vid' => drupal_strtolower($this->randomName()),
+      'name' => $this->randomMachineName(),
+      'vid' => drupal_strtolower($this->randomMachineName()),
       'default_language[langcode]' => 'bb',
       'default_language[language_show]' => TRUE,
     );
@@ -122,7 +122,7 @@ function testVocabularyDefaultLanguageForTerms() {
 
     // Check that language settings are changed after editing vocabulary.
     $edit = array(
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       'default_language[langcode]' => 'authors_default',
       'default_language[language_show]' => FALSE,
     );
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyPermissionsTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyPermissionsTest.php
index 7b89802..1ef18b6 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyPermissionsTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyPermissionsTest.php
@@ -41,7 +41,7 @@ function testVocabularyPermissionsTaxonomyTerm() {
 
     // Submit the term.
     $edit = array();
-    $edit['name[0][value]'] = $this->randomName();
+    $edit['name[0][value]'] = $this->randomMachineName();
 
     $this->drupalPostForm(NULL, $edit, t('Save'));
     $this->assertRaw(t('Created new term %name.', array('%name' => $edit['name[0][value]'])), 'Term created successfully.');
@@ -54,7 +54,7 @@ function testVocabularyPermissionsTaxonomyTerm() {
     $this->assertResponse(200);
     $this->assertText($edit['name[0][value]'], 'Edit taxonomy term form opened successfully.');
 
-    $edit['name[0][value]'] = $this->randomName();
+    $edit['name[0][value]'] = $this->randomMachineName();
     $this->drupalPostForm(NULL, $edit, t('Save'));
     $this->assertRaw(t('Updated term %name.', array('%name' => $edit['name[0][value]'])), 'Term updated successfully.');
 
@@ -82,7 +82,7 @@ function testVocabularyPermissionsTaxonomyTerm() {
     $this->assertResponse(200);
     $this->assertText($term->getName(), 'Edit taxonomy term form opened successfully.');
 
-    $edit['name[0][value]'] = $this->randomName();
+    $edit['name[0][value]'] = $this->randomMachineName();
     $this->drupalPostForm(NULL, $edit, t('Save'));
     $this->assertRaw(t('Updated term %name.', array('%name' => $edit['name[0][value]'])), 'Term updated successfully.');
 
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyTest.php
index 7e5fe4a..ed71685 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyTest.php
@@ -37,9 +37,9 @@ function testVocabularyInterface() {
     // Create a new vocabulary.
     $this->clickLink(t('Add vocabulary'));
     $edit = array();
-    $vid = drupal_strtolower($this->randomName());
-    $edit['name'] = $this->randomName();
-    $edit['description'] = $this->randomName();
+    $vid = drupal_strtolower($this->randomMachineName());
+    $edit['name'] = $this->randomMachineName();
+    $edit['description'] = $this->randomMachineName();
     $edit['vid'] = $vid;
     $this->drupalPostForm(NULL, $edit, t('Save'));
     $this->assertRaw(t('Created new vocabulary %name.', array('%name' => $edit['name'])), 'Vocabulary created successfully.');
@@ -49,7 +49,7 @@ function testVocabularyInterface() {
     $this->assertText($edit['name'], 'Vocabulary found in the vocabulary overview listing.');
     $this->clickLink(t('Edit vocabulary'));
     $edit = array();
-    $edit['name'] = $this->randomName();
+    $edit['name'] = $this->randomMachineName();
     $this->drupalPostForm(NULL, $edit, t('Save'));
     $this->drupalGet('admin/structure/taxonomy');
     $this->assertText($edit['name'], 'Vocabulary found in the vocabulary overview listing.');
@@ -67,7 +67,7 @@ function testVocabularyInterface() {
     // Ensure that vocabulary titles are escaped properly.
     $edit = array();
     $edit['name'] = 'Don\'t Panic';
-    $edit['description'] = $this->randomName();
+    $edit['description'] = $this->randomMachineName();
     $edit['vid'] = 'don_t_panic';
     $this->drupalPostForm('admin/structure/taxonomy/add', $edit, t('Save'));
 
@@ -126,9 +126,9 @@ function testTaxonomyAdminNoVocabularies() {
    */
   function testTaxonomyAdminDeletingVocabulary() {
     // Create a vocabulary.
-    $vid = drupal_strtolower($this->randomName());
+    $vid = drupal_strtolower($this->randomMachineName());
     $edit = array(
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       'vid' => $vid,
     );
     $this->drupalPostForm('admin/structure/taxonomy/add', $edit, t('Save'));
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php
index ae757f3..47ffbca 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php
@@ -79,8 +79,8 @@ function testTaxonomyVocabularyLoadStaticReset() {
 
     // Change the name and description.
     $vocabulary = $original_vocabulary;
-    $vocabulary->name = $this->randomName();
-    $vocabulary->description = $this->randomName();
+    $vocabulary->name = $this->randomMachineName();
+    $vocabulary->description = $this->randomMachineName();
     $vocabulary->save();
 
     // Load the vocabulary.
@@ -158,7 +158,7 @@ function testTaxonomyVocabularyChangeMachineName() {
 
     // Change the machine name.
     $old_name = $this->vocabulary->id();
-    $new_name = drupal_strtolower($this->randomName());
+    $new_name = drupal_strtolower($this->randomMachineName());
     $this->vocabulary->vid = $new_name;
     $this->vocabulary->save();
 
@@ -177,7 +177,7 @@ function testTaxonomyVocabularyChangeMachineName() {
   function testUninstallReinstall() {
     // Fields and field instances attached to taxonomy term bundles should be
     // removed when the module is uninstalled.
-    $this->field_name = drupal_strtolower($this->randomName() . '_field_name');
+    $this->field_name = drupal_strtolower($this->randomMachineName() . '_field_name');
     $this->field_definition = array(
       'name' => $this->field_name,
       'entity_type' => 'taxonomy_term',
@@ -189,7 +189,7 @@ function testUninstallReinstall() {
       'field_name' => $this->field_name,
       'entity_type' => 'taxonomy_term',
       'bundle' => $this->vocabulary->id(),
-      'label' => $this->randomName() . '_label',
+      'label' => $this->randomMachineName() . '_label',
     );
     entity_create('field_instance_config', $this->instance_definition)->save();
 
diff --git a/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneFieldTest.php b/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneFieldTest.php
index e0fe150..2c58b4d 100644
--- a/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneFieldTest.php
+++ b/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneFieldTest.php
@@ -87,7 +87,7 @@ function testTelephoneField() {
 
     // Test basic entery of telephone field.
     $edit = array(
-      'title[0][value]' => $this->randomName(),
+      'title[0][value]' => $this->randomMachineName(),
       'field_telephone[0][value]' => "123456789",
     );
 
@@ -96,7 +96,7 @@ function testTelephoneField() {
 
     // Add number with a space in it. Need to ensure it is stripped on output.
     $edit = array(
-      'title[0][value]' => $this->randomName(),
+      'title[0][value]' => $this->randomMachineName(),
       'field_telephone[0][value]' => "1234 56789",
     );
 
diff --git a/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneItemTest.php b/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneItemTest.php
index d2b6f11..6a22bfb 100644
--- a/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneItemTest.php
+++ b/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneItemTest.php
@@ -55,7 +55,7 @@ public function testTestItem() {
     $entity = entity_create('entity_test');
     $value = '+0123456789';
     $entity->field_test = $value;
-    $entity->name->value = $this->randomName();
+    $entity->name->value = $this->randomMachineName();
     $entity->save();
 
     // Verify entity has been created properly.
diff --git a/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php b/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php
index 8e37920..32f3b53 100644
--- a/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php
+++ b/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php
@@ -57,7 +57,7 @@ function setUp() {
       $this->bundle = $this->entity_type;
     }
 
-    $this->field_name = drupal_strtolower($this->randomName());
+    $this->field_name = drupal_strtolower($this->randomMachineName());
     $this->field_type = 'text_long';
     $this->field_settings = array();
     $this->instance_settings = array(
@@ -79,7 +79,7 @@ function setUp() {
       'entity_type' => $this->entity_type,
       'bundle' => $this->bundle,
       'field_name' => $this->field_name,
-      'label' => $this->randomName(),
+      'label' => $this->randomMachineName(),
       'settings' => $this->instance_settings,
     ));
     $this->instance->save();
diff --git a/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php b/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php
index aecf257..1f2bb97 100644
--- a/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php
+++ b/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php
@@ -49,7 +49,7 @@ function testTextFieldValidation() {
     // Create a field with settings to validate.
     $max_length = 3;
     $this->field = entity_create('field_config', array(
-      'name' => drupal_strtolower($this->randomName()),
+      'name' => drupal_strtolower($this->randomMachineName()),
       'entity_type' => 'entity_test',
       'type' => 'text',
       'settings' => array(
@@ -90,7 +90,7 @@ function testTextfieldWidgets() {
    */
   function _testTextfieldWidgets($field_type, $widget_type) {
     // Setup a field and instance
-    $this->field_name = drupal_strtolower($this->randomName());
+    $this->field_name = drupal_strtolower($this->randomMachineName());
     $this->field = entity_create('field_config', array(
       'name' => $this->field_name,
       'entity_type' => 'entity_test',
@@ -101,7 +101,7 @@ function _testTextfieldWidgets($field_type, $widget_type) {
       'field_name' => $this->field_name,
       'entity_type' => 'entity_test',
       'bundle' => 'entity_test',
-      'label' => $this->randomName() . '_label',
+      'label' => $this->randomMachineName() . '_label',
       'settings' => array(
         'text_processing' => TRUE,
       ),
@@ -125,10 +125,10 @@ function _testTextfieldWidgets($field_type, $widget_type) {
     $this->assertRaw(format_string('placeholder="A placeholder on !widget_type"', array('!widget_type' => $widget_type)));
 
     // Submit with some value.
-    $value = $this->randomName();
+    $value = $this->randomMachineName();
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$this->field_name}[0][value]" => $value,
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -157,7 +157,7 @@ function testTextfieldWidgetsFormatted() {
    */
   function _testTextfieldWidgetsFormatted($field_type, $widget_type) {
     // Setup a field and instance
-    $this->field_name = drupal_strtolower($this->randomName());
+    $this->field_name = drupal_strtolower($this->randomMachineName());
     $this->field = entity_create('field_config', array(
       'name' => $this->field_name,
       'entity_type' => 'entity_test',
@@ -168,7 +168,7 @@ function _testTextfieldWidgetsFormatted($field_type, $widget_type) {
       'field_name' => $this->field_name,
       'entity_type' => 'entity_test',
       'bundle' => 'entity_test',
-      'label' => $this->randomName() . '_label',
+      'label' => $this->randomMachineName() . '_label',
       'settings' => array(
         'text_processing' => TRUE,
       ),
@@ -198,10 +198,10 @@ function _testTextfieldWidgetsFormatted($field_type, $widget_type) {
     $this->assertNoFieldByName("{$this->field_name}[0][format]", '', 'Format selector is not displayed');
 
     // Submit with data that should be filtered.
-    $value = '<em>' . $this->randomName() . '</em>';
+    $value = '<em>' . $this->randomMachineName() . '</em>';
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$this->field_name}[0][value]" => $value,
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -221,8 +221,8 @@ function _testTextfieldWidgetsFormatted($field_type, $widget_type) {
     // access to it.
     $this->drupalLogin($this->admin_user);
     $edit = array(
-      'format' => drupal_strtolower($this->randomName()),
-      'name' => $this->randomName(),
+      'format' => drupal_strtolower($this->randomMachineName()),
+      'name' => $this->randomMachineName(),
     );
     $this->drupalPostForm('admin/config/content/formats/add', $edit, t('Save configuration'));
     filter_formats_reset();
@@ -244,7 +244,7 @@ function _testTextfieldWidgetsFormatted($field_type, $widget_type) {
     // Edit and change the text format to the new one that was created.
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$this->field_name}[0][format]" => $format_id,
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
diff --git a/core/modules/text/lib/Drupal/text/Tests/TextWithSummaryItemTest.php b/core/modules/text/lib/Drupal/text/Tests/TextWithSummaryItemTest.php
index 9b93095..a9d9a97 100644
--- a/core/modules/text/lib/Drupal/text/Tests/TextWithSummaryItemTest.php
+++ b/core/modules/text/lib/Drupal/text/Tests/TextWithSummaryItemTest.php
@@ -69,10 +69,10 @@ public function testCrudAndUpdate() {
 
     // Create an entity with a summary and no text format.
     $entity = entity_create($entity_type);
-    $entity->summary_field->value = $value = $this->randomName();
-    $entity->summary_field->summary = $summary = $this->randomName();
+    $entity->summary_field->value = $value = $this->randomMachineName();
+    $entity->summary_field->summary = $summary = $this->randomMachineName();
     $entity->summary_field->format = NULL;
-    $entity->name->value = $this->randomName();
+    $entity->name->value = $this->randomMachineName();
     $entity->save();
 
     $entity = entity_load($entity_type, $entity->id());
@@ -113,10 +113,10 @@ function testProcessedCache() {
 
     // Create an entity with a summary and a text format.
     $entity = entity_create($entity_type);
-    $entity->summary_field->value = $value = $this->randomName();
-    $entity->summary_field->summary = $summary = $this->randomName();
+    $entity->summary_field->value = $value = $this->randomMachineName();
+    $entity->summary_field->summary = $summary = $this->randomMachineName();
     $entity->summary_field->format = 'plain_text';
-    $entity->name->value = $this->randomName();
+    $entity->name->value = $this->randomMachineName();
     $entity->save();
 
     // Check that the processed values are correctly computed.
diff --git a/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarAdminMenuTest.php b/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarAdminMenuTest.php
index 01f043e..dd37d63 100644
--- a/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarAdminMenuTest.php
+++ b/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarAdminMenuTest.php
@@ -363,13 +363,13 @@ function testLocaleTranslationSubtreesHashCacheClear() {
     // Create a new language with the langcode 'xx'.
     $langcode = 'xx';
     // The English name for the language. This will be translated.
-    $name = $this->randomName(16);
+    $name = $this->randomMachineName(16);
     // This is the language indicator on the translation search screen for
     // untranslated strings.
     $language_indicator = "<em class=\"locale-untranslated\">$langcode</em> ";
     // This will be the translation of $name.
-    $translation = $this->randomName(16);
-    $translation_to_en = $this->randomName(16);
+    $translation = $this->randomMachineName(16);
+    $translation_to_en = $this->randomMachineName(16);
 
     // Add custom language.
     $this->drupalLogin($admin_user);
@@ -458,7 +458,7 @@ function testSubtreesJsonRequest() {
     // Create a new language with the langcode 'xx'.
     $langcode = 'xx';
     // The English name for the language. This will be translated.
-    $name = $this->randomName(16);
+    $name = $this->randomMachineName(16);
     $edit = array(
       'predefined_langcode' => 'custom',
       'langcode' => $langcode,
@@ -483,7 +483,7 @@ function testLanguageSwitching() {
     // Create a new language with the langcode 'xx'.
     $langcode = 'xx';
     // The English name for the language. This will be translated.
-    $name = $this->randomName(16);
+    $name = $this->randomMachineName(16);
     $edit = array(
       'predefined_langcode' => 'custom',
       'langcode' => $langcode,
diff --git a/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarMenuTranslationTest.php b/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarMenuTranslationTest.php
index 7bfa0f2..b74acc8 100644
--- a/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarMenuTranslationTest.php
+++ b/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarMenuTranslationTest.php
@@ -68,7 +68,7 @@ function testToolbarClasses() {
     $this->assertEqual(count($xpath), 1, 'The menu item class ok before translation.');
 
     // Translate the menu item.
-    $menu_item_translated = $this->randomName();
+    $menu_item_translated = $this->randomMachineName();
     $textarea = current($this->xpath('//textarea'));
     $lid = (string) $textarea[0]['name'];
     $edit = array(
diff --git a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php
index 001de20..1f85f79 100644
--- a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php
+++ b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php
@@ -62,11 +62,11 @@ function testTrackerAll() {
     $this->drupalLogin($this->user);
 
     $unpublished = $this->drupalCreateNode(array(
-      'title' => $this->randomName(8),
+      'title' => $this->randomMachineName(8),
       'status' => 0,
     ));
     $published = $this->drupalCreateNode(array(
-      'title' => $this->randomName(8),
+      'title' => $this->randomMachineName(8),
       'status' => 1,
     ));
 
@@ -88,28 +88,28 @@ function testTrackerUser() {
     $this->drupalLogin($this->user);
 
     $unpublished = $this->drupalCreateNode(array(
-      'title' => $this->randomName(8),
+      'title' => $this->randomMachineName(8),
       'uid' => $this->user->id(),
       'status' => 0,
     ));
     $my_published = $this->drupalCreateNode(array(
-      'title' => $this->randomName(8),
+      'title' => $this->randomMachineName(8),
       'uid' => $this->user->id(),
       'status' => 1,
     ));
     $other_published_no_comment = $this->drupalCreateNode(array(
-      'title' => $this->randomName(8),
+      'title' => $this->randomMachineName(8),
       'uid' => $this->other_user->id(),
       'status' => 1,
     ));
     $other_published_my_comment = $this->drupalCreateNode(array(
-      'title' => $this->randomName(8),
+      'title' => $this->randomMachineName(8),
       'uid' => $this->other_user->id(),
       'status' => 1,
     ));
     $comment = array(
-      'subject' => $this->randomName(),
-      'comment_body[0][value]' => $this->randomName(20),
+      'subject' => $this->randomMachineName(),
+      'comment_body[0][value]' => $this->randomMachineName(20),
     );
     $this->drupalPostForm('comment/reply/node/' . $other_published_my_comment->id() . '/comment', $comment, t('Save'));
 
@@ -137,7 +137,7 @@ function testTrackerNewNodes() {
     $this->drupalLogin($this->user);
 
     $edit = array(
-      'title' => $this->randomName(8),
+      'title' => $this->randomMachineName(8),
     );
 
     $node = $this->drupalCreateNode($edit);
@@ -181,13 +181,13 @@ function testTrackerNewComments() {
     $this->drupalLogin($this->user);
 
     $node = $this->drupalCreateNode(array(
-      'title' => $this->randomName(8),
+      'title' => $this->randomMachineName(8),
     ));
 
     // Add a comment to the page.
     $comment = array(
-      'subject' => $this->randomName(),
-      'comment_body[0][value]' => $this->randomName(20),
+      'subject' => $this->randomMachineName(),
+      'comment_body[0][value]' => $this->randomMachineName(20),
     );
     $this->drupalPostForm('comment/reply/node/' . $node->id() . '/comment', $comment, t('Save'));
     // The new comment is automatically viewed by the current user. Simulate the
@@ -207,8 +207,8 @@ function testTrackerNewComments() {
 
     // Add another comment as other_user.
     $comment = array(
-      'subject' => $this->randomName(),
-      'comment_body[0][value]' => $this->randomName(20),
+      'subject' => $this->randomMachineName(),
+      'comment_body[0][value]' => $this->randomMachineName(20),
     );
     // If the comment is posted in the same second as the last one then Drupal
     // can't tell the difference, so we wait one second here.
@@ -231,7 +231,7 @@ function testTrackerCronIndexing() {
     $nodes = array();
     for ($i = 1; $i <= 3; $i++) {
       $edits[$i] = array(
-        'title' => $this->randomName(),
+        'title' => $this->randomMachineName(),
       );
       $nodes[$i] = $this->drupalCreateNode($edits[$i]);
     }
@@ -239,8 +239,8 @@ function testTrackerCronIndexing() {
     // Add a comment to the last node as other user.
     $this->drupalLogin($this->other_user);
     $comment = array(
-      'subject' => $this->randomName(),
-      'comment_body[0][value]' => $this->randomName(20),
+      'subject' => $this->randomMachineName(),
+      'comment_body[0][value]' => $this->randomMachineName(20),
     );
     $this->drupalPostForm('comment/reply/node/' . $nodes[3]->id() . '/comment', $comment, t('Save'));
 
@@ -285,7 +285,7 @@ function testTrackerAdminUnpublish() {
     $this->drupalLogin($admin_user);
 
     $node = $this->drupalCreateNode(array(
-      'title' => $this->randomName(),
+      'title' => $this->randomMachineName(),
     ));
 
     // Assert that the node is displayed.
diff --git a/core/modules/tracker/lib/Drupal/tracker/Tests/Views/TrackerTestBase.php b/core/modules/tracker/lib/Drupal/tracker/Tests/Views/TrackerTestBase.php
index a727ad5..a082dc6 100644
--- a/core/modules/tracker/lib/Drupal/tracker/Tests/Views/TrackerTestBase.php
+++ b/core/modules/tracker/lib/Drupal/tracker/Tests/Views/TrackerTestBase.php
@@ -45,7 +45,7 @@ protected function setUp() {
     $this->drupalLogin($account);
 
     $this->node = $this->drupalCreateNode(array(
-      'title' => $this->randomName(8),
+      'title' => $this->randomMachineName(8),
       'uid' => $account->id(),
       'status' => 1,
     ));
@@ -54,8 +54,8 @@ protected function setUp() {
       'entity_id' => $this->node->id(),
       'entity_type' => 'node',
       'field_name' => 'comment',
-      'subject' => $this->randomName(),
-      'comment_body[' . Language::LANGCODE_NOT_SPECIFIED . '][0][value]' => $this->randomName(20),
+      'subject' => $this->randomMachineName(),
+      'comment_body[' . Language::LANGCODE_NOT_SPECIFIED . '][0][value]' => $this->randomMachineName(20),
     ));
 
   }
diff --git a/core/modules/user/lib/Drupal/user/Tests/TempStoreDatabaseTest.php b/core/modules/user/lib/Drupal/user/Tests/TempStoreDatabaseTest.php
index 0437837..b24d5bd 100644
--- a/core/modules/user/lib/Drupal/user/Tests/TempStoreDatabaseTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/TempStoreDatabaseTest.php
@@ -84,7 +84,7 @@ protected function tearDown() {
   public function testUserTempStore() {
     // Create a key/value collection.
     $factory = new TempStoreFactory(Database::getConnection(), new DatabaseLockBackend(Database::getConnection()));
-    $collection = $this->randomName();
+    $collection = $this->randomMachineName();
 
     // Create two mock users.
     for ($i = 0; $i <= 1; $i++) {
@@ -97,7 +97,7 @@ public function testUserTempStore() {
       $stores[$i] = $factory->get($collection, $users[$i]);
     }
 
-    $key = $this->randomName();
+    $key = $this->randomMachineName();
     // Test that setIfNotExists() succeeds only the first time.
     for ($i = 0; $i <= 1; $i++) {
       // setIfNotExists() should be TRUE the first time (when $i is 0) and
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserAdminLanguageTest.php b/core/modules/user/lib/Drupal/user/Tests/UserAdminLanguageTest.php
index 7737624..bc460f9 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserAdminLanguageTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserAdminLanguageTest.php
@@ -132,7 +132,7 @@ function setLanguageNegotiation() {
   function addCustomLanguage() {
     $langcode = 'xx';
     // The English name for the language.
-    $name = $this->randomName(16);
+    $name = $this->randomMachineName(16);
     $edit = array(
       'predefined_langcode' => 'custom',
       'langcode' => $langcode,
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserAdminTest.php b/core/modules/user/lib/Drupal/user/Tests/UserAdminTest.php
index fb58bc1..3fb95de 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserAdminTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserAdminTest.php
@@ -31,7 +31,7 @@ public static function getInfo() {
    */
   function testUserAdmin() {
     $user_a = $this->drupalCreateUser();
-    $user_a->mail = $this->randomName() . '@example.com';
+    $user_a->mail = $this->randomMachineName() . '@example.com';
     $user_a->save();
     $user_b = $this->drupalCreateUser(array('administer taxonomy'));
     $user_c = $this->drupalCreateUser(array('administer taxonomy'));
@@ -135,15 +135,15 @@ function testNotificationEmailAddress() {
       ->save();
     // Set the site and notification email addresses.
     $system = \Drupal::config('system.site');
-    $server_address = $this->randomName() . '@example.com';
-    $notify_address = $this->randomName() . '@example.com';
+    $server_address = $this->randomMachineName() . '@example.com';
+    $notify_address = $this->randomMachineName() . '@example.com';
     $system
       ->set('mail', $server_address)
       ->set('mail_notification', $notify_address)
       ->save();
     // Register a new user account.
     $edit = array();
-    $edit['name'] = $name = $this->randomName();
+    $edit['name'] = $name = $this->randomMachineName();
     $edit['mail'] = $mail = $edit['name'] . '@example.com';
     $this->drupalPostForm('user/register', $edit, t('Create new account'));
     $subject = 'Account details for ' . $edit['name'] . ' at ' . $system->get('name') . ' (pending admin approval)';
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php b/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php
index edd4ea1..d1b4c15 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php
@@ -204,8 +204,8 @@ function testUserBlockUnpublish() {
     $node = $this->drupalCreateNode($settings);
 
     // Add a comment to the page.
-    $comment_subject = $this->randomName(8);
-    $comment_body = $this->randomName(8);
+    $comment_subject = $this->randomMachineName(8);
+    $comment_body = $this->randomMachineName(8);
     $comment = entity_create('comment', array(
       'subject' => $comment_subject,
       'comment_body' => $comment_body,
@@ -319,8 +319,8 @@ function testUserDelete() {
 
     // Create comment.
     $edit = array();
-    $edit['subject'] = $this->randomName(8);
-    $edit['comment_body[0][value]'] = $this->randomName(16);
+    $edit['subject'] = $this->randomMachineName(8);
+    $edit['comment_body[0][value]'] = $this->randomMachineName(16);
 
     $this->drupalPostForm('comment/reply/node/' . $node->id() . '/comment', $edit, t('Preview'));
     $this->drupalPostForm(NULL, array(), t('Save'));
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserCreateFailMailTest.php b/core/modules/user/lib/Drupal/user/Tests/UserCreateFailMailTest.php
index 5a7dabe..4911baf 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserCreateFailMailTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserCreateFailMailTest.php
@@ -39,10 +39,10 @@ protected function testUserAdd() {
     // Replace the mail functionality with a fake, malfunctioning service.
     \Drupal::config('system.mail')->set('interface.default', 'test_php_mail_failure')->save();
     // Create a user, but fail to send an email.
-    $name = $this->randomName();
+    $name = $this->randomMachineName();
     $edit = array(
       'name' => $name,
-      'mail' => $this->randomName() . '@example.com',
+      'mail' => $this->randomMachineName() . '@example.com',
       'pass[pass1]' => $pass = $this->randomString(),
       'pass[pass2]' => $pass,
       'notify' => TRUE,
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserCreateTest.php b/core/modules/user/lib/Drupal/user/Tests/UserCreateTest.php
index 7ba715d..79423ae 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserCreateTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserCreateTest.php
@@ -92,10 +92,10 @@ protected function testUserAdd() {
     // We create two users, notifying one and not notifying the other, to
     // ensure that the tests work in both cases.
     foreach (array(FALSE, TRUE) as $notify) {
-      $name = $this->randomName();
+      $name = $this->randomMachineName();
       $edit = array(
         'name' => $name,
-        'mail' => $this->randomName() . '@example.com',
+        'mail' => $this->randomMachineName() . '@example.com',
         'pass[pass1]' => $pass = $this->randomString(),
         'pass[pass2]' => $pass,
         'notify' => $notify,
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserEditTest.php b/core/modules/user/lib/Drupal/user/Tests/UserEditTest.php
index 105fdea..f4f96e4 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserEditTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserEditTest.php
@@ -39,11 +39,11 @@ function testUserEdit() {
     // Check that filling out a single password field does not validate.
     $edit = array();
     $edit['pass[pass1]'] = '';
-    $edit['pass[pass2]'] = $this->randomName();
+    $edit['pass[pass2]'] = $this->randomMachineName();
     $this->drupalPostForm("user/" . $user1->id() . "/edit", $edit, t('Save'));
     $this->assertText(t("The specified passwords do not match."), 'Typing mismatched passwords displays an error message.');
 
-    $edit['pass[pass1]'] = $this->randomName();
+    $edit['pass[pass1]'] = $this->randomMachineName();
     $edit['pass[pass2]'] = '';
     $this->drupalPostForm("user/" . $user1->id() . "/edit", $edit, t('Save'));
     $this->assertText(t("The specified passwords do not match."), 'Typing mismatched passwords displays an error message.');
@@ -51,7 +51,7 @@ function testUserEdit() {
     // Test that the error message appears when attempting to change the mail or
     // pass without the current password.
     $edit = array();
-    $edit['mail'] = $this->randomName() . '@new.example.com';
+    $edit['mail'] = $this->randomMachineName() . '@new.example.com';
     $this->drupalPostForm("user/" . $user1->id() . "/edit", $edit, t('Save'));
     $this->assertRaw(t("Your current password is missing or incorrect; it's required to change the %name.", array('%name' => t('E-mail address'))));
 
@@ -61,7 +61,7 @@ function testUserEdit() {
 
     // Test that the user must enter current password before changing passwords.
     $edit = array();
-    $edit['pass[pass1]'] = $new_pass = $this->randomName();
+    $edit['pass[pass1]'] = $new_pass = $this->randomMachineName();
     $edit['pass[pass2]'] = $new_pass;
     $this->drupalPostForm("user/" . $user1->id() . "/edit", $edit, t('Save'));
     $this->assertRaw(t("Your current password is missing or incorrect; it's required to change the %name.", array('%name' => t('Password'))));
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserEditedOwnAccountTest.php b/core/modules/user/lib/Drupal/user/Tests/UserEditedOwnAccountTest.php
index 151ba88..a333a20 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserEditedOwnAccountTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserEditedOwnAccountTest.php
@@ -33,7 +33,7 @@ function testUserEditedOwnAccount() {
 
     // Change own username.
     $edit = array();
-    $edit['name'] = $this->randomName();
+    $edit['name'] = $this->randomMachineName();
     $this->drupalPostForm('user/' . $account->id() . '/edit', $edit, t('Save'));
 
     // Log out.
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserEntityCallbacksTest.php b/core/modules/user/lib/Drupal/user/Tests/UserEntityCallbacksTest.php
index 2b90534..f11010f 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserEntityCallbacksTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserEntityCallbacksTest.php
@@ -48,7 +48,7 @@ function testLabelCallback() {
     $this->assertEqual($this->account->label(), $this->account->getUsername(), 'The username should be used as label');
 
     // Setup a random anonymous name to be sure the name is used.
-    $name = $this->randomName();
+    $name = $this->randomMachineName();
     \Drupal::config('user.settings')->set('anonymous', $name)->save();
     $this->assertEqual($this->anonymous->label(), $name, 'The variable anonymous should be used for name of uid 0');
   }
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserLanguageCreationTest.php b/core/modules/user/lib/Drupal/user/Tests/UserLanguageCreationTest.php
index dbf80e4..6753b55 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserLanguageCreationTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserLanguageCreationTest.php
@@ -57,10 +57,10 @@ function testLocalUserCreation() {
 
     // Create a user with the admin/people/create form and check if the correct
     // language is set.
-    $username = $this->randomName(10);
+    $username = $this->randomMachineName(10);
     $edit = array(
       'name' => $username,
-      'mail' => $this->randomName(4) . '@example.com',
+      'mail' => $this->randomMachineName(4) . '@example.com',
       'pass[pass1]' => $username,
       'pass[pass2]' => $username,
     );
@@ -77,10 +77,10 @@ function testLocalUserCreation() {
     $this->drupalGet($langcode . '/user/register');
     $this->assertNoFieldByName('language[fr]', 'Language selector is not accessible.');
 
-    $username = $this->randomName(10);
+    $username = $this->randomMachineName(10);
     $edit = array(
       'name' => $username,
-      'mail' => $this->randomName(4) . '@example.com',
+      'mail' => $this->randomMachineName(4) . '@example.com',
     );
 
     $this->drupalPostForm($langcode . '/user/register', $edit, t('Create new account'));
@@ -98,7 +98,7 @@ function testLocalUserCreation() {
     $this->assertOptionSelected("edit-preferred-langcode", $langcode, 'Language selector is accessible and correct language is selected.');
 
     // Set pass_raw so we can login the new user.
-    $user->pass_raw = $this->randomName(10);
+    $user->pass_raw = $this->randomMachineName(10);
     $edit = array(
       'pass[pass1]' => $user->pass_raw,
       'pass[pass2]' => $user->pass_raw,
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserLanguageTest.php b/core/modules/user/lib/Drupal/user/Tests/UserLanguageTest.php
index 0d2fee7..ff1037f 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserLanguageTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserLanguageTest.php
@@ -43,7 +43,7 @@ function testUserLanguageConfiguration() {
     // Code for the language.
     $langcode = 'xx';
     // The English name for the language.
-    $name = $this->randomName(16);
+    $name = $this->randomMachineName(16);
     $edit = array(
       'predefined_langcode' => 'custom',
       'langcode' => $langcode,
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserPasswordResetTest.php b/core/modules/user/lib/Drupal/user/Tests/UserPasswordResetTest.php
index 8b4da13..7eb427b 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserPasswordResetTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserPasswordResetTest.php
@@ -56,7 +56,7 @@ function testUserPasswordReset() {
     // Try to reset the password for an invalid account.
     $this->drupalGet('user/password');
 
-    $edit = array('name' => $this->randomName(32));
+    $edit = array('name' => $this->randomMachineName(32));
     $this->drupalPostForm(NULL, $edit, t('E-mail new password'));
 
     $this->assertText(t('Sorry, @name is not recognized as a username or an e-mail address.', array('@name' => $edit['name'])), 'Validation error message shown when trying to request password for invalid account.');
@@ -133,8 +133,8 @@ public function getResetURL() {
   public function testUserResetPasswordTextboxFilled() {
     $this->drupalGet('user/login');
     $edit = array(
-      'name' => $this->randomName(),
-      'pass' => $this->randomName(),
+      'name' => $this->randomMachineName(),
+      'pass' => $this->randomMachineName(),
     );
     $this->drupalPostForm('user', $edit, t('Log in'));
     $this->assertRaw(t('Sorry, unrecognized username or password. <a href="@password">Have you forgotten your password?</a>',
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserRegistrationTest.php b/core/modules/user/lib/Drupal/user/Tests/UserRegistrationTest.php
index 15e75bf..6343c44 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserRegistrationTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserRegistrationTest.php
@@ -41,7 +41,7 @@ function testRegistrationWithEmailVerification() {
     // Allow registration by site visitors without administrator approval.
     $config->set('register', USER_REGISTER_VISITORS)->save();
     $edit = array();
-    $edit['name'] = $name = $this->randomName();
+    $edit['name'] = $name = $this->randomMachineName();
     $edit['mail'] = $mail = $edit['name'] . '@example.com';
     $this->drupalPostForm('user/register', $edit, t('Create new account'));
     $this->assertText(t('A welcome message with further instructions has been sent to your e-mail address.'), 'User registered successfully.');
@@ -52,7 +52,7 @@ function testRegistrationWithEmailVerification() {
     // Allow registration by site visitors, but require administrator approval.
     $config->set('register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)->save();
     $edit = array();
-    $edit['name'] = $name = $this->randomName();
+    $edit['name'] = $name = $this->randomMachineName();
     $edit['mail'] = $mail = $edit['name'] . '@example.com';
     $this->drupalPostForm('user/register', $edit, t('Create new account'));
     $this->container->get('entity.manager')->getStorage('user')->resetCache();
@@ -71,7 +71,7 @@ function testRegistrationWithoutEmailVerification() {
       ->save();
 
     $edit = array();
-    $edit['name'] = $name = $this->randomName();
+    $edit['name'] = $name = $this->randomMachineName();
     $edit['mail'] = $mail = $edit['name'] . '@example.com';
 
     // Try entering a mismatching password.
@@ -81,7 +81,7 @@ function testRegistrationWithoutEmailVerification() {
     $this->assertText(t('The specified passwords do not match.'), 'Typing mismatched passwords displays an error message.');
 
     // Enter a correct password.
-    $edit['pass[pass1]'] = $new_pass = $this->randomName();
+    $edit['pass[pass1]'] = $new_pass = $this->randomMachineName();
     $edit['pass[pass2]'] = $new_pass;
     $this->drupalPostForm('user/register', $edit, t('Create new account'));
     $this->container->get('entity.manager')->getStorage('user')->resetCache();
@@ -94,9 +94,9 @@ function testRegistrationWithoutEmailVerification() {
     // Allow registration by site visitors, but require administrator approval.
     $config->set('register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)->save();
     $edit = array();
-    $edit['name'] = $name = $this->randomName();
+    $edit['name'] = $name = $this->randomMachineName();
     $edit['mail'] = $mail = $edit['name'] . '@example.com';
-    $edit['pass[pass1]'] = $pass = $this->randomName();
+    $edit['pass[pass1]'] = $pass = $this->randomMachineName();
     $edit['pass[pass2]'] = $pass;
     $this->drupalPostForm('user/register', $edit, t('Create new account'));
     $this->assertText(t('Thank you for applying for an account. Your account is currently pending approval by the site administrator.'), 'Users are notified of pending approval');
@@ -137,7 +137,7 @@ function testRegistrationEmailDuplicates() {
     $duplicate_user = $this->drupalCreateUser();
 
     $edit = array();
-    $edit['name'] = $this->randomName();
+    $edit['name'] = $this->randomMachineName();
     $edit['mail'] = $duplicate_user->getEmail();
 
     // Attempt to create a new account using an existing e-mail address.
@@ -171,9 +171,9 @@ function testRegistrationDefaultValues() {
     $this->assertNoRaw('<details id="edit-account"><summary>Account information</summary>');
 
     $edit = array();
-    $edit['name'] = $name = $this->randomName();
+    $edit['name'] = $name = $this->randomMachineName();
     $edit['mail'] = $mail = $edit['name'] . '@example.com';
-    $edit['pass[pass1]'] = $new_pass = $this->randomName();
+    $edit['pass[pass1]'] = $new_pass = $this->randomMachineName();
     $edit['pass[pass2]'] = $new_pass;
     $this->drupalPostForm(NULL, $edit, t('Create new account'));
 
@@ -231,7 +231,7 @@ function testRegistrationWithUserFields() {
 
     // Check that validation errors are correctly reported.
     $edit = array();
-    $edit['name'] = $name = $this->randomName();
+    $edit['name'] = $name = $this->randomMachineName();
     $edit['mail'] = $mail = $edit['name'] . '@example.com';
     // Missing input in required field.
     $edit['test_user_field[0][value]'] = '';
@@ -271,7 +271,7 @@ function testRegistrationWithUserFields() {
       // Submit with three values.
       $edit['test_user_field[1][value]'] = $value + 1;
       $edit['test_user_field[2][value]'] = $value + 2;
-      $edit['name'] = $name = $this->randomName();
+      $edit['name'] = $name = $this->randomMachineName();
       $edit['mail'] = $mail = $edit['name'] . '@example.com';
       $this->drupalPostForm(NULL, $edit, t('Create new account'));
       // Check user fields.
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserRolesAssignmentTest.php b/core/modules/user/lib/Drupal/user/Tests/UserRolesAssignmentTest.php
index 99133ea..52f0ab0 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserRolesAssignmentTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserRolesAssignmentTest.php
@@ -58,8 +58,8 @@ function testCreateUserWithRole() {
     $rid = $this->drupalCreateRole(array('administer users'));
     // Create a new user and add the role at the same time.
     $edit = array(
-      'name' => $this->randomName(),
-      'mail' => $this->randomName() . '@example.com',
+      'name' => $this->randomMachineName(),
+      'mail' => $this->randomMachineName() . '@example.com',
       'pass[pass1]' => $pass = $this->randomString(),
       'pass[pass2]' => $pass,
       "roles[$rid]" => $rid,
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserSaveTest.php b/core/modules/user/lib/Drupal/user/Tests/UserSaveTest.php
index 3f9f11d..388dce3 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserSaveTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserSaveTest.php
@@ -29,7 +29,7 @@ function testUserImport() {
     // User ID must be a number that is not in the database.
     $max_uid = db_query('SELECT MAX(uid) FROM {users}')->fetchField();
     $test_uid = $max_uid + mt_rand(1000, 1000000);
-    $test_name = $this->randomName();
+    $test_name = $this->randomMachineName();
 
     // Create the base user, based on drupalCreateUser().
     $user = entity_create('user', array(
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php b/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php
index 74a1712..4d4e4c2 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php
@@ -91,7 +91,7 @@ function testUserSignature() {
 
     // Log in as a regular user and create a signature.
     $this->drupalLogin($this->web_user);
-    $signature_text = "<h1>" . $this->randomName() . "</h1>";
+    $signature_text = "<h1>" . $this->randomMachineName() . "</h1>";
     $edit = array(
       'signature[value]' => $signature_text,
     );
@@ -102,8 +102,8 @@ function testUserSignature() {
 
     // Create a comment.
     $edit = array();
-    $edit['subject'] = $this->randomName(8);
-    $edit['comment_body[0][value]'] = $this->randomName(16);
+    $edit['subject'] = $this->randomMachineName(8);
+    $edit['comment_body[0][value]'] = $this->randomMachineName(16);
     $this->drupalPostForm('comment/reply/node/' . $node->id() .'/comment', $edit, t('Preview'));
     $this->drupalPostForm(NULL, array(), t('Save'));
 
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserTranslationUITest.php b/core/modules/user/lib/Drupal/user/Tests/UserTranslationUITest.php
index 22ff1f9..3d04d0c 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserTranslationUITest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserTranslationUITest.php
@@ -37,7 +37,7 @@ public static function getInfo() {
   function setUp() {
     $this->entityTypeId = 'user';
     $this->testLanguageSelector = FALSE;
-    $this->name = $this->randomName();
+    $this->name = $this->randomMachineName();
     parent::setUp();
 
     entity_get_controller('user')->resetCache();
@@ -65,7 +65,7 @@ function testTranslateLinkUserAdminPage() {
     $this->admin_user = $this->drupalCreateUser(array_merge(parent::getTranslatorPermissions(), array('access administration pages', 'administer users')));
     $this->drupalLogin($this->admin_user);
 
-    $uid = $this->createEntity(array('name' => $this->randomName()), $this->langcodes[0]);
+    $uid = $this->createEntity(array('name' => $this->randomMachineName()), $this->langcodes[0]);
 
     // Verify translation links.
     $this->drupalGet('admin/people');
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserValidationTest.php b/core/modules/user/lib/Drupal/user/Tests/UserValidationTest.php
index 7beec6a..6834284 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserValidationTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserValidationTest.php
@@ -79,7 +79,7 @@ function testValidation() {
 
     // Only test one example invalid name here, the rest is already covered in
     // the testUsernames() method in this class.
-    $name = $this->randomName(61);
+    $name = $this->randomMachineName(61);
     $user->set('name', $name);
     $violations = $user->validate();
     $this->assertEqual(count($violations), 1, 'Violation found when name is too long.');
@@ -99,7 +99,7 @@ function testValidation() {
     $this->assertEqual($violations[0]->getMessage(), t('The name %name is already taken.', array('%name' => 'existing')));
 
     // Make the name valid.
-    $user->set('name', $this->randomName());
+    $user->set('name', $this->randomMachineName());
 
     $user->set('mail', 'invalid');
     $violations = $user->validate();
@@ -107,7 +107,7 @@ function testValidation() {
     $this->assertEqual($violations[0]->getPropertyPath(), 'mail.0.value');
     $this->assertEqual($violations[0]->getMessage(), t('This value is not a valid email address.'));
 
-    $mail = $this->randomName(EMAIL_MAX_LENGTH - 11) . '@example.com';
+    $mail = $this->randomMachineName(EMAIL_MAX_LENGTH - 11) . '@example.com';
     $user->set('mail', $mail);
     $violations = $user->validate();
     // @todo There are two violations because EmailItem::getConstraints()
diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentValidateTest.php b/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentValidateTest.php
index 76405de..29ec1db 100644
--- a/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentValidateTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentValidateTest.php
@@ -64,7 +64,7 @@ public function testArgumentValidateUserName() {
     // Reset argument validation.
     $view->argument['null']->argument_validated = NULL;
     // Fail for a valid string, but for a user that doesn't exist
-    $this->assertFalse($view->argument['null']->validateArgument($this->randomName()));
+    $this->assertFalse($view->argument['null']->validateArgument($this->randomMachineName()));
   }
 
 }
diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFieldRoleTest.php b/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFieldRoleTest.php
index b9b9791..3d6d207 100644
--- a/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFieldRoleTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFieldRoleTest.php
@@ -33,13 +33,13 @@ public static function getInfo() {
 
   public function testRole() {
     // Create a couple of roles for the view.
-    $rolename_a = 'a' . $this->randomName(8);
+    $rolename_a = 'a' . $this->randomMachineName(8);
     $this->drupalCreateRole(array('access content'), $rolename_a, $rolename_a, 9);
 
-    $rolename_b = 'b' . $this->randomName(8);
+    $rolename_b = 'b' . $this->randomMachineName(8);
     $this->drupalCreateRole(array('access content'), $rolename_b, $rolename_b, 8);
 
-    $rolename_not_assigned = $this->randomName(8);
+    $rolename_not_assigned = $this->randomMachineName(8);
     $this->drupalCreateRole(array('access content'), $rolename_not_assigned, $rolename_not_assigned);
 
     // Add roles to user 1.
diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFieldUserNameTest.php b/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFieldUserNameTest.php
index 4b1e9f9..e548fe6 100644
--- a/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFieldUserNameTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFieldUserNameTest.php
@@ -40,14 +40,14 @@ public function testUserName() {
     $view->row_index = 0;
 
     $view->field['name']->options['link_to_user'] = TRUE;
-    $username = $view->result[0]->users_name = $this->randomName();
+    $username = $view->result[0]->users_name = $this->randomMachineName();
     $view->result[0]->uid = 1;
     $render = $view->field['name']->advancedRender($view->result[0]);
     $this->assertTrue(strpos($render, $username) !== FALSE, 'If link to user is checked the username should be part of the output.');
     $this->assertTrue(strpos($render, 'user/1') !== FALSE, 'If link to user is checked the link to the user should appear as well.');
 
     $view->field['name']->options['link_to_user'] = FALSE;
-    $username = $view->result[0]->users_name = $this->randomName();
+    $username = $view->result[0]->users_name = $this->randomMachineName();
     $view->result[0]->uid = 1;
     $render = $view->field['name']->advancedRender($view->result[0]);
     $this->assertIdentical($render, $username, 'If the user is not linked the username should be printed out for a normal user.');
@@ -59,7 +59,7 @@ public function testUserName() {
     $this->assertIdentical($render, $anon_name , 'For user0 it should use the default anonymous name by default.');
 
     $view->field['name']->options['overwrite_anonymous'] = TRUE;
-    $anon_name = $view->field['name']->options['anonymous_text'] = $this->randomName();
+    $anon_name = $view->field['name']->options['anonymous_text'] = $this->randomMachineName();
     $render = $view->field['name']->advancedRender($view->result[0]);
     $this->assertIdentical($render, $anon_name , 'For user0 it should use the configured anonymous text if overwrite_anonymous is checked.');
   }
diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFilterUserNameTest.php b/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFilterUserNameTest.php
index a498d37..e12834b 100644
--- a/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFilterUserNameTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFilterUserNameTest.php
@@ -103,7 +103,7 @@ public function testAdminUserInterface() {
     $this->drupalGet($path);
 
     // Pass in an invalid username, the validation should catch it.
-    $users = array($this->randomName());
+    $users = array($this->randomMachineName());
     $users = array_map('strtolower', $users);
     $edit = array(
       'options[value]' => implode(', ', $users)
@@ -113,7 +113,7 @@ public function testAdminUserInterface() {
     $this->assertText($message);
 
     // Pass in an invalid username and a valid username.
-    $random_name = $this->randomName();
+    $random_name = $this->randomMachineName();
     $users = array($random_name, $this->names[0]);
     $users = array_map('strtolower', $users);
     $edit = array(
@@ -144,7 +144,7 @@ public function testExposedFilter() {
     $options = array();
 
     // Pass in an invalid username, the validation should catch it.
-    $users = array($this->randomName());
+    $users = array($this->randomMachineName());
     $users = array_map('strtolower', $users);
     $options['query']['uid'] = implode(', ', $users);
     $this->drupalGet($path, $options);
@@ -152,7 +152,7 @@ public function testExposedFilter() {
     $this->assertRaw($message);
 
     // Pass in an invalid username and a valid username.
-    $users = array($this->randomName(), $this->names[0]);
+    $users = array($this->randomMachineName(), $this->names[0]);
     $options['query']['uid'] = implode(', ', $users);
     $users = array_map('strtolower', $users);
     $users = array($users[0]);
diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/UserDataTest.php b/core/modules/user/lib/Drupal/user/Tests/Views/UserDataTest.php
index 7813dd7..537020c 100644
--- a/core/modules/user/lib/Drupal/user/Tests/Views/UserDataTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/Views/UserDataTest.php
@@ -44,7 +44,7 @@ public static function getInfo() {
   public function testDataField() {
     // But some random values into the user data service.
     $this->userData = $this->container->get('user.data');
-    $random_value = $this->randomName();
+    $random_value = $this->randomMachineName();
     $this->userData->set('views_test_config', $this->users[0]->id(), 'test_value_name', $random_value);
 
     $view = Views::getView('test_user_data');
@@ -53,7 +53,7 @@ public function testDataField() {
     $output = $view->field['data']->render($view->result[0]);
     $this->assertEqual($output, $random_value, 'A valid user data got rendered.');
 
-    $view->field['data']->options['data_name'] = $this->randomName();
+    $view->field['data']->options['data_name'] = $this->randomMachineName();
     $output = $view->field['data']->render($view->result[0]);
     $this->assertFalse($output, 'An invalid configuration does not return anything');
 
diff --git a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php
index 6e74149..05cec98 100644
--- a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php
@@ -51,9 +51,9 @@ protected function setUp() {
     $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
 
     $this->vocabulary = entity_create('taxonomy_vocabulary', array(
-      'name' => $this->randomName(),
-      'description' => $this->randomName(),
-      'vid' => drupal_strtolower($this->randomName()),
+      'name' => $this->randomMachineName(),
+      'description' => $this->randomMachineName(),
+      'vid' => drupal_strtolower($this->randomMachineName()),
       'langcode' => Language::LANGCODE_NOT_SPECIFIED,
       'help' => '',
       'nodes' => array('page' => 'page'),
@@ -62,7 +62,7 @@ protected function setUp() {
     $this->vocabulary->save();
 
     // Setup a field and instance.
-    $this->field_name = drupal_strtolower($this->randomName());
+    $this->field_name = drupal_strtolower($this->randomMachineName());
     entity_create('field_config', array(
       'name' => $this->field_name,
       'entity_type' => 'node',
@@ -159,8 +159,8 @@ function createTerm($vocabulary) {
     $filter_formats = filter_formats();
     $format = array_pop($filter_formats);
     $term = entity_create('taxonomy_term', array(
-      'name' => $this->randomName(),
-      'description' => $this->randomName(),
+      'name' => $this->randomMachineName(),
+      'description' => $this->randomMachineName(),
       // Use the first available text format.
       'format' => $format->format,
       'vid' => $vocabulary->id(),
diff --git a/core/modules/views/lib/Drupal/views/Tests/Entity/FieldEntityTest.php b/core/modules/views/lib/Drupal/views/Tests/Entity/FieldEntityTest.php
index 9d9a03a..7054ed4 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Entity/FieldEntityTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Entity/FieldEntityTest.php
@@ -44,7 +44,7 @@ public function testGetEntity() {
     // The view is a view of comments, their nodes and their authors, so there
     // are three layers of entities.
 
-    $account = entity_create('user', array('name' => $this->randomName(), 'bundle' => 'user'));
+    $account = entity_create('user', array('name' => $this->randomMachineName(), 'bundle' => 'user'));
     $account->save();
     $this->drupalCreateContentType(array('type' => 'page'));
     $this->container->get('comment.manager')->addDefaultField('node', 'page');
diff --git a/core/modules/views/lib/Drupal/views/Tests/Entity/FilterEntityBundleTest.php b/core/modules/views/lib/Drupal/views/Tests/Entity/FilterEntityBundleTest.php
index d950a6a..813099a 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Entity/FilterEntityBundleTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Entity/FilterEntityBundleTest.php
@@ -63,7 +63,7 @@ public function setUp() {
 
     foreach ($this->entityBundles as $key => $info) {
       for ($i = 0; $i < 5; $i++) {
-        $entity = entity_create('node', array('label' => $this->randomName(), 'uid' => 1, 'type' => $key));
+        $entity = entity_create('node', array('label' => $this->randomMachineName(), 'uid' => 1, 'type' => $key));
         $entity->save();
         $this->entities[$key][$entity->id()] = $entity;
         $this->entities['count']++;
diff --git a/core/modules/views/lib/Drupal/views/Tests/Entity/RowEntityRenderersTest.php b/core/modules/views/lib/Drupal/views/Tests/Entity/RowEntityRenderersTest.php
index 1694fd0..e35eab4 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Entity/RowEntityRenderersTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Entity/RowEntityRenderersTest.php
@@ -91,7 +91,7 @@ public function testRenderers() {
 
       foreach ($langcodes as $langcode) {
         // Ensure we have a predictable result order.
-        $values[$i][$langcode] = $i . '-' . $langcode . '-' . $this->randomName();
+        $values[$i][$langcode] = $i . '-' . $langcode . '-' . $this->randomMachineName();
 
         if ($langcode != $default_langcode) {
           $node->addTranslation($langcode, array('title' => $values[$i][$langcode]));
diff --git a/core/modules/views/lib/Drupal/views/Tests/Entity/ViewEntityDependenciesTest.php b/core/modules/views/lib/Drupal/views/Tests/Entity/ViewEntityDependenciesTest.php
index 082f352..474ce22 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Entity/ViewEntityDependenciesTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Entity/ViewEntityDependenciesTest.php
@@ -43,7 +43,7 @@ public static function getInfo() {
   public function testCalculateDependencies() {
     // The view is a view of comments, their nodes and their authors, so there
     // are three layers of entities.
-    $account = entity_create('user', array('name' => $this->randomName(), 'bundle' => 'user'));
+    $account = entity_create('user', array('name' => $this->randomMachineName(), 'bundle' => 'user'));
     $account->save();
     $this->drupalCreateContentType(array('type' => 'page'));
     $this->container->get('comment.manager')->addDefaultField('node', 'page');
diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/AreaEntityTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/AreaEntityTest.php
index 5751042..06b5037 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Handler/AreaEntityTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Handler/AreaEntityTest.php
@@ -82,7 +82,7 @@ public function testEntityArea() {
 
     $entities = array();
     for ($i = 0; $i < 3; $i++) {
-      $random_label = $this->randomName();
+      $random_label = $this->randomMachineName();
       $data = array('bundle' => 'entity_test', 'name' => $random_label);
       $entity_test = $this->container->get('entity.manager')->getStorage('entity_test')->create($data);
       $entity_test->save();
diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTest.php
index 2fae9d3..19a439c 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTest.php
@@ -76,7 +76,7 @@ public function testUI() {
       $this->assertText('Test Example area');
 
       // Then setup a no empty label.
-      $labels[$type] = $this->randomName();
+      $labels[$type] = $this->randomMachineName();
       $this->drupalPostForm($edit_path, array('options[admin_label]' => $labels[$type]), t('Apply'));
       // Make sure that the new label appears on the site.
       $this->assertText($labels[$type]);
diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTextTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTextTest.php
index 2ac78f8..02d50aa 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTextTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Handler/AreaTextTest.php
@@ -46,7 +46,7 @@ public function testAreaText() {
     $view->setDisplay();
 
     // add a text header
-    $string = $this->randomName();
+    $string = $this->randomMachineName();
     $view->displayHandlers->get('default')->overrideOption('header', array(
       'area' => array(
         'id' => 'area',
diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/ArgumentStringTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/ArgumentStringTest.php
index 4f2a7bc..aa1d8ec 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Handler/ArgumentStringTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Handler/ArgumentStringTest.php
@@ -45,7 +45,7 @@ function testGlossary() {
     foreach (array('a', 'b', 'c') as $char) {
       for ($i = 0; $i < $counter; $i++) {
         $edit = array(
-          'title' => $char . $this->randomName(),
+          'title' => $char . $this->randomMachineName(),
         );
         $this->drupalCreateNode($edit);
       }
diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldCustomTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldCustomTest.php
index a761ce2..6e6a9c7 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldCustomTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldCustomTest.php
@@ -41,7 +41,7 @@ public function testFieldCustom() {
     $view->setDisplay();
 
     // Alter the text of the field to a random string.
-    $random = $this->randomName();
+    $random = $this->randomMachineName();
     $view->displayHandlers->get('default')->overrideOption('fields', array(
       'name' => array(
         'id' => 'name',
diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldUnitTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldUnitTest.php
index e7f780c..f995564 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldUnitTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldUnitTest.php
@@ -57,7 +57,7 @@ public function testRender() {
     $view = Views::getView('test_field_tokens');
     $this->executeView($view);
 
-    $random_text = $this->randomName();
+    $random_text = $this->randomMachineName();
     $view->field['job']->setTestValue($random_text);
     $this->assertEqual($view->field['job']->theme($view->result[0]), $random_text, 'Make sure the render method rendered the manual set value.');
   }
@@ -150,7 +150,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->randomName();
+    $id_field->options['alter']['text'] = $random_text = $this->randomMachineName();
     $output = $id_field->theme($row);
     $this->assertNotSubString($output, $random_text);
 
@@ -198,7 +198,7 @@ public function testFieldTokens() {
     $job_field->options['alter']['alter_text'] = TRUE;
     $job_field->options['alter']['text'] = '[test-token]';
 
-    $random_text = $this->randomName();
+    $random_text = $this->randomMachineName();
     $job_field->setTestValue($random_text);
     $output = $job_field->advancedRender($row);
     $this->assertSubString($output, $random_text, format_string('Make sure the self token (!value) appears in the output (!output)', array('!value' => $random_text, '!output' => $output)));
@@ -249,8 +249,8 @@ function _testHideIfEmpty() {
 
     $column_map_reversed = array_flip($this->column_map);
     $view->row_index = 0;
-    $random_name = $this->randomName();
-    $random_value = $this->randomName();
+    $random_name = $this->randomMachineName();
+    $random_value = $this->randomMachineName();
 
     // Test when results are not rewritten and empty values are not hidden.
     $view->field['name']->options['hide_alter_empty'] = FALSE;
@@ -468,7 +468,7 @@ function _testEmptyText() {
     $column_map_reversed = array_flip($this->column_map);
     $view->row_index = 0;
 
-    $empty_text = $view->field['name']->options['empty'] = $this->randomName();
+    $empty_text = $view->field['name']->options['empty'] = $this->randomMachineName();
     $view->result[0]->{$column_map_reversed['name']} = "";
     $render = $view->field['name']->advancedRender($view->result[0]);
     $this->assertIdentical($render, $empty_text, 'If a field is empty, the empty text should be used for the output.');
@@ -484,7 +484,7 @@ function _testEmptyText() {
 
     $view->result[0]->{$column_map_reversed['name']} = "";
     $view->field['name']->options['alter']['alter_text'] = TRUE;
-    $alter_text = $view->field['name']->options['alter']['text'] = $this->randomName();
+    $alter_text = $view->field['name']->options['alter']['text'] = $this->randomMachineName();
     $view->field['name']->options['hide_alter_empty'] = FALSE;
     $render = $view->field['name']->advancedRender($view->result[0]);
     $this->assertIdentical($render, $alter_text, 'If a field is empty, some rewrite text exists, but hide_alter_empty is not checked, render the rewrite text.');
diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldWebTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldWebTest.php
index dc9e3e8..d00b97d 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldWebTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldWebTest.php
@@ -186,11 +186,11 @@ public function testAlterUrl() {
 
     // Setup the general settings required to build a link.
     $id_field->options['alter']['make_link'] = TRUE;
-    $id_field->options['alter']['path'] = $path = $this->randomName();
+    $id_field->options['alter']['path'] = $path = $this->randomMachineName();
 
     // Tests that the suffix/prefix appears on the output.
-    $id_field->options['alter']['prefix'] = $prefix = $this->randomName();
-    $id_field->options['alter']['suffix'] = $suffix = $this->randomName();
+    $id_field->options['alter']['prefix'] = $prefix = $this->randomMachineName();
+    $id_field->options['alter']['suffix'] = $suffix = $this->randomMachineName();
     $output = $id_field->theme($row);
     $this->assertSubString($output, $prefix);
     $this->assertSubString($output, $suffix);
@@ -245,7 +245,7 @@ public function testAlterUrl() {
 
     // Tests the replace spaces with dashes feature.
     $id_field->options['alter']['replace_spaces'] = TRUE;
-    $id_field->options['alter']['path'] = $path = $this->randomName() . ' ' . $this->randomName();
+    $id_field->options['alter']['path'] = $path = $this->randomMachineName() . ' ' . $this->randomMachineName();
     $output = $id_field->theme($row);
     $this->assertSubString($output, str_replace(' ', '-', $path));
     $id_field->options['alter']['replace_spaces'] = FALSE;
@@ -267,7 +267,7 @@ public function testAlterUrl() {
     $this->assertNotSubString($output, 'http://drupal.org');
 
     // Tests the transforming of the case setting.
-    $id_field->options['alter']['path'] = $path = $this->randomName();
+    $id_field->options['alter']['path'] = $path = $this->randomMachineName();
     $id_field->options['alter']['path_case'] = 'none';
     $output = $id_field->theme($row);
     $this->assertSubString($output, $path);
@@ -292,7 +292,7 @@ public function testAlterUrl() {
     unset($id_field->options['alter']['path_case']);
 
     // Tests the linkclass setting and see whether it actuall exists in the output.
-    $id_field->options['alter']['link_class'] = $class = $this->randomName();
+    $id_field->options['alter']['link_class'] = $class = $this->randomMachineName();
     $output = $id_field->theme($row);
     $elements = $this->xpathContent($output, '//a[contains(@class, :class)]', array(':class' => $class));
     $this->assertTrue($elements);
@@ -300,21 +300,21 @@ public function testAlterUrl() {
     $id_field->options['alter']['link_class'] = '';
 
     // Tests the alt setting.
-    $id_field->options['alter']['alt'] = $rel = $this->randomName();
+    $id_field->options['alter']['alt'] = $rel = $this->randomMachineName();
     $output = $id_field->theme($row);
     $elements = $this->xpathContent($output, '//a[contains(@title, :alt)]', array(':alt' => $rel));
     $this->assertTrue($elements);
     $id_field->options['alter']['alt'] = '';
 
     // Tests the rel setting.
-    $id_field->options['alter']['rel'] = $rel = $this->randomName();
+    $id_field->options['alter']['rel'] = $rel = $this->randomMachineName();
     $output = $id_field->theme($row);
     $elements = $this->xpathContent($output, '//a[contains(@rel, :rel)]', array(':rel' => $rel));
     $this->assertTrue($elements);
     $id_field->options['alter']['rel'] = '';
 
     // Tests the target setting.
-    $id_field->options['alter']['target'] = $target = $this->randomName();
+    $id_field->options['alter']['target'] = $target = $this->randomMachineName();
     $output = $id_field->theme($row);
     $elements = $this->xpathContent($output, '//a[contains(@target, :target)]', array(':target' => $target));
     $this->assertTrue($elements);
@@ -346,7 +346,7 @@ public function testFieldClasses() {
     $this->assertTrue($this->xpathContent($output, '//div[contains(@class, :class)]', array(':class' => 'views-field')));
 
     // Tests the element wrapper classes/element.
-    $random_class = $this->randomName();
+    $random_class = $this->randomMachineName();
 
     // Set some common wrapper element types and see whether they appear with and without a custom class set.
     foreach (array('h1', 'span', 'p', 'div') as $element_type) {
@@ -438,7 +438,7 @@ public function testTextRendering() {
 
     // Tests stripping of html elements.
     $this->executeView($view);
-    $random_text = $this->randomName();
+    $random_text = $this->randomMachineName();
     $name_field->options['alter']['alter_text'] = TRUE;
     $name_field->options['alter']['text'] = $html_text = '<div class="views-test">' . $random_text . '</div>';
     $row = $view->result[0];
@@ -479,7 +479,7 @@ public function testTextRendering() {
     $name_field->options['alter']['word_boundary'] = FALSE;
 
     // Tests for simple trimming by string length.
-    $row->views_test_data_name = $this->randomName(8);
+    $row->views_test_data_name = $this->randomMachineName(8);
     $name_field->options['alter']['max_length'] = 5;
     $trimmed_name = drupal_substr($row->views_test_data_name, 0, 5);
 
@@ -494,9 +494,9 @@ public function testTextRendering() {
     // Take word_boundary into account for the tests.
     $name_field->options['alter']['max_length'] = 5;
     $name_field->options['alter']['word_boundary'] = TRUE;
-    $random_text_2 = $this->randomName(2);
-    $random_text_4 = $this->randomName(4);
-    $random_text_8 = $this->randomName(8);
+    $random_text_2 = $this->randomMachineName(2);
+    $random_text_4 = $this->randomMachineName(4);
+    $random_text_8 = $this->randomMachineName(8);
     $touples = array(
       // Create one string which doesn't fit at all into the limit.
       array(
@@ -539,11 +539,11 @@ public function testTextRendering() {
     }
 
     // Tests for displaying a readmore link when the output got trimmed.
-    $row->views_test_data_name = $this->randomName(8);
+    $row->views_test_data_name = $this->randomMachineName(8);
     $name_field->options['alter']['max_length'] = 5;
     $name_field->options['alter']['more_link'] = TRUE;
-    $name_field->options['alter']['more_link_text'] = $more_text = $this->randomName();
-    $name_field->options['alter']['more_link_path'] = $more_path = $this->randomName();
+    $name_field->options['alter']['more_link_text'] = $more_text = $this->randomMachineName();
+    $name_field->options['alter']['more_link_path'] = $more_path = $this->randomMachineName();
 
     $output = $name_field->advancedRender($row);
     $this->assertSubString($output, $more_text, 'Make sure a read more text is displayed if the output got trimmed');
@@ -555,7 +555,7 @@ public function testTextRendering() {
     $this->assertFalse($this->xpathContent($output, '//a[contains(@href, :path)]', array(':path' => $more_path)), 'Make sure no read more link appears.');
 
     // Check for the ellipses.
-    $row->views_test_data_name = $this->randomName(8);
+    $row->views_test_data_name = $this->randomMachineName(8);
     $name_field->options['alter']['max_length'] = 5;
     $output = $name_field->advancedRender($row);
     $this->assertSubString($output, '...', 'An ellipsis should appear if the output is trimmed');
diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerTest.php
index 9a6e56b..274a8a7 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerTest.php
@@ -282,7 +282,7 @@ public function testSetRelationship() {
     $view = Views::getView('test_handler_relationships');
     $view->setDisplay();
     // Setup a broken relationship.
-    $view->addHandler('default', 'relationship', $this->randomName(), $this->randomName(), array(), 'broken_relationship');
+    $view->addHandler('default', 'relationship', $this->randomMachineName(), $this->randomMachineName(), array(), 'broken_relationship');
     // Setup a valid relationship.
     $view->addHandler('default', 'relationship', 'comment', 'node', array('relationship' => 'cid'), 'valid_relationship');
     $view->initHandlers();
@@ -292,7 +292,7 @@ public function testSetRelationship() {
     $field->setRelationship();
     $this->assertFalse($field->relationship, 'Make sure that an empty relationship does not create a relationship on the field.');
 
-    $field->options['relationship'] = $this->randomName();
+    $field->options['relationship'] = $this->randomMachineName();
     $field->setRelationship();
     $this->assertFalse($field->relationship, 'Make sure that a random relationship does not create a relationship on the field.');
 
@@ -334,8 +334,8 @@ public function testPlaceholder() {
 
     // Set another table/field combination and make sure there are new
     // placeholders.
-    $table = $handler->table = $this->randomName();
-    $field = $handler->field = $this->randomName();
+    $table = $handler->table = $this->randomMachineName();
+    $field = $handler->field = $this->randomMachineName();
     $string = ':' . $table . '_' . $field;
 
     // Make sure the placeholder variables are like expected.
diff --git a/core/modules/views/lib/Drupal/views/Tests/ModuleTest.php b/core/modules/views/lib/Drupal/views/Tests/ModuleTest.php
index e938a58..8209e30 100644
--- a/core/modules/views/lib/Drupal/views/Tests/ModuleTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/ModuleTest.php
@@ -49,8 +49,8 @@ public function testViewsGetHandler() {
     $types = array('field', 'area', 'filter');
     foreach ($types as $type) {
       $item = array(
-        'table' => $this->randomName(),
-        'field' => $this->randomName(),
+        'table' => $this->randomMachineName(),
+        'field' => $this->randomMachineName(),
       );
       $handler = $this->container->get('plugin.manager.views.' . $type)->getHandler($item);
       $this->assertEqual('Drupal\views\Plugin\views\\' . $type . '\Broken', get_class($handler), t('Make sure that a broken handler of type: @type are created', array('@type' => $type)));
diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/ArgumentDefaultTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/ArgumentDefaultTest.php
index 6f50fa3..04bdf72 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Plugin/ArgumentDefaultTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/ArgumentDefaultTest.php
@@ -111,7 +111,7 @@ function testArgumentDefaultNoOptions() {
    * Tests fixed default argument.
    */
   function testArgumentDefaultFixed() {
-    $random = $this->randomName();
+    $random = $this->randomMachineName();
     $view = Views::getView('test_argument_default_fixed');
     $view->setDisplay();
     $options = $view->display_handler->getOption('arguments');
@@ -122,7 +122,7 @@ function testArgumentDefaultFixed() {
     $this->assertEqual($view->argument['null']->getDefaultArgument(), $random, 'Fixed argument should be used by default.');
 
     // Make sure that a normal argument provided is used
-    $random_string = $this->randomName();
+    $random_string = $this->randomMachineName();
     $view->executeDisplay('default', array($random_string));
 
     $this->assertEqual($view->args[0], $random_string, 'Provided argument should be used.');
diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/BlockDependenciesTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/BlockDependenciesTest.php
index 42db1e0..63fa7cd 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Plugin/BlockDependenciesTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/BlockDependenciesTest.php
@@ -100,9 +100,9 @@ protected function createBlock($plugin_id, array $settings = array()) {
     $settings += array(
       'plugin' => $plugin_id,
       'region' => 'sidebar_first',
-      'id' => strtolower($this->randomName(8)),
+      'id' => strtolower($this->randomMachineName(8)),
       'theme' => \Drupal::config('system.theme')->get('default'),
-      'label' => $this->randomName(8),
+      'label' => $this->randomMachineName(8),
       'visibility' => array(),
       'weight' => 0,
       'cache' => array(
diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayFeedTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayFeedTest.php
index 34403c8..afed254 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayFeedTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayFeedTest.php
@@ -89,7 +89,7 @@ public function testFeedOutput() {
     $this->drupalCreateNode();
 
     // Test the site name setting.
-    $site_name = $this->randomName();
+    $site_name = $this->randomMachineName();
     $this->container->get('config.factory')->get('system.site')->set('name', $site_name)->save();
 
     $this->drupalGet('test-feed-display.xml');
diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/ExposedFormTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/ExposedFormTest.php
index 3a41e77..e682680 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Plugin/ExposedFormTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/ExposedFormTest.php
@@ -63,7 +63,7 @@ public function testSubmitButton() {
     $view->setDisplay();
 
     $exposed_form = $view->display_handler->getOption('exposed_form');
-    $exposed_form['options']['submit_button'] = $expected_label = $this->randomName();
+    $exposed_form['options']['submit_button'] = $expected_label = $this->randomMachineName();
     $view->display_handler->setOption('exposed_form', $exposed_form);
     $view->save();
 
@@ -111,7 +111,7 @@ public function testResetButton() {
     $view->setDisplay();
 
     $exposed_form = $view->display_handler->getOption('exposed_form');
-    $exposed_form['options']['reset_button_label'] = $expected_label = $this->randomName();
+    $exposed_form['options']['reset_button_label'] = $expected_label = $this->randomMachineName();
     $exposed_form['options']['reset_button'] = TRUE;
     $view->display_handler->setOption('exposed_form', $exposed_form);
     $view->save();
diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/JoinTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/JoinTest.php
index dfb470e..91ffadd 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Plugin/JoinTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/JoinTest.php
@@ -137,8 +137,8 @@ public function testBasePlugin() {
     $this->assertEqual($join_info['join type'], 'INNER');
 
     // Setup addition conditions and make sure it is used.
-    $random_name_1 = $this->randomName();
-    $random_name_2 = $this->randomName();
+    $random_name_1 = $this->randomMachineName();
+    $random_name_2 = $this->randomMachineName();
     $configuration['extra'] = array(
       array(
         'field' => 'name',
diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/RelationshipJoinTestBase.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/RelationshipJoinTestBase.php
index fae3515..def708a 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Plugin/RelationshipJoinTestBase.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/RelationshipJoinTestBase.php
@@ -32,7 +32,7 @@ protected function setUpFixtures() {
 
     // Create a record for uid 1.
     $this->installSchema('system', 'sequences');
-    $this->root_user = entity_create('user', array('name' => $this->randomName()));
+    $this->root_user = entity_create('user', array('name' => $this->randomMachineName()));
     $this->root_user->save();
   }
 
diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/RowEntityTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/RowEntityTest.php
index 0b406f5..32baba4 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Plugin/RowEntityTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/RowEntityTest.php
@@ -62,9 +62,9 @@ protected function setUp() {
    * Tests the entity row handler.
    */
   public function testEntityRow() {
-    $vocab = entity_create('taxonomy_vocabulary', array('name' => $this->randomName(), 'vid' => strtolower($this->randomName())));
+    $vocab = entity_create('taxonomy_vocabulary', array('name' => $this->randomMachineName(), 'vid' => strtolower($this->randomMachineName())));
     $vocab->save();
-    $term = entity_create('taxonomy_term', array('name' => $this->randomName(), 'vid' => $vocab->id() ));
+    $term = entity_create('taxonomy_term', array('name' => $this->randomMachineName(), 'vid' => $vocab->id() ));
     $term->save();
 
     $view = Views::getView('test_entity_row');
diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleTableUnitTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleTableUnitTest.php
index c7d0345..6528945 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleTableUnitTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleTableUnitTest.php
@@ -58,7 +58,7 @@ public function testTable() {
     $style_plugin->options['default'] = 'id';
     $this->assertTrue($style_plugin->buildSort(), 'If no order but a default order is specified, the normal sort should be used.');
 
-    $request->attributes->set('order', $this->randomName());
+    $request->attributes->set('order', $this->randomMachineName());
     $this->assertTrue($style_plugin->buildSort(), 'If no valid field is chosen for order, the normal sort should be used.');
 
     $request->attributes->set('order', 'id');
@@ -107,7 +107,7 @@ public function testTable() {
     $this->prepareView($view);
     $style_plugin = $view->style_plugin;
     $request->query->set('sort', 'asc');
-    $random_name = $this->randomName();
+    $random_name = $this->randomMachineName();
     $request->query->set('order', $random_name);
     $style_plugin->buildSortPost();
     $this->assertIdentical($style_plugin->order, 'asc', 'No sort order was set, when invalid sort order was specified.');
diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleTest.php
index b20afb6..a73334b 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/StyleTest.php
@@ -68,7 +68,7 @@ public function testStyle() {
     $view->style_plugin->init($view, $view->display_handler);
     $this->assertTrue($view->rowPlugin instanceof RowTest, 'Make sure the right row plugin class is loaded.');
 
-    $random_text = $this->randomName();
+    $random_text = $this->randomMachineName();
     $view->rowPlugin->setOutput($random_text);
 
     $output = $view->preview();
@@ -87,7 +87,7 @@ public function testStyle() {
     $this->assertTrue($view->style_plugin instanceof StyleTestPlugin, 'Make sure the right style plugin class is loaded.');
     $this->assertTrue($view->rowPlugin instanceof Fields, 'Make sure that rowPlugin is now a fields instance.');
 
-    $random_text = $this->randomName();
+    $random_text = $this->randomMachineName();
     // Set some custom text to the output and make sure that this value is
     // rendered.
     $view->style_plugin->setOutput($random_text);
@@ -178,14 +178,14 @@ function _testGrouping($stripped = FALSE) {
     if ($stripped) {
 
       // Add some html to the result and expected value.
-      $rand = '<a data="' . $this->randomName() . '" />';
+      $rand = '<a data="' . $this->randomMachineName() . '" />';
       $view->result[0]->views_test_data_job .= $rand;
       $expected['Job: Singer']['rows']['Age: 25']['rows'][0]->views_test_data_job = 'Singer' . $rand;
       $expected['Job: Singer']['group'] = 'Job: Singer';
-      $rand = '<a data="' . $this->randomName() . '" />';
+      $rand = '<a data="' . $this->randomMachineName() . '" />';
       $view->result[1]->views_test_data_job .= $rand;
       $expected['Job: Singer']['rows']['Age: 27']['rows'][1]->views_test_data_job = 'Singer' . $rand;
-      $rand = '<a data="' . $this->randomName() . '" />';
+      $rand = '<a data="' . $this->randomMachineName() . '" />';
       $view->result[2]->views_test_data_job .= $rand;
       $expected['Job: Drummer']['rows']['Age: 28']['rows'][2]->views_test_data_job = 'Drummer' . $rand;
       $expected['Job: Drummer']['group'] = 'Job: Drummer';
@@ -229,7 +229,7 @@ function testCustomRowClasses() {
 
     // Setup some random css class.
     $view->initStyle();
-    $random_name = $this->randomName();
+    $random_name = $this->randomMachineName();
     $view->style_plugin->options['row_class'] = $random_name . " test-token-[name]";
 
     $output = $view->preview();
diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php b/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php
index c0228ba..5929a1b 100644
--- a/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php
@@ -318,12 +318,12 @@ public function testPropertyMethods() {
     $this->assertEqual($view->generateHandlerId('test', $test_ids), 'test_2');
 
     // Test the getPath() method.
-    $path = $this->randomName();
+    $path = $this->randomMachineName();
     $view->displayHandlers->get('page_1')->overrideOption('path', $path);
     $view->setDisplay('page_1');
     $this->assertEqual($view->getPath(), $path);
     // Test the override_path property override.
-    $override_path = $this->randomName();
+    $override_path = $this->randomMachineName();
     $view->override_path = $override_path;
     $this->assertEqual($view->getPath(), $override_path);
 
diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewStorageTest.php b/core/modules/views/lib/Drupal/views/Tests/ViewStorageTest.php
index af0341a..5bafada 100644
--- a/core/modules/views/lib/Drupal/views/Tests/ViewStorageTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/ViewStorageTest.php
@@ -223,14 +223,14 @@ protected function displayMethodTests() {
 
     // Tests Drupal\views\Entity\View::addDisplay()
     $view = $this->controller->create(array());
-    $random_title = $this->randomName();
+    $random_title = $this->randomMachineName();
 
     $id = $view->addDisplay('page', $random_title);
     $this->assertEqual($id, 'page_1', format_string('Make sure the first display (%id_new) has the expected ID (%id)', array('%id_new' => $id, '%id' => 'page_1')));
     $display = $view->get('display');
     $this->assertEqual($display[$id]['display_title'], $random_title);
 
-    $random_title = $this->randomName();
+    $random_title = $this->randomMachineName();
     $id = $view->addDisplay('page', $random_title);
     $display = $view->get('display');
     $this->assertEqual($id, 'page_2', format_string('Make sure the second display (%id_new) has the expected ID (%id)', array('%id_new' => $id, '%id' => 'page_2')));
@@ -245,7 +245,7 @@ protected function displayMethodTests() {
     $displays = $view->get('display');
     $displays['default']['deleted'] = TRUE;
     $view->set('display', $displays);
-    $view->set('id', $this->randomName());
+    $view->set('id', $this->randomMachineName());
     $view->save();
     $view->addDisplay('default', $random_title);
     $displays = $view->get('display');
@@ -282,7 +282,7 @@ protected function displayMethodTests() {
 
     $options = array(
       'alter' => array(
-        'text' => $this->randomName()
+        'text' => $this->randomMachineName()
       )
     );
     $id2 = $view->addHandler($display_id, 'field', 'views_test_data', 'name', $options);
@@ -303,7 +303,7 @@ protected function displayMethodTests() {
     // and getItems.
     $item = array(
       'alter' => array(
-        'text' => $this->randomName(),
+        'text' => $this->randomMachineName(),
       )
     ) + $item1;
     $expected_items[$id1] = $item;
diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewsTaxonomyAutocompleteTest.php b/core/modules/views/lib/Drupal/views/Tests/ViewsTaxonomyAutocompleteTest.php
index 766ae49..f894e12 100644
--- a/core/modules/views/lib/Drupal/views/Tests/ViewsTaxonomyAutocompleteTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/ViewsTaxonomyAutocompleteTest.php
@@ -102,8 +102,8 @@ public function testTaxonomyAutocomplete() {
    */
   protected function createTerm($name = NULL) {
     $term = entity_create('taxonomy_term', array(
-      'name' => $name ?: $this->randomName(),
-      'description' => $this->randomName(),
+      'name' => $name ?: $this->randomMachineName(),
+      'description' => $this->randomMachineName(),
       'vid' => $this->vocabulary->id(),
       'langcode' => Language::LANGCODE_NOT_SPECIFIED,
     ));
diff --git a/core/modules/views/lib/Drupal/views/Tests/Wizard/BasicTest.php b/core/modules/views/lib/Drupal/views/Tests/Wizard/BasicTest.php
index be30330..a0efa3f 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Wizard/BasicTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Wizard/BasicTest.php
@@ -33,9 +33,9 @@ function testViewsWizardAndListing() {
 
     // Create a simple and not at all useful view.
     $view1 = array();
-    $view1['label'] = $this->randomName(16);
-    $view1['id'] = strtolower($this->randomName(16));
-    $view1['description'] = $this->randomName(16);
+    $view1['label'] = $this->randomMachineName(16);
+    $view1['id'] = strtolower($this->randomMachineName(16));
+    $view1['description'] = $this->randomMachineName(16);
     $view1['page[create]'] = FALSE;
     $this->drupalPostForm('admin/structure/views/add', $view1, t('Save and edit'));
     $this->assertResponse(200);
@@ -56,14 +56,14 @@ function testViewsWizardAndListing() {
 
     // Now create a page with simple node listing and an attached feed.
     $view2 = array();
-    $view2['label'] = $this->randomName(16);
-    $view2['id'] = strtolower($this->randomName(16));
-    $view2['description'] = $this->randomName(16);
+    $view2['label'] = $this->randomMachineName(16);
+    $view2['id'] = strtolower($this->randomMachineName(16));
+    $view2['description'] = $this->randomMachineName(16);
     $view2['page[create]'] = 1;
-    $view2['page[title]'] = $this->randomName(16);
-    $view2['page[path]'] = $this->randomName(16);
+    $view2['page[title]'] = $this->randomMachineName(16);
+    $view2['page[path]'] = $this->randomMachineName(16);
     $view2['page[feed]'] = 1;
-    $view2['page[feed_properties][path]'] = $this->randomName(16);
+    $view2['page[feed_properties][path]'] = $this->randomMachineName(16);
     $this->drupalPostForm('admin/structure/views/add', $view2, t('Save and edit'));
     $this->drupalGet($view2['page[path]']);
     $this->assertResponse(200);
@@ -98,16 +98,16 @@ function testViewsWizardAndListing() {
 
     // Create a view with a page and a block, and filter the listing.
     $view3 = array();
-    $view3['label'] = $this->randomName(16);
-    $view3['id'] = strtolower($this->randomName(16));
-    $view3['description'] = $this->randomName(16);
+    $view3['label'] = $this->randomMachineName(16);
+    $view3['id'] = strtolower($this->randomMachineName(16));
+    $view3['description'] = $this->randomMachineName(16);
     $view3['show[wizard_key]'] = 'node';
     $view3['show[type]'] = 'page';
     $view3['page[create]'] = 1;
-    $view3['page[title]'] = $this->randomName(16);
-    $view3['page[path]'] = $this->randomName(16);
+    $view3['page[title]'] = $this->randomMachineName(16);
+    $view3['page[path]'] = $this->randomMachineName(16);
     $view3['block[create]'] = 1;
-    $view3['block[title]'] = $this->randomName(16);
+    $view3['block[title]'] = $this->randomMachineName(16);
     $this->drupalPostForm('admin/structure/views/add', $view3, t('Save and edit'));
     $this->drupalGet($view3['page[path]']);
     $this->assertResponse(200);
@@ -159,12 +159,12 @@ protected function testWizardForm() {
    * @see \Drupal\views\Plugin\views\display\DisplayPluginBase::mergeDefaults().
    */
   public function testWizardDefaultValues() {
-    $random_id = strtolower($this->randomName(16));
+    $random_id = strtolower($this->randomMachineName(16));
     // Create a basic view.
     $view = array();
-    $view['label'] = $this->randomName(16);
+    $view['label'] = $this->randomMachineName(16);
     $view['id'] = $random_id;
-    $view['description'] = $this->randomName(16);
+    $view['description'] = $this->randomMachineName(16);
     $view['page[create]'] = FALSE;
     $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
 
diff --git a/core/modules/views/lib/Drupal/views/Tests/Wizard/ItemsPerPageTest.php b/core/modules/views/lib/Drupal/views/Tests/Wizard/ItemsPerPageTest.php
index 97accc8..fcbb4b0 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Wizard/ItemsPerPageTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Wizard/ItemsPerPageTest.php
@@ -40,18 +40,18 @@ function testItemsPerPage() {
     // Create a view that sorts newest first, and shows 4 items in the page and
     // 3 in the block.
     $view = array();
-    $view['label'] = $this->randomName(16);
-    $view['id'] = strtolower($this->randomName(16));
-    $view['description'] = $this->randomName(16);
+    $view['label'] = $this->randomMachineName(16);
+    $view['id'] = strtolower($this->randomMachineName(16));
+    $view['description'] = $this->randomMachineName(16);
     $view['show[wizard_key]'] = 'node';
     $view['show[type]'] = 'article';
     $view['show[sort]'] = 'node_field_data-created:DESC';
     $view['page[create]'] = 1;
-    $view['page[title]'] = $this->randomName(16);
-    $view['page[path]'] = $this->randomName(16);
+    $view['page[title]'] = $this->randomMachineName(16);
+    $view['page[path]'] = $this->randomMachineName(16);
     $view['page[items_per_page]'] = 4;
     $view['block[create]'] = 1;
-    $view['block[title]'] = $this->randomName(16);
+    $view['block[title]'] = $this->randomMachineName(16);
     $view['block[items_per_page]'] = 3;
     $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
     $this->drupalGet($view['page[path]']);
diff --git a/core/modules/views/lib/Drupal/views/Tests/Wizard/MenuTest.php b/core/modules/views/lib/Drupal/views/Tests/Wizard/MenuTest.php
index f294a89..17c041d 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Wizard/MenuTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Wizard/MenuTest.php
@@ -26,15 +26,15 @@ public static function getInfo() {
   function testMenus() {
     // Create a view with a page display and a menu link in the Main Menu.
     $view = array();
-    $view['label'] = $this->randomName(16);
-    $view['id'] = strtolower($this->randomName(16));
-    $view['description'] = $this->randomName(16);
+    $view['label'] = $this->randomMachineName(16);
+    $view['id'] = strtolower($this->randomMachineName(16));
+    $view['description'] = $this->randomMachineName(16);
     $view['page[create]'] = 1;
-    $view['page[title]'] = $this->randomName(16);
-    $view['page[path]'] = $this->randomName(16);
+    $view['page[title]'] = $this->randomMachineName(16);
+    $view['page[path]'] = $this->randomMachineName(16);
     $view['page[link]'] = 1;
     $view['page[link_properties][menu_name]'] = 'main';
-    $view['page[link_properties][title]'] = $this->randomName(16);
+    $view['page[link_properties][title]'] = $this->randomMachineName(16);
     $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
 
     // Make sure there is a link to the view from the front page (where we
diff --git a/core/modules/views/lib/Drupal/views/Tests/Wizard/SortingTest.php b/core/modules/views/lib/Drupal/views/Tests/Wizard/SortingTest.php
index 13b20d3..71c9281 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Wizard/SortingTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Wizard/SortingTest.php
@@ -32,13 +32,13 @@ function testSorting() {
 
     // Create a view that sorts oldest first.
     $view1 = array();
-    $view1['label'] = $this->randomName(16);
-    $view1['id'] = strtolower($this->randomName(16));
-    $view1['description'] = $this->randomName(16);
+    $view1['label'] = $this->randomMachineName(16);
+    $view1['id'] = strtolower($this->randomMachineName(16));
+    $view1['description'] = $this->randomMachineName(16);
     $view1['show[sort]'] = 'node_field_data-created:ASC';
     $view1['page[create]'] = 1;
-    $view1['page[title]'] = $this->randomName(16);
-    $view1['page[path]'] = $this->randomName(16);
+    $view1['page[title]'] = $this->randomMachineName(16);
+    $view1['page[path]'] = $this->randomMachineName(16);
     $this->drupalPostForm('admin/structure/views/add', $view1, t('Save and edit'));
     $this->drupalGet($view1['page[path]']);
     $this->assertResponse(200);
@@ -57,13 +57,13 @@ function testSorting() {
 
     // Create a view that sorts newest first.
     $view2 = array();
-    $view2['label'] = $this->randomName(16);
-    $view2['id'] = strtolower($this->randomName(16));
-    $view2['description'] = $this->randomName(16);
+    $view2['label'] = $this->randomMachineName(16);
+    $view2['id'] = strtolower($this->randomMachineName(16));
+    $view2['description'] = $this->randomMachineName(16);
     $view2['show[sort]'] = 'node_field_data-created:DESC';
     $view2['page[create]'] = 1;
-    $view2['page[title]'] = $this->randomName(16);
-    $view2['page[path]'] = $this->randomName(16);
+    $view2['page[title]'] = $this->randomMachineName(16);
+    $view2['page[path]'] = $this->randomMachineName(16);
     $this->drupalPostForm('admin/structure/views/add', $view2, t('Save and edit'));
     $this->drupalGet($view2['page[path]']);
     $this->assertResponse(200);
diff --git a/core/modules/views/lib/Drupal/views/Tests/Wizard/TaggedWithTest.php b/core/modules/views/lib/Drupal/views/Tests/Wizard/TaggedWithTest.php
index 175ebcb..37969ba 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Wizard/TaggedWithTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Wizard/TaggedWithTest.php
@@ -110,15 +110,15 @@ function testTaggedWith() {
 
     // Create three nodes, with different tags.
     $edit = array();
-    $edit['title[0][value]'] = $node_tag1_title = $this->randomName();
+    $edit['title[0][value]'] = $node_tag1_title = $this->randomMachineName();
     $edit[$this->tag_field->name] = 'tag1';
     $this->drupalPostForm($node_add_path, $edit, t('Save'));
     $edit = array();
-    $edit['title[0][value]'] = $node_tag1_tag2_title = $this->randomName();
+    $edit['title[0][value]'] = $node_tag1_tag2_title = $this->randomMachineName();
     $edit[$this->tag_field->name] = 'tag1, tag2';
     $this->drupalPostForm($node_add_path, $edit, t('Save'));
     $edit = array();
-    $edit['title[0][value]'] = $node_no_tags_title = $this->randomName();
+    $edit['title[0][value]'] = $node_no_tags_title = $this->randomMachineName();
     $this->drupalPostForm($node_add_path, $edit, t('Save'));
 
     // Create a view that filters by taxonomy term "tag1". It should show only
@@ -129,13 +129,13 @@ function testTaggedWith() {
     $view1['show[type]'] = $this->node_type_with_tags->type;
     $this->drupalPostForm('admin/structure/views/add', $view1, t('Update "of type" choice'));
     // Now resubmit the entire form to the same URL.
-    $view1['label'] = $this->randomName(16);
-    $view1['id'] = strtolower($this->randomName(16));
-    $view1['description'] = $this->randomName(16);
+    $view1['label'] = $this->randomMachineName(16);
+    $view1['id'] = strtolower($this->randomMachineName(16));
+    $view1['description'] = $this->randomMachineName(16);
     $view1['show[tagged_with]'] = 'tag1';
     $view1['page[create]'] = 1;
-    $view1['page[title]'] = $this->randomName(16);
-    $view1['page[path]'] = $this->randomName(16);
+    $view1['page[title]'] = $this->randomMachineName(16);
+    $view1['page[path]'] = $this->randomMachineName(16);
     $this->drupalPostForm(NULL, $view1, t('Save and edit'));
     // Visit the page and check that the nodes we expect are present and the
     // ones we don't expect are absent.
@@ -151,13 +151,13 @@ function testTaggedWith() {
     $view2['show[type]'] = $this->node_type_with_tags->type;
     $this->drupalPostForm('admin/structure/views/add', $view2, t('Update "of type" choice'));
     $this->assertResponse(200);
-    $view2['label'] = $this->randomName(16);
-    $view2['id'] = strtolower($this->randomName(16));
-    $view2['description'] = $this->randomName(16);
+    $view2['label'] = $this->randomMachineName(16);
+    $view2['id'] = strtolower($this->randomMachineName(16));
+    $view2['description'] = $this->randomMachineName(16);
     $view2['show[tagged_with]'] = 'tag2';
     $view2['page[create]'] = 1;
-    $view2['page[title]'] = $this->randomName(16);
-    $view2['page[path]'] = $this->randomName(16);
+    $view2['page[title]'] = $this->randomMachineName(16);
+    $view2['page[path]'] = $this->randomMachineName(16);
     $this->drupalPostForm(NULL, $view2, t('Save and edit'));
     $this->assertResponse(200);
     $this->drupalGet($view2['page[path]']);
diff --git a/core/modules/views/lib/Drupal/views/Tests/Wizard/WizardPluginBaseUnitTest.php b/core/modules/views/lib/Drupal/views/Tests/Wizard/WizardPluginBaseUnitTest.php
index b654289..396d2a6 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Wizard/WizardPluginBaseUnitTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Wizard/WizardPluginBaseUnitTest.php
@@ -59,9 +59,9 @@ public function testCreateView() {
     $form = array();
     $form_state = array();
     $form = $this->wizard->buildForm($form, $form_state);
-    $random_id = strtolower($this->randomName());
-    $random_label = $this->randomName();
-    $random_description = $this->randomName();
+    $random_id = strtolower($this->randomMachineName());
+    $random_label = $this->randomMachineName();
+    $random_description = $this->randomMachineName();
 
     // Add a new language and mark it as default.
     $language = new Language(array(
diff --git a/core/modules/views/tests/Drupal/views/Tests/Controller/ViewAjaxControllerTest.php b/core/modules/views/tests/Drupal/views/Tests/Controller/ViewAjaxControllerTest.php
index 588eec7..853e8c7 100644
--- a/core/modules/views/tests/Drupal/views/Tests/Controller/ViewAjaxControllerTest.php
+++ b/core/modules/views/tests/Drupal/views/Tests/Controller/ViewAjaxControllerTest.php
@@ -185,7 +185,7 @@ public function testAjaxViewWithPager() {
     $request = new Request();
     $request->request->set('view_name', 'test_view');
     $request->request->set('view_display_id', 'page_1');
-    $dom_id = $this->randomName(20);
+    $dom_id = $this->randomMachineName(20);
     $request->request->set('view_dom_id', $dom_id);
     $request->request->set('pager_element', '0');
 
diff --git a/core/modules/views/tests/Drupal/views/Tests/Plugin/Block/ViewsBlockTest.php b/core/modules/views/tests/Drupal/views/Tests/Plugin/Block/ViewsBlockTest.php
index eb46cb3..08f30f8 100644
--- a/core/modules/views/tests/Drupal/views/Tests/Plugin/Block/ViewsBlockTest.php
+++ b/core/modules/views/tests/Drupal/views/Tests/Plugin/Block/ViewsBlockTest.php
@@ -115,7 +115,7 @@ protected function setUp() {
    * @see \Drupal\views\Plugin\block\ViewsBlock::build()
    */
   public function testBuild() {
-    $output = $this->randomName(100);
+    $output = $this->randomMachineName(100);
     $build = array('#markup' => $output);
     $this->executable->expects($this->once())
       ->method('executeDisplay')
diff --git a/core/modules/views/tests/Drupal/views/Tests/Routing/ViewPageControllerTest.php b/core/modules/views/tests/Drupal/views/Tests/Routing/ViewPageControllerTest.php
index 4a52eac..ebb6bed 100644
--- a/core/modules/views/tests/Drupal/views/Tests/Routing/ViewPageControllerTest.php
+++ b/core/modules/views/tests/Drupal/views/Tests/Routing/ViewPageControllerTest.php
@@ -254,7 +254,7 @@ public function testHandleWithArgumentsOnOveriddenRouteWithUpcasting() {
    */
   public function testHandleWithNotExistingView() {
     // Pass in a non existent view.
-    $random_view_id = $this->randomName();
+    $random_view_id = $this->randomMachineName();
 
     $request = new Request();
     $request->attributes->set('view_id', $random_view_id);
diff --git a/core/modules/views/tests/Drupal/views/Tests/ViewsDataTest.php b/core/modules/views/tests/Drupal/views/Tests/ViewsDataTest.php
index f74e56e..a35dc85 100644
--- a/core/modules/views/tests/Drupal/views/Tests/ViewsDataTest.php
+++ b/core/modules/views/tests/Drupal/views/Tests/ViewsDataTest.php
@@ -192,7 +192,7 @@ public function testGetOnFirstCall() {
   public function testFullAndTableGetCache() {
     $expected_views_data = $this->viewsData();
     $table_name = 'views_test_data';
-    $random_table_name = $this->randomName();
+    $random_table_name = $this->randomMachineName();
 
     // Views data should be invoked twice due to the clear call.
     $this->moduleHandler->expects($this->exactly(2))
@@ -328,7 +328,7 @@ public function testSingleTableGetCache() {
    * Tests building the views data with a non existing table.
    */
   public function testNonExistingTableGetCache() {
-    $random_table_name = $this->randomName();
+    $random_table_name = $this->randomMachineName();
     $expected_views_data = $this->viewsData();
 
     // Views data should be invoked once.
@@ -467,7 +467,7 @@ public function testCacheCallsWithWarmCacheAndDifferentTable() {
    */
   public function testCacheCallsWithWarmCacheAndInvalidTable() {
     $expected_views_data = $this->viewsData();
-    $non_existing_table = $this->randomName();
+    $non_existing_table = $this->randomMachineName();
     $this->moduleHandler->expects($this->never())
       ->method('invokeAll');
 
@@ -503,7 +503,7 @@ public function testCacheCallsWithWarmCacheAndInvalidTable() {
    *   - $non_existing_table
    */
   public function testCacheCallsWithWarmCacheForInvalidTable() {
-    $non_existing_table = $this->randomName();
+    $non_existing_table = $this->randomMachineName();
     $this->moduleHandler->expects($this->never())
       ->method('invokeAll');
 
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Tests/DefaultViewsTest.php b/core/modules/views_ui/lib/Drupal/views_ui/Tests/DefaultViewsTest.php
index 607cfc1..96e7167 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Tests/DefaultViewsTest.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Tests/DefaultViewsTest.php
@@ -54,7 +54,7 @@ function testDefaultViews() {
 
     // Edit the view and change the title. Make sure that the new title is
     // displayed.
-    $new_title = $this->randomName(16);
+    $new_title = $this->randomMachineName(16);
     $edit = array('title' => $new_title);
     $this->drupalPostForm('admin/structure/views/nojs/display/glossary/page_1/title', $edit, t('Apply'));
     $this->drupalPostForm('admin/structure/views/view/glossary/edit/page_1', array(), t('Save'));
@@ -93,7 +93,7 @@ function testDefaultViews() {
     // Clone a view and set a custom name.
     $this->drupalGet('admin/structure/views');
     $this->clickViewsOperationLink(t('Clone'), '/glossary');
-    $random_name = strtolower($this->randomName());
+    $random_name = strtolower($this->randomMachineName());
     $this->drupalPostForm(NULL, array('id' => $random_name), t('Clone'));
     $this->assertUrl("admin/structure/views/view/$random_name", array(), 'The custom view name got saved.');
 
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Tests/DisplayExtenderUITest.php b/core/modules/views_ui/lib/Drupal/views_ui/Tests/DisplayExtenderUITest.php
index 388eb38..03d2ed5 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Tests/DisplayExtenderUITest.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Tests/DisplayExtenderUITest.php
@@ -42,7 +42,7 @@ public function testDisplayExtenderUI() {
     $this->drupalGet($view_edit_url);
     $this->assertLinkByHref($display_option_url, 0, 'Make sure the option defined by the test display extender appears in the UI.');
 
-    $random_text = $this->randomName();
+    $random_text = $this->randomMachineName();
     $this->drupalPostForm($display_option_url, array('test_extender_test_option' => $random_text), t('Apply'));
     $this->assertLink($random_text);
     $this->drupalPostForm(NULL, array(), t('Save'));
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Tests/DisplayPath.php b/core/modules/views_ui/lib/Drupal/views_ui/Tests/DisplayPath.php
index 31b1ff2..f3d0104 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Tests/DisplayPath.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Tests/DisplayPath.php
@@ -38,7 +38,7 @@ public function testPathUI() {
     $this->assertNoLink(t('View @display', array('@display' => 'page')), 'No view page link found on the page.');
 
     // Save a path and make sure the summary appears as expected.
-    $random_path = $this->randomName();
+    $random_path = $this->randomMachineName();
     $this->drupalPostForm('admin/structure/views/nojs/display/test_view/page_1/path', array('path' => $random_path), t('Apply'));
     $this->assertText('/' . $random_path, 'The custom path appears in the summary.');
     $this->assertLink(t('View @display', array('@display' => 'Page')), 0, 'view page link found on the page.');
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Tests/DisplayTestCRUD.php b/core/modules/views_ui/lib/Drupal/views_ui/Tests/DisplayTestCRUD.php
index c027167..9327826 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Tests/DisplayTestCRUD.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Tests/DisplayTestCRUD.php
@@ -121,8 +121,8 @@ public function testCloneDisplay() {
     $this->assertUrl($path_prefix . '/page_2', array(), 'The user got redirected to the new display.');
 
     // Set the title and override the css classes.
-    $random_title = $this->randomName();
-    $random_css = $this->randomName();
+    $random_title = $this->randomMachineName();
+    $random_css = $this->randomMachineName();
     $this->drupalPostForm("admin/structure/views/nojs/display/{$view['id']}/page_2/title", array('title' => $random_title), t('Apply'));
     $this->drupalPostForm("admin/structure/views/nojs/display/{$view['id']}/page_2/css_class", array('override[dropdown]' => 'page_2', 'css_class' => $random_css), t('Apply'));
 
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Tests/ExposedFormUITest.php b/core/modules/views_ui/lib/Drupal/views_ui/Tests/ExposedFormUITest.php
index a17ffce..ef9c0fe 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Tests/ExposedFormUITest.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Tests/ExposedFormUITest.php
@@ -118,7 +118,7 @@ function testExposedAdminUi() {
     // error.
     $this->drupalGet('admin/structure/views/nojs/handler/test_exposed_admin_ui/default/filter/body_value');
     $edit = array();
-    $edit["options[group_info][group_items][1][title]"] = $this->randomName();
+    $edit["options[group_info][group_items][1][title]"] = $this->randomMachineName();
     $edit["options[group_info][group_items][1][operator]"] = 'empty';
     $this->drupalPostForm(NULL, $edit, t('Apply'));
     $this->assertUrl('admin/structure/views/view/test_exposed_admin_ui/edit/default', array(), 'Validation did not run for the empty operator.');
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Tests/HandlerTest.php b/core/modules/views_ui/lib/Drupal/views_ui/Tests/HandlerTest.php
index 5a00b03..777bab6 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Tests/HandlerTest.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Tests/HandlerTest.php
@@ -98,7 +98,7 @@ public function testUICRUD() {
       }
 
       $this->assertUrl($edit_handler_url, array(), 'The user got redirected to the handler edit form.');
-      $random_label = $this->randomName();
+      $random_label = $this->randomMachineName();
       $this->drupalPostForm(NULL, array('options[admin_label]' => $random_label), t('Apply'));
 
       $this->assertUrl('admin/structure/views/view/test_view_empty/edit/default', array(), 'The user got redirected to the views edit form.');
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Tests/OverrideDisplaysTest.php b/core/modules/views_ui/lib/Drupal/views_ui/Tests/OverrideDisplaysTest.php
index 3384b0f..6da6124 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Tests/OverrideDisplaysTest.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Tests/OverrideDisplaysTest.php
@@ -26,10 +26,10 @@ public static function getInfo() {
   function testOverrideDisplays() {
     // Create a basic view that shows all content, with a page and a block
     // display.
-    $view['label'] = $this->randomName(16);
-    $view['id'] = strtolower($this->randomName(16));
+    $view['label'] = $this->randomMachineName(16);
+    $view['id'] = strtolower($this->randomMachineName(16));
     $view['page[create]'] = 1;
-    $view['page[path]'] = $this->randomName(16);
+    $view['page[path]'] = $this->randomMachineName(16);
     $view['block[create]'] = 1;
     $view_path = $view['page[path]'];
     $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
@@ -39,7 +39,7 @@ function testOverrideDisplays() {
     // things up so that they both inherit from the default display, and we
     // therefore only need to change that to have it take effect for both.
     $edit = array();
-    $edit['title'] = $original_title = $this->randomName(16);
+    $edit['title'] = $original_title = $this->randomMachineName(16);
     $edit['override[dropdown]'] = 'default';
     $this->drupalPostForm("admin/structure/views/nojs/display/{$view['id']}/page_1/title", $edit, t('Apply'));
     $this->drupalPostForm("admin/structure/views/view/{$view['id']}/edit/page_1", array(), t('Save'));
@@ -67,7 +67,7 @@ function testOverrideDisplays() {
     // Change the title for the page display only, and make sure that the
     // original title still appears on the page.
     $edit = array();
-    $edit['title'] = $new_title = $this->randomName(16);
+    $edit['title'] = $new_title = $this->randomMachineName(16);
     $edit['override[dropdown]'] = 'page_1';
     $this->drupalPostForm("admin/structure/views/nojs/display/{$view['id']}/page_1/title", $edit, t('Apply'));
     $this->drupalPostForm("admin/structure/views/view/{$view['id']}/edit/page_1", array(), t('Save'));
@@ -85,15 +85,15 @@ function testWizardMixedDefaultOverriddenDisplays() {
     // identical titles, but give the block a different one, so we expect the
     // page and feed to inherit their titles from the default display, but the
     // block to override it.
-    $view['label'] = $this->randomName(16);
-    $view['id'] = strtolower($this->randomName(16));
+    $view['label'] = $this->randomMachineName(16);
+    $view['id'] = strtolower($this->randomMachineName(16));
     $view['page[create]'] = 1;
-    $view['page[title]'] = $this->randomName(16);
-    $view['page[path]'] = $this->randomName(16);
+    $view['page[title]'] = $this->randomMachineName(16);
+    $view['page[path]'] = $this->randomMachineName(16);
     $view['page[feed]'] = 1;
-    $view['page[feed_properties][path]'] = $this->randomName(16);
+    $view['page[feed_properties][path]'] = $this->randomMachineName(16);
     $view['block[create]'] = 1;
-    $view['block[title]'] = $this->randomName(16);
+    $view['block[title]'] = $this->randomMachineName(16);
     $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
 
     // Add a node that will appear in the view, so that the block will actually
@@ -134,7 +134,7 @@ function testWizardMixedDefaultOverriddenDisplays() {
     // Edit the page and change the title. This should automatically change
     // the feed's title also, but not the block.
     $edit = array();
-    $edit['title'] = $new_default_title = $this->randomName(16);
+    $edit['title'] = $new_default_title = $this->randomMachineName(16);
     $this->drupalPostForm("admin/structure/views/nojs/display/{$view['id']}/page_1/title", $edit, t('Apply'));
     $this->drupalPostForm("admin/structure/views/view/{$view['id']}/edit/page_1", array(), t('Save'));
     $this->drupalGet($view['page[path]']);
@@ -155,7 +155,7 @@ function testWizardMixedDefaultOverriddenDisplays() {
     // Edit the block and change the title. This should automatically change
     // the block title only, and leave the defaults alone.
     $edit = array();
-    $edit['title'] = $new_block_title = $this->randomName(16);
+    $edit['title'] = $new_block_title = $this->randomMachineName(16);
     $this->drupalPostForm("admin/structure/views/nojs/display/{$view['id']}/block_1/title", $edit, t('Apply'));
     $this->drupalPostForm("admin/structure/views/view/{$view['id']}/edit/block_1", array(), t('Save'));
     $this->drupalGet($view['page[path]']);
@@ -177,19 +177,19 @@ function testRevertAllDisplays() {
     // Create a basic view with a page, block.
     // Because there is both a title on page and block we expect the title on
     // the block be overriden.
-    $view['label'] = $this->randomName(16);
-    $view['id'] = strtolower($this->randomName(16));
+    $view['label'] = $this->randomMachineName(16);
+    $view['id'] = strtolower($this->randomMachineName(16));
     $view['page[create]'] = 1;
-    $view['page[title]'] = $this->randomName(16);
-    $view['page[path]'] = $this->randomName(16);
+    $view['page[title]'] = $this->randomMachineName(16);
+    $view['page[path]'] = $this->randomMachineName(16);
     $view['block[create]'] = 1;
-    $view['block[title]'] = $this->randomName(16);
+    $view['block[title]'] = $this->randomMachineName(16);
     $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
 
     // Revert the title of the block back to the default ones, but submit some
     // new values to be sure that the new value is not stored.
     $edit = array();
-    $edit['title'] = $new_block_title = $this->randomName();
+    $edit['title'] = $new_block_title = $this->randomMachineName();
     $edit['override[dropdown]'] = 'default_revert';
 
     $this->drupalPostForm("admin/structure/views/nojs/display/{$view['id']}/block_1/title", $edit, t('Apply'));
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Tests/PreviewTest.php b/core/modules/views_ui/lib/Drupal/views_ui/Tests/PreviewTest.php
index d8b6a65..3e4222c 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Tests/PreviewTest.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Tests/PreviewTest.php
@@ -82,13 +82,13 @@ function testPreviewUI() {
 
     // Test feed preview.
     $view = array();
-    $view['label'] = $this->randomName(16);
-    $view['id'] = strtolower($this->randomName(16));
+    $view['label'] = $this->randomMachineName(16);
+    $view['id'] = strtolower($this->randomMachineName(16));
     $view['page[create]'] = 1;
-    $view['page[title]'] = $this->randomName(16);
-    $view['page[path]'] = $this->randomName(16);
+    $view['page[title]'] = $this->randomMachineName(16);
+    $view['page[path]'] = $this->randomMachineName(16);
     $view['page[feed]'] = 1;
-    $view['page[feed_properties][path]'] = $this->randomName(16);
+    $view['page[feed_properties][path]'] = $this->randomMachineName(16);
     $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
     $this->clickLink(t('Feed'));
     $this->drupalPostForm(NULL, array(), t('Update preview'));
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Tests/QueryTest.php b/core/modules/views_ui/lib/Drupal/views_ui/Tests/QueryTest.php
index 0013b78..8264ace 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Tests/QueryTest.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Tests/QueryTest.php
@@ -47,7 +47,7 @@ protected function viewsData() {
   public function testQueryUI() {
     // Save some query settings.
     $query_settings_path = "admin/structure/views/nojs/display/test_view/default/query";
-    $random_value = $this->randomName();
+    $random_value = $this->randomMachineName();
     $this->drupalPostForm($query_settings_path, array('query[options][test_setting]' => $random_value), t('Apply'));
     $this->drupalPostForm(NULL, array(), t('Save'));
 
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Tests/RedirectTest.php b/core/modules/views_ui/lib/Drupal/views_ui/Tests/RedirectTest.php
index 08483f6..a792053 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Tests/RedirectTest.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Tests/RedirectTest.php
@@ -33,7 +33,7 @@ public static function getInfo() {
   public function testRedirect() {
     $view_name = 'test_view';
 
-    $random_destination = $this->randomName();
+    $random_destination = $this->randomMachineName();
     $edit_path = "admin/structure/views/view/$view_name/edit";
 
     $this->drupalPostForm($edit_path, array(), t('Save') , array('query' => array('destination' => $random_destination)));
@@ -43,7 +43,7 @@ public function testRedirect() {
     // but have the old url in the destination the user should be redirected to
     // the new path.
     $view_name = 'test_redirect_view';
-    $new_path = $this->randomName();
+    $new_path = $this->randomMachineName();
 
     $edit_path = "admin/structure/views/view/$view_name/edit";
     $path_edit_path = "admin/structure/views/nojs/display/$view_name/page_1/path";
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Tests/RowUITest.php b/core/modules/views_ui/lib/Drupal/views_ui/Tests/RowUITest.php
index cc8c5c3..ad301ad 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Tests/RowUITest.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Tests/RowUITest.php
@@ -49,7 +49,7 @@ public function testRowUI() {
     );
     $this->drupalPostForm(NULL, $edit, t('Apply'));
     $this->assertFieldByName('row_options[test_option]', NULL, 'Make sure the custom settings form from the test plugin appears.');
-    $random_name = $this->randomName();
+    $random_name = $this->randomMachineName();
     $edit = array(
       'row_options[test_option]' => $random_name
     );
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Tests/SettingsTest.php b/core/modules/views_ui/lib/Drupal/views_ui/Tests/SettingsTest.php
index 86029a9..71bfdf8 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Tests/SettingsTest.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Tests/SettingsTest.php
@@ -44,12 +44,12 @@ function testEditUI() {
     $this->drupalPostForm('admin/structure/views/settings', $edit, t('Save configuration'));
 
     $view = array();
-    $view['label'] = $this->randomName(16);
-    $view['id'] = strtolower($this->randomName(16));
-    $view['description'] = $this->randomName(16);
+    $view['label'] = $this->randomMachineName(16);
+    $view['id'] = strtolower($this->randomMachineName(16));
+    $view['description'] = $this->randomMachineName(16);
     $view['page[create]'] = TRUE;
-    $view['page[title]'] = $this->randomName(16);
-    $view['page[path]'] = $this->randomName(16);
+    $view['page[title]'] = $this->randomMachineName(16);
+    $view['page[path]'] = $this->randomMachineName(16);
     $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
 
     // Configure to not always show the master display.
@@ -65,7 +65,7 @@ function testEditUI() {
 
     // Create a view with an additional display, so master should be hidden.
     $view['page[create]'] = TRUE;
-    $view['id'] = strtolower($this->randomName());
+    $view['id'] = strtolower($this->randomMachineName());
     $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
 
     $this->assertNoLink(t('Master'));
@@ -79,7 +79,7 @@ function testEditUI() {
     );
     $this->drupalPostForm('admin/structure/views/settings', $edit, t('Save configuration'));
 
-    $view['id'] = strtolower($this->randomName());
+    $view['id'] = strtolower($this->randomMachineName());
     $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
     $this->assertFieldById('edit-displays-top-add-display-embed');
 
@@ -97,7 +97,7 @@ function testEditUI() {
     );
     $this->drupalPostForm('admin/structure/views/settings', $edit, t('Save configuration'));
 
-    $view['id'] = strtolower($this->randomName());
+    $view['id'] = strtolower($this->randomMachineName());
     $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
 
     $this->drupalPostForm(NULL, array(), t('Update preview'));
@@ -109,7 +109,7 @@ function testEditUI() {
     );
     $this->drupalPostForm('admin/structure/views/settings', $edit, t('Save configuration'));
 
-    $view['id'] = strtolower($this->randomName());
+    $view['id'] = strtolower($this->randomMachineName());
     $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
 
     $this->drupalPostForm(NULL, array(), t('Update preview'));
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Tests/StorageTest.php b/core/modules/views_ui/lib/Drupal/views_ui/Tests/StorageTest.php
index 4a99d2a..be29db1 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Tests/StorageTest.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Tests/StorageTest.php
@@ -49,9 +49,9 @@ public function testDetails() {
     language_save($language);
 
     $edit = array(
-      'label' => $this->randomName(),
-      'tag' => $this->randomName(),
-      'description' => $this->randomName(30),
+      'label' => $this->randomMachineName(),
+      'tag' => $this->randomMachineName(),
+      'description' => $this->randomMachineName(30),
       'langcode' => 'fr',
     );
 
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Tests/StyleUITest.php b/core/modules/views_ui/lib/Drupal/views_ui/Tests/StyleUITest.php
index c58d1a5..8de162e 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Tests/StyleUITest.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Tests/StyleUITest.php
@@ -49,7 +49,7 @@ public function testStyleUI() {
     );
     $this->drupalPostForm(NULL, $edit, t('Apply'));
     $this->assertFieldByName('style_options[test_option]', NULL, 'Make sure the custom settings form from the test plugin appears.');
-    $random_name = $this->randomName();
+    $random_name = $this->randomMachineName();
     $edit = array(
       'style_options[test_option]' => $random_name
     );
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Tests/TagTest.php b/core/modules/views_ui/lib/Drupal/views_ui/Tests/TagTest.php
index db67fde..67a0c90 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Tests/TagTest.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Tests/TagTest.php
@@ -40,9 +40,9 @@ public function testViewsUiAutocompleteTag() {
     $tags = array();
     for ($i = 0; $i < 16; $i++) {
       $suffix = $i % 2 ? 'odd' : 'even';
-      $tag = 'autocomplete_tag_test_' . $suffix . $this->randomName();
+      $tag = 'autocomplete_tag_test_' . $suffix . $this->randomMachineName();
       $tags[] = $tag;
-      entity_create('view', array('tag' => $tag, 'id' => $this->randomName()))->save();
+      entity_create('view', array('tag' => $tag, 'id' => $this->randomMachineName()))->save();
     }
 
     // Make sure just ten results are returns.
@@ -63,7 +63,7 @@ public function testViewsUiAutocompleteTag() {
     }
 
     // Make sure an invalid result doesn't return anything.
-    $request->query->set('q', $this->randomName());
+    $request->query->set('q', $this->randomMachineName());
     $result = $controller->autocompleteTag($request);
     $matches = (array) json_decode($result->getContent());
     $this->assertEqual(count($matches), 0, "Make sure an invalid tag doesn't return anything.");
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Tests/UITestBase.php b/core/modules/views_ui/lib/Drupal/views_ui/Tests/UITestBase.php
index 53fcc05..5d32952 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Tests/UITestBase.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Tests/UITestBase.php
@@ -52,9 +52,9 @@ protected function setUp() {
   public function randomView(array $view = array()) {
     // Create a new view in the UI.
     $default = array();
-    $default['label'] = $this->randomName(16);
-    $default['id'] = strtolower($this->randomName(16));
-    $default['description'] = $this->randomName(16);
+    $default['label'] = $this->randomMachineName(16);
+    $default['id'] = strtolower($this->randomMachineName(16));
+    $default['description'] = $this->randomMachineName(16);
     $default['page[create]'] = TRUE;
     $default['page[path]'] = $default['id'];
 
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Tests/ViewsUITourTest.php b/core/modules/views_ui/lib/Drupal/views_ui/Tests/ViewsUITourTest.php
index 5808cde..e752258 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/Tests/ViewsUITourTest.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/Tests/ViewsUITourTest.php
@@ -48,10 +48,10 @@ protected function setUp() {
   public function testViewsUiTourTips() {
     // Create a basic view that shows all content, with a page and a block
     // display.
-    $view['label'] = $this->randomName(16);
-    $view['id'] = strtolower($this->randomName(16));
+    $view['label'] = $this->randomMachineName(16);
+    $view['id'] = strtolower($this->randomMachineName(16));
     $view['page[create]'] = 1;
-    $view['page[path]'] = $this->randomName(16);
+    $view['page[path]'] = $this->randomMachineName(16);
     $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
     $this->assertTourTips();
   }
diff --git a/core/modules/xmlrpc/lib/Drupal/xmlrpc/Tests/XmlRpcValidatorTest.php b/core/modules/xmlrpc/lib/Drupal/xmlrpc/Tests/XmlRpcValidatorTest.php
index b1a9fa8..03a08f4 100644
--- a/core/modules/xmlrpc/lib/Drupal/xmlrpc/Tests/XmlRpcValidatorTest.php
+++ b/core/modules/xmlrpc/lib/Drupal/xmlrpc/Tests/XmlRpcValidatorTest.php
@@ -69,10 +69,10 @@ function testValidator() {
 
     $int_5     = mt_rand(-100, 100);
     $bool_5    = (($int_5 % 2) == 0);
-    $string_5  = $this->randomName();
+    $string_5  = $this->randomMachineName();
     $double_5  = (double)(mt_rand(-1000, 1000) / 100);
     $time_5    = REQUEST_TIME;
-    $base64_5  = $this->randomName(100);
+    $base64_5  = $this->randomMachineName(100);
     $l_res_5 = xmlrpc_test_manyTypesTest($int_5, $bool_5, $string_5, $double_5, xmlrpc_date($time_5), $base64_5);
     // See http://drupal.org/node/37766 why this currently fails
     $l_res_5[5] = $l_res_5[5]->data;
@@ -83,7 +83,7 @@ function testValidator() {
     $size = mt_rand(100, 200);
     $array_6 = array();
     for ($i = 0; $i < $size; $i++) {
-      $array_6[] = $this->randomName(mt_rand(8, 12));
+      $array_6[] = $this->randomMachineName(mt_rand(8, 12));
     }
 
     $l_res_6 = xmlrpc_test_moderateSizeArrayCheck($array_6);
diff --git a/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php b/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php
index 1c35635..2e989f0 100644
--- a/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php
+++ b/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php
@@ -84,7 +84,7 @@ public function testCRUD() {
    */
   public function testReadOnly() {
     $php = new FileStorage($this->standardSettings);
-    $name = $this->randomName() . '/' . $this->randomName() . '.php';
+    $name = $this->randomMachineName() . '/' . $this->randomMachineName() . '.php';
 
     // Find a global that doesn't exist.
     do {
@@ -136,7 +136,7 @@ public function testDeleteAll() {
 
     // Write out some files.
     $php = new FileStorage($this->standardSettings);
-    $name = $this->randomName() . '/' . $this->randomName() . '.php';
+    $name = $this->randomMachineName() . '/' . $this->randomMachineName() . '.php';
 
     // Find a global that doesn't exist.
     do {
diff --git a/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageBase.php b/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageBase.php
index a7592f6..edef48c 100644
--- a/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageBase.php
+++ b/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageBase.php
@@ -39,7 +39,7 @@
   public function setUp() {
     parent::setUp();
 
-    $this->secret = $this->randomName();
+    $this->secret = $this->randomMachineName();
 
     $this->settings = array(
       'directory' => sys_get_temp_dir() . '/php',
diff --git a/core/tests/Drupal/Tests/Component/PhpStorage/PhpStorageTestBase.php b/core/tests/Drupal/Tests/Component/PhpStorage/PhpStorageTestBase.php
index 9ae5e76..259fce1 100644
--- a/core/tests/Drupal/Tests/Component/PhpStorage/PhpStorageTestBase.php
+++ b/core/tests/Drupal/Tests/Component/PhpStorage/PhpStorageTestBase.php
@@ -35,7 +35,7 @@ function setUp() {
    * Assert that a PHP storage's load/save/delete operations work.
    */
   public function assertCRUD($php) {
-    $name = $this->randomName() . '/' . $this->randomName() . '.php';
+    $name = $this->randomMachineName() . '/' . $this->randomMachineName() . '.php';
 
     // Find a global that doesn't exist.
     do {
diff --git a/core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php b/core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php
index 766d641..41ab596 100644
--- a/core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php
@@ -56,8 +56,8 @@ function setUp() {
    */
   public function testGet() {
     $this->assertInternalType('string', $this->generator->get());
-    $this->assertNotSame($this->generator->get(), $this->generator->get($this->randomName()));
-    $this->assertNotSame($this->generator->get($this->randomName()), $this->generator->get($this->randomName()));
+    $this->assertNotSame($this->generator->get(), $this->generator->get($this->randomMachineName()));
+    $this->assertNotSame($this->generator->get($this->randomMachineName()), $this->generator->get($this->randomMachineName()));
   }
 
   /**
diff --git a/core/tests/Drupal/Tests/Core/Annotation/TranslationTest.php b/core/tests/Drupal/Tests/Core/Annotation/TranslationTest.php
index 071df3e..17d80c2 100644
--- a/core/tests/Drupal/Tests/Core/Annotation/TranslationTest.php
+++ b/core/tests/Drupal/Tests/Core/Annotation/TranslationTest.php
@@ -76,7 +76,7 @@ public function providerTestGet() {
       ),
       'Foo'
     );
-    $random = $this->randomName();
+    $random = $this->randomMachineName();
     $random_html_entity = '&' . $random;
     $data[] = array(
       array(
@@ -86,7 +86,7 @@ public function providerTestGet() {
           '@baz' => $random_html_entity,
           '%qux' => $random_html_entity,
         ),
-        'context' => $this->randomName(),
+        'context' => $this->randomMachineName(),
       ),
       'Foo ' . $random . ' &amp;' . $random . ' <em class="placeholder">&amp;' . $random . '</em>',
     );
diff --git a/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php b/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php
index 05a987c..ed2901b 100644
--- a/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php
+++ b/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php
@@ -61,7 +61,7 @@ public static function getInfo() {
   protected function setUp() {
     $this->cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
     $this->lock = $this->getMock('Drupal\Core\Lock\LockBackendInterface');
-    $this->cid = $this->randomName();
+    $this->cid = $this->randomMachineName();
     $this->collector = new CacheCollectorHelper($this->cid, $this->cache, $this->lock);
 
     $this->getContainerWithCacheBins($this->cache);
@@ -72,8 +72,8 @@ protected function setUp() {
    * Tests the resolve cache miss function.
    */
   public function testResolveCacheMiss() {
-    $key = $this->randomName();
-    $value = $this->randomName();
+    $key = $this->randomMachineName();
+    $value = $this->randomMachineName();
     $this->collector->setCacheMissData($key, $value);
 
     $this->assertEquals($value, $this->collector->get($key));
@@ -83,8 +83,8 @@ public function testResolveCacheMiss() {
    * Tests setting and getting values when the cache is empty.
    */
   public function testSetAndGet() {
-    $key = $this->randomName();
-    $value = $this->randomName();
+    $key = $this->randomMachineName();
+    $value = $this->randomMachineName();
 
     $this->assertNull($this->collector->get($key));
 
@@ -98,7 +98,7 @@ public function testSetAndGet() {
    * Makes sure that NULL is a valid value and is collected.
    */
   public function testSetAndGetNull() {
-    $key = $this->randomName();
+    $key = $this->randomMachineName();
     $value = NULL;
 
     $this->cache->expects($this->once())
@@ -110,7 +110,7 @@ public function testSetAndGetNull() {
 
     // Ensure that getting a value that isn't set does not mark it as
     // existent.
-    $non_existing_key = $this->randomName(7);
+    $non_existing_key = $this->randomMachineName(7);
     $this->collector->get($non_existing_key);
     $this->assertFalse($this->collector->has($non_existing_key));
   }
@@ -119,8 +119,8 @@ public function testSetAndGetNull() {
    * Tests returning value from the collected cache.
    */
   public function testGetFromCache() {
-    $key = $this->randomName();
-    $value = $this->randomName();
+    $key = $this->randomMachineName();
+    $value = $this->randomMachineName();
 
     $cache = (object) array(
       'data' => array($key => $value),
@@ -139,8 +139,8 @@ public function testGetFromCache() {
    * Tests setting and deleting values.
    */
   public function testDelete() {
-    $key = $this->randomName();
-    $value = $this->randomName();
+    $key = $this->randomMachineName();
+    $value = $this->randomMachineName();
 
     $this->assertNull($this->collector->get($key));
 
@@ -173,8 +173,8 @@ public function testUpdateCacheNoChanges() {
    * Tests updating the cache after a set.
    */
   public function testUpdateCache() {
-    $key = $this->randomName();
-    $value = $this->randomName();
+    $key = $this->randomMachineName();
+    $value = $this->randomMachineName();
 
     $this->collector->setCacheMissData($key, $value);
     $this->collector->get($key);
@@ -205,8 +205,8 @@ public function testUpdateCache() {
    * Tests updating the cache when the lock acquire fails.
    */
   public function testUpdateCacheLockFail() {
-    $key = $this->randomName();
-    $value = $this->randomName();
+    $key = $this->randomMachineName();
+    $value = $this->randomMachineName();
 
     $this->collector->setCacheMissData($key, $value);
     $this->collector->get($key);
@@ -227,8 +227,8 @@ public function testUpdateCacheLockFail() {
    * Tests updating the cache when there is a conflict after cache invalidation.
    */
   public function testUpdateCacheInvalidatedConflict() {
-    $key = $this->randomName();
-    $value = $this->randomName();
+    $key = $this->randomMachineName();
+    $value = $this->randomMachineName();
 
     $cache = (object) array(
       'data' => array($key => $value),
@@ -274,8 +274,8 @@ public function testUpdateCacheInvalidatedConflict() {
    * Tests updating the cache when a different request
    */
   public function testUpdateCacheMerge() {
-    $key = $this->randomName();
-    $value = $this->randomName();
+    $key = $this->randomMachineName();
+    $value = $this->randomMachineName();
 
     $this->collector->setCacheMissData($key, $value);
     $this->collector->get($key);
@@ -310,8 +310,8 @@ public function testUpdateCacheMerge() {
    * Tests updating the cache after a delete.
    */
   public function testUpdateCacheDelete() {
-    $key = $this->randomName();
-    $value = $this->randomName();
+    $key = $this->randomMachineName();
+    $value = $this->randomMachineName();
 
     $cache = (object) array(
       'data' => array($key => $value),
@@ -351,8 +351,8 @@ public function testUpdateCacheDelete() {
    * Tests a reset of the cache collector.
    */
   public function testUpdateCacheReset() {
-    $key = $this->randomName();
-    $value = $this->randomName();
+    $key = $this->randomMachineName();
+    $value = $this->randomMachineName();
 
     // Set the data and request it.
     $this->collector->setCacheMissData($key, $value);
@@ -372,8 +372,8 @@ public function testUpdateCacheReset() {
    * Tests a clear of the cache collector.
    */
   public function testUpdateCacheClear() {
-    $key = $this->randomName();
-    $value = $this->randomName();
+    $key = $this->randomMachineName();
+    $value = $this->randomMachineName();
 
     // Set the data and request it.
     $this->collector->setCacheMissData($key, $value);
@@ -398,9 +398,9 @@ public function testUpdateCacheClear() {
    * Tests a clear of the cache collector using tags.
    */
   public function testUpdateCacheClearTags() {
-    $key = $this->randomName();
-    $value = $this->randomName();
-    $tags = array($this->randomName() => TRUE);
+    $key = $this->randomMachineName();
+    $value = $this->randomMachineName();
+    $tags = array($this->randomMachineName() => TRUE);
     $this->collector = new CacheCollectorHelper($this->cid, $this->cache, $this->lock, $tags);
 
     // Set the data and request it.
diff --git a/core/tests/Drupal/Tests/Core/Cache/NullBackendTest.php b/core/tests/Drupal/Tests/Core/Cache/NullBackendTest.php
index fc3a700..2278ace 100644
--- a/core/tests/Drupal/Tests/Core/Cache/NullBackendTest.php
+++ b/core/tests/Drupal/Tests/Core/Cache/NullBackendTest.php
@@ -31,8 +31,8 @@ public static function getInfo() {
   function testNullBackend() {
     $null_cache = new NullBackend('test');
 
-    $key = $this->randomName();
-    $value = $this->randomName();
+    $key = $this->randomMachineName();
+    $value = $this->randomMachineName();
 
     $null_cache->set($key, $value);
     $this->assertTrue($null_cache->isEmpty());
diff --git a/core/tests/Drupal/Tests/Core/Config/CachedStorageTest.php b/core/tests/Drupal/Tests/Core/Config/CachedStorageTest.php
index 6c60af4..9ad9a25 100644
--- a/core/tests/Drupal/Tests/Core/Config/CachedStorageTest.php
+++ b/core/tests/Drupal/Tests/Core/Config/CachedStorageTest.php
@@ -30,7 +30,7 @@ public function testListAllStaticCache() {
     $prefix = __FUNCTION__;
     $storage = $this->getMock('Drupal\Core\Config\StorageInterface');
 
-    $response = array("$prefix." . $this->randomName(), "$prefix." . $this->randomName());
+    $response = array("$prefix." . $this->randomMachineName(), "$prefix." . $this->randomMachineName());
     $storage->expects($this->once())
       ->method('listAll')
       ->with($prefix)
@@ -50,7 +50,7 @@ public function testListAllPrimedPersistentCache() {
     $storage = $this->getMock('Drupal\Core\Config\StorageInterface');
     $storage->expects($this->never())->method('listAll');
 
-    $response = array("$prefix." . $this->randomName(), "$prefix." . $this->randomName());
+    $response = array("$prefix." . $this->randomMachineName(), "$prefix." . $this->randomMachineName());
     $cache = new MemoryBackend(__FUNCTION__);
     $cache->set('find:' . $prefix, $response);
     $cachedStorage = new CachedStorage($storage, $cache);
diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php
index 3c52f73..994c042 100644
--- a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php
@@ -100,14 +100,14 @@ public static function getInfo() {
    * {@inheritdoc}
    */
   public function setUp() {
-    $this->id = $this->randomName();
+    $this->id = $this->randomMachineName();
     $values = array(
       'id' => $this->id,
       'langcode' => 'en',
       'uuid' => '3bb9ee60-bea5-4622-b89b-a63319d10b3a',
     );
-    $this->entityTypeId = $this->randomName();
-    $this->provider = $this->randomName();
+    $this->entityTypeId = $this->randomMachineName();
+    $this->provider = $this->randomMachineName();
     $this->entityType = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
     $this->entityType->expects($this->any())
       ->method('getProvider')
@@ -220,7 +220,7 @@ public function testCalculateDependenciesWithPluginBag($definition, $expected_de
       ->getMock();
 
     // Create a configurable plugin that would add a dependency.
-    $instance_id = $this->randomName();
+    $instance_id = $this->randomMachineName();
     $instance = new TestConfigurablePlugin(array(), $instance_id, $definition);
 
     // Create a plugin bag to contain the instance.
@@ -249,8 +249,8 @@ public function testCalculateDependenciesWithPluginBag($definition, $expected_de
    */
   public function providerCalculateDependenciesWithPluginBag() {
     // Start with 'a' so that order of the dependency array is fixed.
-    $instance_dependency_1 = 'a' . $this->randomName(10);
-    $instance_dependency_2 = 'a' . $this->randomName(11);
+    $instance_dependency_1 = 'a' . $this->randomMachineName(10);
+    $instance_dependency_2 = 'a' . $this->randomMachineName(11);
 
     return array(
       // Tests that the plugin provider is a module dependency.
@@ -287,7 +287,7 @@ public function providerCalculateDependenciesWithPluginBag() {
    * @covers ::getOriginalId
    */
   public function testGetOriginalId() {
-    $new_id = $this->randomName();
+    $new_id = $this->randomMachineName();
     $this->entity->set('id', $new_id);
     $this->assertSame($this->id, $this->entity->getOriginalId());
     $this->assertSame($this->entity, $this->entity->setOriginalId($new_id));
@@ -311,7 +311,7 @@ public function testIsNew() {
    */
   public function testGet() {
     $name = 'id';
-    $value = $this->randomName();
+    $value = $this->randomMachineName();
     $this->assertSame($this->id, $this->entity->get($name));
     $this->assertSame($this->entity, $this->entity->set($name, $value));
     $this->assertSame($value, $this->entity->get($name));
diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php
index 3db843a..15e2844 100644
--- a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php
+++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php
@@ -59,8 +59,8 @@ public function testConfigPrefixLengthExceeds() {
     // A provider length of 24 and config_prefix length of 59 (+1 for the .)
     // results in a config length of 84, which is too long.
     $definition = array(
-      'provider' => $this->randomName(24),
-      'config_prefix' => $this->randomName(59),
+      'provider' => $this->randomMachineName(24),
+      'config_prefix' => $this->randomMachineName(59),
     );
     $config_entity = $this->setUpConfigEntityType($definition);
     $this->setExpectedException('\Drupal\Core\Config\ConfigPrefixLengthException', String::format($message_text, array(
@@ -80,8 +80,8 @@ public function testConfigPrefixLengthValid() {
     // A provider length of 24 and config_prefix length of 58 (+1 for the .)
     // results in a config length of 83, which is right at the limit.
     $definition = array(
-      'provider' => $this->randomName(24),
-      'config_prefix' => $this->randomName(58),
+      'provider' => $this->randomMachineName(24),
+      'config_prefix' => $this->randomMachineName(58),
     );
     $config_entity = $this->setUpConfigEntityType($definition);
     $expected_prefix = $definition['provider'] . '.' . $definition['config_prefix'];
diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php
index 314e044..47c6825 100644
--- a/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php
@@ -68,7 +68,7 @@ public static function getInfo() {
    * {@inheritdoc}
    */
   public function setUp() {
-    $this->entityType = $this->randomName();
+    $this->entityType = $this->randomMachineName();
 
     $this->entityInfo = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
     $this->entityInfo->expects($this->any())
@@ -90,7 +90,7 @@ public function setUp() {
    * @covers ::calculateDependencies
    */
   public function testCalculateDependencies() {
-    $target_entity_type_id = $this->randomName(16);
+    $target_entity_type_id = $this->randomMachineName(16);
 
     $target_entity_type = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
     $target_entity_type->expects($this->any())
diff --git a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
index 348fbf4..0371ac1 100644
--- a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
@@ -110,8 +110,8 @@ public function setUp() {
       'langcode' => 'en',
       'uuid' => '3bb9ee60-bea5-4622-b89b-a63319d10b3a',
     );
-    $this->entityTypeId = $this->randomName();
-    $this->bundle = $this->randomName();
+    $this->entityTypeId = $this->randomMachineName();
+    $this->bundle = $this->randomMachineName();
 
     $this->entityType = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
 
@@ -258,7 +258,7 @@ public function testPreSaveRevision() {
    * @covers ::getString
    */
   public function testGetString() {
-    $label = $this->randomName();
+    $label = $this->randomMachineName();
     /** @var \Drupal\Core\Entity\ContentEntityBase|\PHPUnit_Framework_MockObject_MockObject $entity */
     $entity = $this->getMockBuilder('\Drupal\Core\Entity\ContentEntityBase')
       ->setMethods(array('label'))
@@ -337,7 +337,7 @@ public function testGetParent() {
    * @covers ::setContext
    */
   public function testSetContext() {
-    $name = $this->randomName();
+    $name = $this->randomMachineName();
     $parent = $this->getMock('\Drupal\Core\TypedData\TypedDataInterface');
     $this->entity->setContext($name, $parent);
   }
@@ -354,7 +354,7 @@ public function testBundle() {
    */
   public function testAccess() {
     $access = $this->getMock('\Drupal\Core\Entity\EntityAccessControllerInterface');
-    $operation = $this->randomName();
+    $operation = $this->randomMachineName();
     $access->expects($this->at(0))
       ->method('access')
       ->with($this->entity, $operation)
@@ -376,7 +376,7 @@ public function testLabel() {
     // Make a mock with one method that we use as the entity's label callback.
     // We check that it is called, and that the entity's label is the callback's
     // return value.
-    $callback_label = $this->randomName();
+    $callback_label = $this->randomMachineName();
     $callback_container = $this->getMock(get_class());
     $callback_container->expects($this->once())
       ->method(__FUNCTION__)
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityListBuilderTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityListBuilderTest.php
index f6d4129..5922be2 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityListBuilderTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityListBuilderTest.php
@@ -99,10 +99,10 @@ protected function setUp() {
    * @covers \Drupal\Core\Entity\EntityListBuilder::getOperations
    */
   public function testGetOperations() {
-    $operation_name = $this->randomName();
+    $operation_name = $this->randomMachineName();
     $operations = array(
       $operation_name => array(
-        'title' => $this->randomName(),
+        'title' => $this->randomMachineName(),
       ),
     );
     $this->moduleHandler->expects($this->once())
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php
index b16008c..fe4d6e1 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php
@@ -822,8 +822,8 @@ public function testGetTranslationFromContext() {
   function testgetExtraFields() {
     $this->setUpEntityManager();
 
-    $entity_type_id = $this->randomName();
-    $bundle = $this->randomName();
+    $entity_type_id = $this->randomMachineName();
+    $bundle = $this->randomMachineName();
     $language_code = 'en';
     $hook_bundle_extra_fields = array(
       $entity_type_id => array(
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php
index 1cb561c..da43b3a 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php
@@ -197,7 +197,7 @@ public function testGetViewBuilderClass() {
    * @covers ::__construct
    */
   public function testIdExceedsMaxLength() {
-    $id = $this->randomName(33);
+    $id = $this->randomMachineName(33);
     $message = 'Attempt to create an entity type with an ID longer than 32 characters: ' . $id;
     $this->setExpectedException('Drupal\Core\Entity\Exception\EntityTypeIdLengthException', $message);
     $this->setUpEntityType(array('id' => $id));
@@ -207,7 +207,7 @@ public function testIdExceedsMaxLength() {
    * @covers ::id
    */
   public function testId() {
-    $id = $this->randomName(32);
+    $id = $this->randomMachineName(32);
     $entity_type = $this->setUpEntityType(array('id' => $id));
     $this->assertEquals($id, $entity_type->id());
   }
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php
index 6ccad14..2299572 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php
@@ -101,7 +101,7 @@ public function setUp() {
       'langcode' => 'en',
       'uuid' => '3bb9ee60-bea5-4622-b89b-a63319d10b3a',
     );
-    $this->entityTypeId = $this->randomName();
+    $this->entityTypeId = $this->randomMachineName();
 
     $this->entityType = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
 
@@ -179,8 +179,8 @@ public function testLabel() {
     // Make a mock with one method that we use as the entity's uri_callback. We
     // check that it is called, and that the entity's label is the callback's
     // return value.
-    $callback_label = $this->randomName();
-    $property_label = $this->randomName();
+    $callback_label = $this->randomMachineName();
+    $property_label = $this->randomMachineName();
     $callback_container = $this->getMock(get_class());
     $callback_container->expects($this->once())
       ->method(__FUNCTION__)
@@ -217,7 +217,7 @@ public function testLabel() {
    */
   public function testAccess() {
     $access = $this->getMock('\Drupal\Core\Entity\EntityAccessControllerInterface');
-    $operation = $this->randomName();
+    $operation = $this->randomMachineName();
     $access->expects($this->at(0))
       ->method('access')
       ->with($this->entity, $operation)
@@ -258,7 +258,7 @@ public function testSave() {
    * @covers ::delete
    */
   public function testDelete() {
-    $this->entity->id = $this->randomName();
+    $this->entity->id = $this->randomMachineName();
     $storage = $this->getMock('\Drupal\Core\Entity\EntityStorageInterface');
     // Testing the argument of the delete() method consumes too much memory.
     $storage->expects($this->once())
diff --git a/core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php b/core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php
index 9637ccb..dda5c6e 100644
--- a/core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php
@@ -49,7 +49,7 @@ public function setUp() {
     // Mock the field type manager and place it in the container.
     $field_type_manager = $this->getMock('Drupal\Core\Field\FieldTypePluginManagerInterface');
 
-    $this->fieldType = $this->randomName();
+    $this->fieldType = $this->randomMachineName();
     $this->fieldTypeDefinition = array(
       'id' => $this->fieldType,
       'settings' => array(
@@ -86,7 +86,7 @@ public function setUp() {
    */
   public function testFieldName() {
     $definition = FieldDefinition::create($this->fieldType);
-    $field_name = $this->randomName();
+    $field_name = $this->randomMachineName();
     $definition->setName($field_name);
     $this->assertEquals($field_name, $definition->getName());
   }
@@ -96,7 +96,7 @@ public function testFieldName() {
    */
   public function testFieldLabel() {
     $definition = FieldDefinition::create($this->fieldType);
-    $label = $this->randomName();
+    $label = $this->randomMachineName();
     $definition->setLabel($label);
     $this->assertEquals($label, $definition->getLabel());
   }
@@ -106,7 +106,7 @@ public function testFieldLabel() {
    */
   public function testFieldDescription() {
     $definition = FieldDefinition::create($this->fieldType);
-    $description = $this->randomName();
+    $description = $this->randomMachineName();
     $definition->setDescription($description);
     $this->assertEquals($description, $definition->getDescription());
   }
@@ -124,8 +124,8 @@ public function testFieldType() {
    */
   public function testFieldSettings() {
     $definition = FieldDefinition::create($this->fieldType);
-    $setting = $this->randomName();
-    $value = $this->randomName();
+    $setting = $this->randomMachineName();
+    $value = $this->randomMachineName();
     $definition->setSetting($setting, $value);
     $this->assertEquals($value, $definition->getSetting($setting));
     $default_settings = $this->fieldTypeDefinition['settings'] + $this->fieldTypeDefinition['instance_settings'];
@@ -150,7 +150,7 @@ public function testDefaultFieldSettings() {
   public function testFieldDefaultValue() {
     $definition = FieldDefinition::create($this->fieldType);
     $setting = 'default_value';
-    $value = $this->randomName();
+    $value = $this->randomMachineName();
     $definition->setSetting($setting, $value);
     $entity = $this->getMockBuilder('Drupal\Core\Entity\Entity')
       ->disableOriginalConstructor()
@@ -211,7 +211,7 @@ public function testFieldRequired() {
    */
   public function testFieldProvider() {
     $definition = FieldDefinition::create($this->fieldType);
-    $provider = $this->randomName();
+    $provider = $this->randomMachineName();
     $definition->setProvider($provider);
     $this->assertEquals($provider, $definition->getProvider());
   }
diff --git a/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php b/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php
index a1d2ff9..bfce901 100644
--- a/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php
@@ -488,14 +488,14 @@ public function testSubmitForm() {
       ->will($this->returnValue($expected_form));
 
     $form_state = array();
-    $form_state['values']['test'] = $this->randomName();
+    $form_state['values']['test'] = $this->randomMachineName();
     $form_state['values']['op'] = 'Submit';
     $this->formBuilder->submitForm($form_arg, $form_state);
     $errors = $this->formBuilder->getErrors($form_state);
     $this->assertNotEmpty($errors['options']);
 
     $form_state = array();
-    $form_state['values']['test'] = $this->randomName();
+    $form_state['values']['test'] = $this->randomMachineName();
     $form_state['values']['options'] = 'foo';
     $form_state['values']['op'] = 'Submit';
     $this->formBuilder->submitForm($form_arg, $form_state);
@@ -503,7 +503,7 @@ public function testSubmitForm() {
     $this->assertEmpty($errors);
 
     $form_state = array();
-    $form_state['values']['test'] = $this->randomName();
+    $form_state['values']['test'] = $this->randomMachineName();
     $form_state['values']['options'] = array('foo');
     $form_state['values']['op'] = 'Submit';
     $this->formBuilder->submitForm($form_arg, $form_state);
@@ -511,7 +511,7 @@ public function testSubmitForm() {
     $this->assertEmpty($errors);
 
     $form_state = array();
-    $form_state['values']['test'] = $this->randomName();
+    $form_state['values']['test'] = $this->randomMachineName();
     $form_state['values']['options'] = array('foo', 'baz');
     $form_state['values']['op'] = 'Submit';
     $this->formBuilder->submitForm($form_arg, $form_state);
@@ -519,8 +519,8 @@ public function testSubmitForm() {
     $this->assertNotEmpty($errors['options']);
 
     $form_state = array();
-    $form_state['values']['test'] = $this->randomName();
-    $form_state['values']['options'] = $this->randomName();
+    $form_state['values']['test'] = $this->randomMachineName();
+    $form_state['values']['options'] = $this->randomMachineName();
     $form_state['values']['op'] = 'Submit';
     $this->formBuilder->submitForm($form_arg, $form_state);
     $errors = $this->formBuilder->getErrors($form_state);
@@ -590,7 +590,7 @@ public function testSetErrorByName($limit_validation_errors, $expected_errors) {
       }));
 
     $form_state = array();
-    $form_state['values']['test'] = $this->randomName();
+    $form_state['values']['test'] = $this->randomMachineName();
     $form_state['values']['options'] = 'foo';
     $form_state['values']['op'] = 'Submit';
     $this->formBuilder->submitForm($form_arg, $form_state);
@@ -646,7 +646,7 @@ public function providerTestGetError() {
       array(array('foo', 'bar'), 'Fail 1'),
       array(array('baz')),
       array(array('baz', 'bim'), 'Fail 3'),
-      array(array($this->randomName())),
+      array(array($this->randomMachineName())),
       array(array()),
     );
   }
diff --git a/core/tests/Drupal/Tests/Core/HttpKernelTest.php b/core/tests/Drupal/Tests/Core/HttpKernelTest.php
index b51e108..d218ddc 100644
--- a/core/tests/Drupal/Tests/Core/HttpKernelTest.php
+++ b/core/tests/Drupal/Tests/Core/HttpKernelTest.php
@@ -51,7 +51,7 @@ public function testSetupSubrequest() {
     $http_kernel = new HttpKernel($dispatcher, $container, $controller_resolver);
 
     $test_controller = '\Drupal\Tests\Core\Controller\TestController';
-    $random_attribute = $this->randomName();
+    $random_attribute = $this->randomMachineName();
     $subrequest = $http_kernel->setupSubrequest($test_controller, array('custom_attribute' => $random_attribute), array('custom_query' => $random_attribute));
     $this->assertNotSame($subrequest, $request, 'The subrequest is not the same as the main request.');
     $this->assertEquals($subrequest->attributes->get('custom_attribute'), $random_attribute, 'Attributes are set from the subrequest.');
diff --git a/core/tests/Drupal/Tests/Core/Language/LanguageUnitTest.php b/core/tests/Drupal/Tests/Core/Language/LanguageUnitTest.php
index 2533330..54db8e4 100644
--- a/core/tests/Drupal/Tests/Core/Language/LanguageUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Language/LanguageUnitTest.php
@@ -51,7 +51,7 @@ public function setUp() {
    * @covers ::setName()
    */
   public function testGetName() {
-    $name = $this->randomName();
+    $name = $this->randomMachineName();
     $this->assertSame($this->language, $this->language->setName($name));
     $this->assertSame($name, $this->language->getName());
   }
@@ -63,7 +63,7 @@ public function testGetName() {
    * @covers ::setId()
    */
   public function testGetLangcode() {
-    $language_code = $this->randomName(2);
+    $language_code = $this->randomMachineName(2);
     $this->assertSame($this->language, $this->language->setId($language_code));
     $this->assertSame($language_code, $this->language->getId());
   }
@@ -99,7 +99,7 @@ public function testIsDefault() {
    * @covers ::setNegotiationMethodId()
    */
   public function testGetNegotiationMethodId() {
-    $method_id = $this->randomName();
+    $method_id = $this->randomMachineName();
     $this->assertSame($this->language, $this->language->setNegotiationMethodId($method_id));
     $this->assertSame($method_id, $this->language->getNegotiationMethodId());
   }
diff --git a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginBagTest.php b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginBagTest.php
index 18eec54..9d68df1 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginBagTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginBagTest.php
@@ -37,7 +37,7 @@ public function testHas() {
     $this->setupPluginBag();
     $definitions = $this->getPluginDefinitions();
 
-    $this->assertFalse($this->defaultPluginBag->has($this->randomName()), 'Nonexistent plugin found.');
+    $this->assertFalse($this->defaultPluginBag->has($this->randomMachineName()), 'Nonexistent plugin found.');
 
     foreach (array_keys($definitions) as $plugin_id) {
       $this->assertTrue($this->defaultPluginBag->has($plugin_id));
diff --git a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php
index bd1efc2..c3b9909 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php
@@ -108,7 +108,7 @@ public function testDefaultPluginManagerWithAlter() {
     $module_handler = $this->getMock('Drupal\Core\Extension\ModuleHandler');
 
     // Configure the stub.
-    $alter_hook_name = $this->randomName();
+    $alter_hook_name = $this->randomMachineName();
     $module_handler->expects($this->once())
       ->method('alter')
       ->with($this->equalTo($alter_hook_name), $this->equalTo($this->expectedDefinitions));
@@ -123,7 +123,7 @@ public function testDefaultPluginManagerWithAlter() {
    * Tests the plugin manager with caching and altering.
    */
   public function testDefaultPluginManagerWithEmptyCache() {
-    $cid = $this->randomName();
+    $cid = $this->randomMachineName();
     $cache_backend = $this->getMockBuilder('Drupal\Core\Cache\MemoryBackend')
       ->disableOriginalConstructor()
       ->getMock();
@@ -155,7 +155,7 @@ public function testDefaultPluginManagerWithEmptyCache() {
    * Tests the plugin manager with caching and altering.
    */
   public function testDefaultPluginManagerWithFilledCache() {
-    $cid = $this->randomName();
+    $cid = $this->randomMachineName();
     $cache_backend = $this->getMockBuilder('Drupal\Core\Cache\MemoryBackend')
       ->disableOriginalConstructor()
       ->getMock();
@@ -185,7 +185,7 @@ public function testDefaultPluginManagerWithFilledCache() {
    * Tests the plugin manager cache clear with tags.
    */
   public function testCacheClearWithTags() {
-    $cid = $this->randomName();
+    $cid = $this->randomMachineName();
     $cache_backend = $this->getMockBuilder('Drupal\Core\Cache\MemoryBackend')
       ->disableOriginalConstructor()
       ->getMock();
diff --git a/core/tests/Drupal/Tests/Core/PrivateKeyTest.php b/core/tests/Drupal/Tests/Core/PrivateKeyTest.php
index 02ac1e6..b42cbb7 100644
--- a/core/tests/Drupal/Tests/Core/PrivateKeyTest.php
+++ b/core/tests/Drupal/Tests/Core/PrivateKeyTest.php
@@ -80,7 +80,7 @@ public function testGetNoState() {
    * Tests PrivateKey::setPrivateKey().
    */
   public function testSet() {
-    $random_name = $this->randomName();
+    $random_name = $this->randomMachineName();
 
     $this->state->expects($this->once())
       ->method('set')
diff --git a/core/tests/Drupal/Tests/Core/Template/AttributeTest.php b/core/tests/Drupal/Tests/Core/Template/AttributeTest.php
index af5e332..14f2e7d 100644
--- a/core/tests/Drupal/Tests/Core/Template/AttributeTest.php
+++ b/core/tests/Drupal/Tests/Core/Template/AttributeTest.php
@@ -92,7 +92,7 @@ public function testIterate() {
   public function testPrint() {
     $attribute = new Attribute(array('class' => array('example-class'), 'id' => 'example-id', 'enabled' => TRUE));
 
-    $content = $this->randomName();
+    $content = $this->randomMachineName();
     $html = '<div' . (string) $attribute . '>' . $content . '</div>';
     $this->assertSelectEquals('div.example-class', $content, 1, $html);
     $this->assertSelectEquals('div.example-class2', $content, 0, $html);
diff --git a/core/tests/Drupal/Tests/UnitTestCase.php b/core/tests/Drupal/Tests/UnitTestCase.php
index 898f40e..669aec0 100644
--- a/core/tests/Drupal/Tests/UnitTestCase.php
+++ b/core/tests/Drupal/Tests/UnitTestCase.php
@@ -66,7 +66,7 @@ protected function setUp() {
    *
    * @see \Drupal\Component\Utility\Random::name()
    */
-  public function randomName($length = 8) {
+  public function randomMachineName($length = 8) {
     return $this->getRandomGenerator()->name($length, TRUE);
   }
 
