diff --git a/core/modules/action/src/Tests/ConfigurationTest.php b/core/modules/action/src/Tests/ConfigurationTest.php
index 512d075..42da0a6 100644
--- a/core/modules/action/src/Tests/ConfigurationTest.php
+++ b/core/modules/action/src/Tests/ConfigurationTest.php
@@ -41,7 +41,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';
@@ -57,7 +57,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/src/Tests/AggregatorTestBase.php b/core/modules/aggregator/src/Tests/AggregatorTestBase.php
index de0cd6a..f150616 100644
--- a/core/modules/aggregator/src/Tests/AggregatorTestBase.php
+++ b/core/modules/aggregator/src/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/src/Tests/FeedParserTest.php b/core/modules/aggregator/src/Tests/FeedParserTest.php
index 9ecccf6..734c898 100644
--- a/core/modules/aggregator/src/Tests/FeedParserTest.php
+++ b/core/modules/aggregator/src/Tests/FeedParserTest.php
@@ -81,7 +81,7 @@ function testHtmlEntitiesSample() {
   function testRedirectFeed() {
     // Simulate a typo in the URL to force a curl exception.
     $invalid_url = url('aggregator/redirect', array('absolute' => TRUE));
-    $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();
     $feed->refreshItems();
 
@@ -95,7 +95,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/src/Tests/Views/IntegrationTest.php b/core/modules/aggregator/src/Tests/Views/IntegrationTest.php
index 8775023..5084bdf 100644
--- a/core/modules/aggregator/src/Tests/Views/IntegrationTest.php
+++ b/core/modules/aggregator/src/Tests/Views/IntegrationTest.php
@@ -63,11 +63,11 @@ protected function setUp() {
    */
   public function testAggregatorItemView() {
     $feed = $this->feedStorage->create(array(
-      'title' => $this->randomName(),
+      'title' => $this->randomMachineName(),
       'url' => 'http://drupal.org/',
       'refresh' => 900,
       'checked' => 123543535,
-      'description' => $this->randomName(),
+      'description' => $this->randomMachineName(),
     ));
     $feed->save();
 
@@ -77,10 +77,10 @@ public function testAggregatorItemView() {
       $values = array();
       $values['fid'] = $feed->id();
       $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/src/Tests/Authentication/BasicAuthTest.php b/core/modules/basic_auth/src/Tests/Authentication/BasicAuthTest.php
index ad70e3e..77e732a 100644
--- a/core/modules/basic_auth/src/Tests/Authentication/BasicAuthTest.php
+++ b/core/modules/basic_auth/src/Tests/Authentication/BasicAuthTest.php
@@ -34,7 +34,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/src/Tests/BlockCacheTest.php b/core/modules/block/src/Tests/BlockCacheTest.php
index 635a03b..863524f 100644
--- a/core/modules/block/src/Tests/BlockCacheTest.php
+++ b/core/modules/block/src/Tests/BlockCacheTest.php
@@ -64,7 +64,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('');
@@ -72,7 +72,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.');
@@ -85,7 +85,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('');
@@ -112,14 +112,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();
@@ -135,7 +135,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.
@@ -143,7 +143,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.');
@@ -158,7 +158,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);
 
@@ -166,7 +166,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('');
@@ -190,14 +190,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('test-page');
     $this->assertText($current_content, 'Block content displays on the test 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/src/Tests/BlockConfigSchemaTest.php b/core/modules/block/src/Tests/BlockConfigSchemaTest.php
index 61408da..2be1a6d 100644
--- a/core/modules/block/src/Tests/BlockConfigSchemaTest.php
+++ b/core/modules/block/src/Tests/BlockConfigSchemaTest.php
@@ -65,7 +65,7 @@ protected function setUp() {
    */
   public function testBlockConfigSchema() {
     foreach ($this->blockManager->getDefinitions() as $block_id => $definition) {
-      $id = strtolower($this->randomName());
+      $id = strtolower($this->randomMachineName());
       $block = Block::create(array(
         'id' => $id,
         'theme' => 'stark',
@@ -74,7 +74,7 @@ public function testBlockConfigSchema() {
         'region' => 'content',
         'plugin' => $block_id,
         'settings' => array(
-          'label' => $this->randomName(),
+          'label' => $this->randomMachineName(),
           'provider' => 'system',
           'label_display' => FALSE,
         ),
diff --git a/core/modules/block/src/Tests/BlockHookOperationTest.php b/core/modules/block/src/Tests/BlockHookOperationTest.php
index 8baf88a..286f191 100644
--- a/core/modules/block/src/Tests/BlockHookOperationTest.php
+++ b/core/modules/block/src/Tests/BlockHookOperationTest.php
@@ -42,7 +42,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/src/Tests/BlockHtmlTest.php b/core/modules/block/src/Tests/BlockHtmlTest.php
index 5e508e5..c3d0bae 100644
--- a/core/modules/block/src/Tests/BlockHtmlTest.php
+++ b/core/modules/block/src/Tests/BlockHtmlTest.php
@@ -30,7 +30,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/src/Tests/BlockLanguageCacheTest.php b/core/modules/block/src/Tests/BlockLanguageCacheTest.php
index f9e3bbc..c223780 100644
--- a/core/modules/block/src/Tests/BlockLanguageCacheTest.php
+++ b/core/modules/block/src/Tests/BlockLanguageCacheTest.php
@@ -65,7 +65,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/src/Tests/BlockLanguageTest.php b/core/modules/block/src/Tests/BlockLanguageTest.php
index 527cbf8..226b748 100644
--- a/core/modules/block/src/Tests/BlockLanguageTest.php
+++ b/core/modules/block/src/Tests/BlockLanguageTest.php
@@ -57,7 +57,7 @@ public function testLanguageBlockVisibility() {
     // Enable a standard block and set the visibility setting for one language.
     $edit = array(
       'settings[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/src/Tests/BlockTest.php b/core/modules/block/src/Tests/BlockTest.php
index 8f04738..ebd4a7c 100644
--- a/core/modules/block/src/Tests/BlockTest.php
+++ b/core/modules/block/src/Tests/BlockTest.php
@@ -24,11 +24,11 @@ class BlockTest extends BlockTestBase {
   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,
     );
@@ -65,11 +65,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,
       'settings[visibility][request_path][negate]' => TRUE,
@@ -98,7 +98,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';
 
@@ -161,7 +161,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'));
@@ -198,8 +198,8 @@ function testThemeName() {
   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/src/Tests/BlockTitleXSSTest.php b/core/modules/block/src/Tests/BlockTitleXSSTest.php
index c295857..9eca4b5 100644
--- a/core/modules/block/src/Tests/BlockTitleXSSTest.php
+++ b/core/modules/block/src/Tests/BlockTitleXSSTest.php
@@ -33,7 +33,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/src/Tests/BlockUiTest.php b/core/modules/block/src/Tests/BlockUiTest.php
index d2408da..78ad748 100644
--- a/core/modules/block/src/Tests/BlockUiTest.php
+++ b/core/modules/block/src/Tests/BlockUiTest.php
@@ -194,7 +194,7 @@ public function testMachineNameSuggestion() {
   public function testBlockPlacementIndicator() {
     // Select the 'Powered by Drupal' block to be placed.
     $block = array();
-    $block['id'] = strtolower($this->randomName());
+    $block['id'] = strtolower($this->randomMachineName());
     $block['theme'] = 'stark';
     $block['region'] = 'content';
 
diff --git a/core/modules/block/src/Tests/BlockViewBuilderTest.php b/core/modules/block/src/Tests/BlockViewBuilderTest.php
index 2109058..38969e8 100644
--- a/core/modules/block/src/Tests/BlockViewBuilderTest.php
+++ b/core/modules/block/src/Tests/BlockViewBuilderTest.php
@@ -225,7 +225,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();
@@ -239,7 +239,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/src/Tests/NewDefaultThemeBlocksTest.php b/core/modules/block/src/Tests/NewDefaultThemeBlocksTest.php
index cc4f911..9a6642c 100644
--- a/core/modules/block/src/Tests/NewDefaultThemeBlocksTest.php
+++ b/core/modules/block/src/Tests/NewDefaultThemeBlocksTest.php
@@ -31,15 +31,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/src/Tests/Views/DisplayBlockTest.php b/core/modules/block/src/Tests/Views/DisplayBlockTest.php
index 77b2300..92e7dda 100644
--- a/core/modules/block/src/Tests/Views/DisplayBlockTest.php
+++ b/core/modules/block/src/Tests/Views/DisplayBlockTest.php
@@ -52,7 +52,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/src/BlockBaseTest.php b/core/modules/block/tests/src/BlockBaseTest.php
index 7d9b31e..fdc3e31 100644
--- a/core/modules/block/tests/src/BlockBaseTest.php
+++ b/core/modules/block/tests/src/BlockBaseTest.php
@@ -89,7 +89,7 @@ public function testConditionsBagInitialization() {
 
     $this->assertEquals(4, $conditions_bag->count(), "There are 4 condition plugins");
 
-    $instance_id = $this->randomName();
+    $instance_id = $this->randomMachineName();
     $pages = 'node/1';
     $condition_config = array('id' => 'request_path', 'pages' => $pages);
     $block_base->setVisibilityConfig($instance_id, $condition_config);
diff --git a/core/modules/block/tests/src/BlockConfigEntityUnitTest.php b/core/modules/block/tests/src/BlockConfigEntityUnitTest.php
index e3fd154..01abb68 100644
--- a/core/modules/block/tests/src/BlockConfigEntityUnitTest.php
+++ b/core/modules/block/tests/src/BlockConfigEntityUnitTest.php
@@ -49,7 +49,7 @@ class BlockConfigEntityUnitTest extends UnitTestCase {
    * {@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())
@@ -81,7 +81,7 @@ public function testCalculateDependencies() {
       ->setMethods(array('getPluginBags'))
       ->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/block/tests/src/Plugin/DisplayVariant/FullPageVariantTest.php b/core/modules/block/tests/src/Plugin/DisplayVariant/FullPageVariantTest.php
index 9b45337..94dbed3 100644
--- a/core/modules/block/tests/src/Plugin/DisplayVariant/FullPageVariantTest.php
+++ b/core/modules/block/tests/src/Plugin/DisplayVariant/FullPageVariantTest.php
@@ -72,7 +72,7 @@ public function setUpDisplayVariant($configuration = array(), $definition = arra
    * @covers ::getRegionAssignments
    */
   public function testBuild() {
-    $theme = $this->randomName();
+    $theme = $this->randomMachineName();
     $display_variant = $this->setUpDisplayVariant();
     $this->themeNegotiator->expects($this->any())
       ->method('determineActiveTheme')
diff --git a/core/modules/block_content/src/Tests/BlockContentCreationTest.php b/core/modules/block_content/src/Tests/BlockContentCreationTest.php
index 9b3d914..1f59984 100644
--- a/core/modules/block_content/src/Tests/BlockContentCreationTest.php
+++ b/core/modules/block_content/src/Tests/BlockContentCreationTest.php
@@ -53,7 +53,7 @@ public function testBlockContentCreation() {
     // 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.
@@ -97,8 +97,8 @@ public function testBlockContentCreation() {
    */
   public function testDefaultBlockContentCreation() {
     $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'));
 
@@ -157,8 +157,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'));
 
@@ -190,8 +190,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'));
 
@@ -200,8 +200,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_content/src/Tests/BlockContentFieldTest.php b/core/modules/block_content/src/Tests/BlockContentFieldTest.php
index 28f010b..2b8023c 100644
--- a/core/modules/block_content/src/Tests/BlockContentFieldTest.php
+++ b/core/modules/block_content/src/Tests/BlockContentFieldTest.php
@@ -55,7 +55,7 @@ public function testBlockFields() {
 
     // Create a field with settings to validate.
     $this->fieldStorage = entity_create('field_storage_config', array(
-      'name' => drupal_strtolower($this->randomName()),
+      'name' => drupal_strtolower($this->randomMachineName()),
       'entity_type' => 'block_content',
       'type' => 'link',
       'cardinality' => 2,
@@ -84,7 +84,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->fieldStorage->getName() . '[0][url]' => 'http://example.com',
       $this->fieldStorage->getName() . '[0][title]' => 'Example.com'
     );
diff --git a/core/modules/block_content/src/Tests/BlockContentListTest.php b/core/modules/block_content/src/Tests/BlockContentListTest.php
index b956147..07a3299 100644
--- a/core/modules/block_content/src/Tests/BlockContentListTest.php
+++ b/core/modules/block_content/src/Tests/BlockContentListTest.php
@@ -57,7 +57,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_content/src/Tests/BlockContentRevisionsTest.php b/core/modules/block_content/src/Tests/BlockContentRevisionsTest.php
index 745a2d3..79233f3 100644
--- a/core/modules/block_content/src/Tests/BlockContentRevisionsTest.php
+++ b/core/modules/block_content/src/Tests/BlockContentRevisionsTest.php
@@ -46,7 +46,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();
@@ -80,7 +80,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_content/src/Tests/BlockContentSaveTest.php b/core/modules/block_content/src/Tests/BlockContentSaveTest.php
index 8d2608e..f2a845b 100644
--- a/core/modules/block_content/src/Tests/BlockContentSaveTest.php
+++ b/core/modules/block_content/src/Tests/BlockContentSaveTest.php
@@ -39,10 +39,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 {block_content}')->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_content/src/Tests/BlockContentTestBase.php b/core/modules/block_content/src/Tests/BlockContentTestBase.php
index 4f77de4..5bb7122 100644
--- a/core/modules/block_content/src/Tests/BlockContentTestBase.php
+++ b/core/modules/block_content/src/Tests/BlockContentTestBase.php
@@ -63,7 +63,7 @@ protected function setUp() {
    *   Created custom block.
    */
   protected function createBlockContent($title = FALSE, $bundle = 'basic') {
-    $title = ($title ? : $this->randomName());
+    $title = ($title ? : $this->randomMachineName());
     if ($block_content = entity_create('block_content', array(
       'info' => $title,
       'type' => $bundle,
diff --git a/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php b/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php
index 006b710..96fbbdd 100644
--- a/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php
+++ b/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php
@@ -41,7 +41,7 @@ class BlockContentTranslationUITest extends ContentTranslationUITest {
   public function setUp() {
     $this->entityTypeId = 'block_content';
     $this->bundle = 'basic';
-    $this->name = drupal_strtolower($this->randomName());
+    $this->name = drupal_strtolower($this->randomMachineName());
     $this->testLanguageSelector = FALSE;
     parent::setUp();
   }
@@ -72,7 +72,7 @@ public function getTranslatorPermissions() {
    *   Created custom block.
    */
   protected function createBlockContent($title = FALSE, $bundle = FALSE) {
-    $title = ($title ? : $this->randomName());
+    $title = ($title ? : $this->randomMachineName());
     $bundle = ($bundle ? : $this->bundle);
     $block_content = entity_create('block_content', array(
       'info' => $title,
@@ -109,7 +109,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('block_content_type', array(
       'id' => $disabled_bundle,
       'label' => $disabled_bundle,
diff --git a/core/modules/block_content/src/Tests/BlockContentTypeTest.php b/core/modules/block_content/src/Tests/BlockContentTypeTest.php
index ce8298f..b36d009 100644
--- a/core/modules/block_content/src/Tests/BlockContentTypeTest.php
+++ b/core/modules/block_content/src/Tests/BlockContentTypeTest.php
@@ -169,7 +169,7 @@ public function testsBlockContentAddTypes() {
           $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)) {
@@ -190,7 +190,7 @@ public function testsBlockContentAddTypes() {
     $this->drupalGet('admin/structure/block/block-content');
     $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_content/src/Tests/PageEditTest.php b/core/modules/block_content/src/Tests/PageEditTest.php
index 2bbd9db..9ad7662 100644
--- a/core/modules/block_content/src/Tests/PageEditTest.php
+++ b/core/modules/block_content/src/Tests/PageEditTest.php
@@ -24,8 +24,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.
@@ -40,16 +40,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/book/src/Tests/BookTest.php b/core/modules/book/src/Tests/BookTest.php
index b72a046..9b426ae 100644
--- a/core/modules/book/src/Tests/BookTest.php
+++ b/core/modules/book/src/Tests/BookTest.php
@@ -255,8 +255,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->randomName(32);
     $edit['book[bid]'] = $book_nid;
 
     if ($parent !== NULL) {
diff --git a/core/modules/breakpoint/src/Tests/BreakpointAPITest.php b/core/modules/breakpoint/src/Tests/BreakpointAPITest.php
index 8ec2b11..abfb430 100644
--- a/core/modules/breakpoint/src/Tests/BreakpointAPITest.php
+++ b/core/modules/breakpoint/src/Tests/BreakpointAPITest.php
@@ -25,7 +25,7 @@ class BreakpointAPITest extends BreakpointTestBase {
    */
   public function testConfigName() {
     // Try an invalid sourceType.
-    $label = $this->randomName();
+    $label = $this->randomMachineName();
     $breakpoint = entity_create('breakpoint', array(
       'label' => $label,
       'name' => Unicode::strtolower($label),
@@ -59,7 +59,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 {
@@ -72,7 +72,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/src/Tests/BreakpointCRUDTest.php b/core/modules/breakpoint/src/Tests/BreakpointCRUDTest.php
index 24f96d6..5b46d3d 100644
--- a/core/modules/breakpoint/src/Tests/BreakpointCRUDTest.php
+++ b/core/modules/breakpoint/src/Tests/BreakpointCRUDTest.php
@@ -21,7 +21,7 @@ class BreakpointCRUDTest extends BreakpointTestBase {
    */
   public function testBreakpointCRUD() {
     // Add a breakpoint with minimum data only.
-    $label = $this->randomName();
+    $label = $this->randomMachineName();
     $breakpoint = entity_create('breakpoint', array(
       'label' => $label,
       'mediaQuery' => '(min-width: 600px)',
diff --git a/core/modules/breakpoint/src/Tests/BreakpointGroupAPITest.php b/core/modules/breakpoint/src/Tests/BreakpointGroupAPITest.php
index 1742203..f8a0191 100644
--- a/core/modules/breakpoint/src/Tests/BreakpointGroupAPITest.php
+++ b/core/modules/breakpoint/src/Tests/BreakpointGroupAPITest.php
@@ -26,7 +26,7 @@ class BreakpointGroupAPITest extends BreakpointGroupTestBase {
    */
   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/src/Tests/BreakpointGroupCRUDTest.php b/core/modules/breakpoint/src/Tests/BreakpointGroupCRUDTest.php
index 21724aa..aa949de 100644
--- a/core/modules/breakpoint/src/Tests/BreakpointGroupCRUDTest.php
+++ b/core/modules/breakpoint/src/Tests/BreakpointGroupCRUDTest.php
@@ -26,7 +26,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)",
       ));
@@ -34,7 +34,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/src/BreakpointConfigEntityUnitTest.php b/core/modules/breakpoint/tests/src/BreakpointConfigEntityUnitTest.php
index a9aec44..4ba41b5 100644
--- a/core/modules/breakpoint/tests/src/BreakpointConfigEntityUnitTest.php
+++ b/core/modules/breakpoint/tests/src/BreakpointConfigEntityUnitTest.php
@@ -56,7 +56,7 @@ class BreakpointConfigEntityUnitTest extends UnitTestCase {
    * {@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())
@@ -114,7 +114,7 @@ public function testCalculateDependenciesTheme() {
    */
   public function testNameException () {
     new Breakpoint(array(
-      'label' => $this->randomName(),
+      'label' => $this->randomMachineName(),
       'source' => 'custom_module',
       'sourceType' => 'oops',
     ));
diff --git a/core/modules/breakpoint/tests/src/BreakpointGroupConfigEntityUnitTest.php b/core/modules/breakpoint/tests/src/BreakpointGroupConfigEntityUnitTest.php
index e66541d..685c951 100644
--- a/core/modules/breakpoint/tests/src/BreakpointGroupConfigEntityUnitTest.php
+++ b/core/modules/breakpoint/tests/src/BreakpointGroupConfigEntityUnitTest.php
@@ -57,7 +57,7 @@ class BreakpointGroupConfigEntityUnitTest extends UnitTestCase {
    * {@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())
@@ -149,7 +149,7 @@ public function testCalculateDependenciesTheme() {
    */
   public function testNameException () {
     new BreakpointGroup(array(
-      'label' => $this->randomName(),
+      'label' => $this->randomMachineName(),
       'source' => 'custom_module',
       'sourceType' => 'oops',
     ));
diff --git a/core/modules/comment/src/Tests/CommentActionsTest.php b/core/modules/comment/src/Tests/CommentActionsTest.php
index 77ecfe9..67618da 100644
--- a/core/modules/comment/src/Tests/CommentActionsTest.php
+++ b/core/modules/comment/src/Tests/CommentActionsTest.php
@@ -28,8 +28,8 @@ class CommentActionsTest extends CommentTestBase {
    */
   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.
@@ -48,11 +48,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),
@@ -61,7 +61,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/src/Tests/CommentAdminTest.php b/core/modules/comment/src/Tests/CommentAdminTest.php
index b5815c8..d7a8d4e 100644
--- a/core/modules/comment/src/Tests/CommentAdminTest.php
+++ b/core/modules/comment/src/Tests/CommentAdminTest.php
@@ -33,8 +33,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.');
 
@@ -62,8 +62,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->randomName(), TRUE);
+    $comments[] = $this->postComment($this->node, $this->randomMachineName(), $this->randomName(), TRUE);
 
     // Publish multiple comments in one operation.
     $this->drupalLogin($this->admin_user);
@@ -110,8 +110,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/src/Tests/CommentAnonymousTest.php b/core/modules/comment/src/Tests/CommentAnonymousTest.php
index f4018f9..94bbdac 100644
--- a/core/modules/comment/src/Tests/CommentAnonymousTest.php
+++ b/core/modules/comment/src/Tests/CommentAnonymousTest.php
@@ -39,7 +39,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->randomName());
     $this->assertTrue($this->commentExists($anonymous_comment1), 'Anonymous comment without contact info found.');
 
     // Allow contact info.
@@ -48,7 +48,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->randomName());
     $this->assertTrue($this->commentExists($edited_comment, FALSE), 'Modified reply found.');
     $this->drupalLogout();
 
@@ -56,15 +56,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->randomName());
     $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[0][value]' => $this->randomName(),
-      'comment_body[0][value]' => $this->randomName(),
+      'mail' => $this->randomMachineName() . '@example.com',
+      'subject[0][value]' => $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.'));
@@ -78,15 +78,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->randomName(), TRUE);
     // Name should have 'Anonymous' for value by default.
     $this->assertText(t('Email field is required.'), 'Email 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->randomName(), 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/src/Tests/CommentBlockTest.php b/core/modules/comment/src/Tests/CommentBlockTest.php
index da09f69..8e5c853 100644
--- a/core/modules/comment/src/Tests/CommentBlockTest.php
+++ b/core/modules/comment/src/Tests/CommentBlockTest.php
@@ -48,8 +48,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/src/Tests/CommentBookTest.php b/core/modules/comment/src/Tests/CommentBookTest.php
index 193c999..3ba3795 100644
--- a/core/modules/comment/src/Tests/CommentBookTest.php
+++ b/core/modules/comment/src/Tests/CommentBookTest.php
@@ -43,8 +43,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/src/Tests/CommentCSSTest.php b/core/modules/comment/src/Tests/CommentCSSTest.php
index 98a027b..29cb87a 100644
--- a/core/modules/comment/src/Tests/CommentCSSTest.php
+++ b/core/modules/comment/src/Tests/CommentCSSTest.php
@@ -52,9 +52,9 @@ function testCommentClasses() {
         'field_name' => 'comment',
         'uid' => $case['comment_uid'],
         'status' => $case['comment_status'],
-        'subject' => $this->randomName(),
+        'subject' => $this->randomMachineName(),
         'language' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
-        'comment_body' => array(LanguageInterface::LANGCODE_NOT_SPECIFIED => array($this->randomName())),
+        'comment_body' => array(LanguageInterface::LANGCODE_NOT_SPECIFIED => array($this->randomMachineName())),
       ));
       $comment->save();
 
diff --git a/core/modules/comment/src/Tests/CommentDefaultFormatterCacheTagsTest.php b/core/modules/comment/src/Tests/CommentDefaultFormatterCacheTagsTest.php
index 1e60dac..787631b 100644
--- a/core/modules/comment/src/Tests/CommentDefaultFormatterCacheTagsTest.php
+++ b/core/modules/comment/src/Tests/CommentDefaultFormatterCacheTagsTest.php
@@ -57,7 +57,7 @@ public function setUp() {
    */
   public function testCacheTags() {
     // Create the entity that will be commented upon.
-    $commented_entity = entity_create('entity_test', array('name' => $this->randomName()));
+    $commented_entity = entity_create('entity_test', array('name' => $this->randomMachineName()));
     $commented_entity->save();
 
     // Verify cache tags on the rendered entity before it has comments.
diff --git a/core/modules/comment/src/Tests/CommentFieldsTest.php b/core/modules/comment/src/Tests/CommentFieldsTest.php
index e0fd255..255e47c 100644
--- a/core/modules/comment/src/Tests/CommentFieldsTest.php
+++ b/core/modules/comment/src/Tests/CommentFieldsTest.php
@@ -111,7 +111,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->randomName());
   }
 
   /**
@@ -131,7 +131,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/src/Tests/CommentInterfaceTest.php b/core/modules/comment/src/Tests/CommentInterfaceTest.php
index 1455d8d..b2a944f 100644
--- a/core/modules/comment/src/Tests/CommentInterfaceTest.php
+++ b/core/modules/comment/src/Tests/CommentInterfaceTest.php
@@ -32,7 +32,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.');
 
@@ -45,15 +45,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->randomName(), TRUE);
     $this->assertTrue($this->commentExists($anonymous_comment), 'Comment found.');
     $anonymous_comment->delete();
 
@@ -79,7 +79,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());
@@ -103,7 +103,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.');
@@ -114,7 +114,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->randomName(), TRUE);
     $reply_loaded = Comment::load($reply->id());
     $this->assertTrue($this->commentExists($reply, TRUE), 'Second reply found.');
     // Check the thread of second reply grows correctly.
@@ -124,7 +124,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->randomName(), 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.
@@ -132,12 +132,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->randomName(), 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->randomName(), 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');
@@ -188,7 +188,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->randomName(), TRUE);
     $this->assertTrue($this->commentExists($form_comment), 'Form comment found.');
 
     // Disable comment form on node page.
diff --git a/core/modules/comment/src/Tests/CommentLanguageTest.php b/core/modules/comment/src/Tests/CommentLanguageTest.php
index cd130b2..a12194a 100644
--- a/core/modules/comment/src/Tests/CommentLanguageTest.php
+++ b/core/modules/comment/src/Tests/CommentLanguageTest.php
@@ -89,10 +89,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,
       );
@@ -103,9 +103,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[0][value]' => $this->randomName(),
+          'subject[0][value]' => $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/src/Tests/CommentLinksAlterTest.php b/core/modules/comment/src/Tests/CommentLinksAlterTest.php
index af6d6b6..34c9faa 100644
--- a/core/modules/comment/src/Tests/CommentLinksAlterTest.php
+++ b/core/modules/comment/src/Tests/CommentLinksAlterTest.php
@@ -28,8 +28,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/src/Tests/CommentLinksTest.php b/core/modules/comment/src/Tests/CommentLinksTest.php
index af5fed7..fe4b5aa 100644
--- a/core/modules/comment/src/Tests/CommentLinksTest.php
+++ b/core/modules/comment/src/Tests/CommentLinksTest.php
@@ -144,10 +144,10 @@ function setEnvironment(array $info) {
           'pid' => 0,
           'uid' => 0,
           'status' => CommentInterface::PUBLISHED,
-          'subject' => $this->randomName(),
+          'subject' => $this->randomMachineName(),
           'hostname' => '127.0.0.1',
           'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
-          'comment_body' => array(LanguageInterface::LANGCODE_NOT_SPECIFIED => array($this->randomName())),
+          'comment_body' => array(LanguageInterface::LANGCODE_NOT_SPECIFIED => array($this->randomMachineName())),
         ));
         $comment->save();
         $this->comment = $comment;
diff --git a/core/modules/comment/src/Tests/CommentNewIndicatorTest.php b/core/modules/comment/src/Tests/CommentNewIndicatorTest.php
index d8450d2..59c21ff 100644
--- a/core/modules/comment/src/Tests/CommentNewIndicatorTest.php
+++ b/core/modules/comment/src/Tests/CommentNewIndicatorTest.php
@@ -92,10 +92,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' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
-      'comment_body' => array(LanguageInterface::LANGCODE_NOT_SPECIFIED => array($this->randomName())),
+      'comment_body' => array(LanguageInterface::LANGCODE_NOT_SPECIFIED => array($this->randomMachineName())),
     ));
     $comment->save();
     $this->drupalLogout();
diff --git a/core/modules/comment/src/Tests/CommentNodeAccessTest.php b/core/modules/comment/src/Tests/CommentNodeAccessTest.php
index e13c4e7..111c70f 100644
--- a/core/modules/comment/src/Tests/CommentNodeAccessTest.php
+++ b/core/modules/comment/src/Tests/CommentNodeAccessTest.php
@@ -59,8 +59,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.');
 
@@ -71,8 +71,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/src/Tests/CommentNodeChangesTest.php b/core/modules/comment/src/Tests/CommentNodeChangesTest.php
index 4652c66..87031ad 100644
--- a/core/modules/comment/src/Tests/CommentNodeChangesTest.php
+++ b/core/modules/comment/src/Tests/CommentNodeChangesTest.php
@@ -21,7 +21,7 @@ class CommentNodeChangesTest extends CommentTestBase {
    */
   function testNodeDeletion() {
     $this->drupalLogin($this->web_user);
-    $comment = $this->postComment($this->node, $this->randomName(), $this->randomName());
+    $comment = $this->postComment($this->node, $this->randomMachineName(), $this->randomName());
     $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/src/Tests/CommentNonNodeTest.php b/core/modules/comment/src/Tests/CommentNonNodeTest.php
index 89cf0c7..45a79ad 100644
--- a/core/modules/comment/src/Tests/CommentNonNodeTest.php
+++ b/core/modules/comment/src/Tests/CommentNonNodeTest.php
@@ -71,7 +71,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();
@@ -247,7 +247,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->randomName());
     $this->assertTrue($this->commentExists($comment1), 'Comment on test entity exists.');
 
     // Assert the breadcrumb is valid.
@@ -270,7 +270,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->randomName());
     $this->assertTrue($this->commentExists($comment1), 'Comment on test entity exists.');
 
     // Check that the comment was found.
@@ -402,7 +402,7 @@ function testCommentFunctionality() {
     $this->assertEqual($field_storage->getSetting('comment_type'), '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/src/Tests/CommentPagerTest.php b/core/modules/comment/src/Tests/CommentPagerTest.php
index ab37998..b1175af 100644
--- a/core/modules/comment/src/Tests/CommentPagerTest.php
+++ b/core/modules/comment/src/Tests/CommentPagerTest.php
@@ -29,9 +29,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->randomName(), TRUE);
+    $comments[] = $this->postComment($node, $this->randomMachineName(), $this->randomName(), TRUE);
+    $comments[] = $this->postComment($node, $this->randomMachineName(), $this->randomName(), TRUE);
 
     $this->setCommentSettings('default_mode', CommentManagerInterface::COMMENT_MODE_FLAT, 'Comment paging changed.');
 
@@ -62,7 +62,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->randomName(), TRUE);
 
     $this->setCommentsPerPage(2);
     // We are still in flat view - the replies should not be on the first page,
@@ -80,7 +80,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->randomName(), 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.');
 
@@ -104,25 +104,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->randomName(), TRUE);
+    $comments[] = $this->postComment($node, $this->randomMachineName(), $this->randomName(), TRUE);
+    $comments[] = $this->postComment($node, $this->randomMachineName(), $this->randomName(), 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->randomName(), 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->randomName(), 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->randomName(), 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->randomName(), TRUE);
 
     // At this point, the comment tree is:
     // - 0
@@ -204,21 +204,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->randomName(), TRUE);
+    $comments[] = $this->postComment($node, $this->randomMachineName(), $this->randomName(), TRUE);
+    $comments[] = $this->postComment($node, $this->randomMachineName(), $this->randomName(), 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->randomName(), 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->randomName(), 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->randomName(), TRUE);
 
     // At this point, the comment tree is:
     // - 0
diff --git a/core/modules/comment/src/Tests/CommentPreviewTest.php b/core/modules/comment/src/Tests/CommentPreviewTest.php
index aec0350..8d188c3 100644
--- a/core/modules/comment/src/Tests/CommentPreviewTest.php
+++ b/core/modules/comment/src/Tests/CommentPreviewTest.php
@@ -42,7 +42,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);
@@ -50,8 +50,8 @@ function testCommentPreview() {
 
     // As the web user, fill in the comment form and preview the comment.
     $edit = array();
-    $edit['subject[0][value]'] = $this->randomName(8);
-    $edit['comment_body[0][value]'] = $this->randomName(16);
+    $edit['subject[0][value]'] = $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.
@@ -83,8 +83,8 @@ function testCommentEditPreviewSave() {
 
     $edit = array();
     $date = new DrupalDateTime('2008-03-02 17:23');
-    $edit['subject[0][value]'] = $this->randomName(8);
-    $edit['comment_body[0][value]'] = $this->randomName(16);
+    $edit['subject[0][value]'] = $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/src/Tests/CommentRssTest.php b/core/modules/comment/src/Tests/CommentRssTest.php
index 6c0cec1..1f261e3 100644
--- a/core/modules/comment/src/Tests/CommentRssTest.php
+++ b/core/modules/comment/src/Tests/CommentRssTest.php
@@ -29,7 +29,7 @@ class CommentRssTest extends CommentTestBase {
   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->randomName());
     $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/src/Tests/CommentStatisticsTest.php b/core/modules/comment/src/Tests/CommentStatisticsTest.php
index 1ddd79c..865bbfb 100644
--- a/core/modules/comment/src/Tests/CommentStatisticsTest.php
+++ b/core/modules/comment/src/Tests/CommentStatisticsTest.php
@@ -53,7 +53,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.
@@ -76,7 +76,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.
@@ -97,7 +97,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->randomName()));
     $comment_loaded = Comment::load($anonymous_comment->id());
 
     // Checks the new values of node comment statistics with comment #3.
diff --git a/core/modules/comment/src/Tests/CommentThreadingTest.php b/core/modules/comment/src/Tests/CommentThreadingTest.php
index d944797..69bc650 100644
--- a/core/modules/comment/src/Tests/CommentThreadingTest.php
+++ b/core/modules/comment/src/Tests/CommentThreadingTest.php
@@ -33,8 +33,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.');
@@ -45,7 +45,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/');
@@ -54,7 +54,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->randomName(), 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/');
@@ -64,7 +64,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/');
@@ -73,8 +73,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.');
@@ -85,7 +85,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/');
@@ -94,7 +94,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->randomName(), 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/');
@@ -104,7 +104,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/src/Tests/CommentTitleTest.php b/core/modules/comment/src/Tests/CommentTitleTest.php
index 770350f..4d1416b 100644
--- a/core/modules/comment/src/Tests/CommentTitleTest.php
+++ b/core/modules/comment/src/Tests/CommentTitleTest.php
@@ -31,8 +31,8 @@ public function testCommentEmptyTitles() {
     $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'uid' => $this->web_user->id()));
 
     // Post comment #1 and verify that h3's are not rendered.
-    $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);
     // Confirm that the comment was created.
     $regex = '/<a id="comment-' . $comment->id() . '"(.*?)';
@@ -57,8 +57,8 @@ public function testCommentPopulatedTitles() {
     $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'uid' => $this->web_user->id()));
 
     // Post comment #1 and verify that title is rendered in h3.
-    $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.
     $this->assertTrue($this->commentExists($comment1), 'Comment #1. Comment found.');
diff --git a/core/modules/comment/src/Tests/CommentTokenReplaceTest.php b/core/modules/comment/src/Tests/CommentTokenReplaceTest.php
index 1e4ac3a..196a9f0 100644
--- a/core/modules/comment/src/Tests/CommentTokenReplaceTest.php
+++ b/core/modules/comment/src/Tests/CommentTokenReplaceTest.php
@@ -36,11 +36,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->randomName(), 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->randomName());
     $comment = Comment::load($child_comment->id());
     $comment->setHomepage('http://example.org/');
 
diff --git a/core/modules/comment/src/Tests/CommentTranslationUITest.php b/core/modules/comment/src/Tests/CommentTranslationUITest.php
index 207b69c..c11ae85 100644
--- a/core/modules/comment/src/Tests/CommentTranslationUITest.php
+++ b/core/modules/comment/src/Tests/CommentTranslationUITest.php
@@ -35,7 +35,7 @@ function setUp() {
     $this->nodeBundle = 'article';
     $this->bundle = 'comment_article';
     $this->testLanguageSelector = FALSE;
-    $this->subject = $this->randomName();
+    $this->subject = $this->randomMachineName();
     parent::setUp();
   }
 
@@ -107,7 +107,7 @@ protected function getNewEntityValues($langcode) {
     // Comment subject is not translatable hence we use a fixed value.
     return array(
       'subject' => array(array('value' => $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/src/Tests/CommentValidationTest.php b/core/modules/comment/src/Tests/CommentValidationTest.php
index 391fe08..4b5153c 100644
--- a/core/modules/comment/src/Tests/CommentValidationTest.php
+++ b/core/modules/comment/src/Tests/CommentValidationTest.php
@@ -79,7 +79,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();
@@ -112,7 +112,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/src/Tests/Views/WizardTest.php b/core/modules/comment/src/Tests/Views/WizardTest.php
index 7613a0f..d959752 100644
--- a/core/modules/comment/src/Tests/Views/WizardTest.php
+++ b/core/modules/comment/src/Tests/Views/WizardTest.php
@@ -41,11 +41,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.
@@ -71,7 +71,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/src/Tests/ConfigDiffTest.php b/core/modules/config/src/Tests/ConfigDiffTest.php
index 960eb3c..7fda716 100644
--- a/core/modules/config/src/Tests/ConfigDiffTest.php
+++ b/core/modules/config/src/Tests/ConfigDiffTest.php
@@ -83,10 +83,10 @@ function testDiff() {
     $this->assertEqual($edits[1]->closing[0], $add_key . ': ' . $add_data, format_string("The staging value for key '%add_key' is '%add_data'.", array('%add_key' => $add_key, '%add_data' => $add_data)));
 
     // Test diffing a renamed config entity.
-    $test_entity_id = $this->randomName();
+    $test_entity_id = $this->randomMachineName();
     $test_entity = entity_create('config_test', array(
       'id' => $test_entity_id,
-      'label' => $this->randomName(),
+      'label' => $this->randomMachineName(),
     ));
     $test_entity->save();
     $data = $active->read('config_test.dynamic.' . $test_entity_id);
@@ -99,7 +99,7 @@ function testDiff() {
     $this->assertEqual(count($edits), 1, 'There is one item in the diff');
 
     // Rename the entity.
-    $new_test_entity_id = $this->randomName();
+    $new_test_entity_id = $this->randomMachineName();
     $test_entity->set('id', $new_test_entity_id);
     $test_entity->save();
 
diff --git a/core/modules/config/src/Tests/ConfigEntityStatusTest.php b/core/modules/config/src/Tests/ConfigEntityStatusTest.php
index 21c7828..3ad7bfb 100644
--- a/core/modules/config/src/Tests/ConfigEntityStatusTest.php
+++ b/core/modules/config/src/Tests/ConfigEntityStatusTest.php
@@ -28,7 +28,7 @@ class ConfigEntityStatusTest extends DrupalUnitTestBase {
    */
   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/src/Tests/ConfigEntityStatusUITest.php b/core/modules/config/src/Tests/ConfigEntityStatusUITest.php
index a4ae953..32065cf 100644
--- a/core/modules/config/src/Tests/ConfigEntityStatusUITest.php
+++ b/core/modules/config/src/Tests/ConfigEntityStatusUITest.php
@@ -28,10 +28,10 @@ class ConfigEntityStatusUITest extends WebTestBase {
    * 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/src/Tests/ConfigEntityTest.php b/core/modules/config/src/Tests/ConfigEntityTest.php
index f444868..3d207b2 100644
--- a/core/modules/config/src/Tests/ConfigEntityTest.php
+++ b/core/modules/config/src/Tests/ConfigEntityTest.php
@@ -94,9 +94,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->assertTrue($config_test->uuid());
     $this->assertNotEqual($config_test->uuid(), $empty->uuid());
@@ -146,7 +146,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();
@@ -160,7 +160,7 @@ function testCRUD() {
 
     // Test with an ID of the maximum allowed length.
     $id_length_config_test = entity_create('config_test', array(
-      'id' => $this->randomName(static::MAX_ID_LENGTH),
+      'id' => $this->randomMachineName(static::MAX_ID_LENGTH),
     ));
     try {
       $id_length_config_test->save();
@@ -174,7 +174,7 @@ function testCRUD() {
 
     // Test with an ID exeeding the maximum allowed length.
     $id_length_config_test = entity_create('config_test', array(
-      'id' => $this->randomName(static::MAX_ID_LENGTH + 1),
+      'id' => $this->randomMachineName(static::MAX_ID_LENGTH + 1),
     ));
     try {
       $status = $id_length_config_test->save();
@@ -204,7 +204,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->randomName(4));
     for ($i = 1; $i < 3; $i++) {
       $old_id = $ids[$i - 1];
       $new_id = $ids[$i];
@@ -234,10 +234,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));
@@ -291,7 +291,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/src/Tests/ConfigEntityUnitTest.php b/core/modules/config/src/Tests/ConfigEntityUnitTest.php
index 4a3574a..6c39bb4 100644
--- a/core/modules/config/src/Tests/ConfigEntityUnitTest.php
+++ b/core/modules/config/src/Tests/ConfigEntityUnitTest.php
@@ -55,20 +55,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/src/Tests/ConfigExportImportUITest.php b/core/modules/config/src/Tests/ConfigExportImportUITest.php
index 18bee10..6d1ad7c 100644
--- a/core/modules/config/src/Tests/ConfigExportImportUITest.php
+++ b/core/modules/config/src/Tests/ConfigExportImportUITest.php
@@ -63,7 +63,7 @@ public function testExportImport() {
     $this->content_type = $this->drupalCreateContentType();
 
     // Create a field.
-    $this->fieldName = drupal_strtolower($this->randomName());
+    $this->fieldName = drupal_strtolower($this->randomMachineName());
     $this->fieldStorage = entity_create('field_storage_config', array(
       'name' => $this->fieldName,
       'entity_type' => 'node',
@@ -112,7 +112,7 @@ public function testExportImport() {
     $this->assertNoFieldByName("{$this->fieldName}[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');
@@ -140,7 +140,7 @@ public function testExportImportCollections() {
     // Export the configuration.
     $this->drupalPostForm('admin/config/development/configuration/full/export', array(), 'Export');
     $this->tarball = $this->drupalGetContent();
-    $filename = file_directory_temp() .'/' . $this->randomName();
+    $filename = file_directory_temp() .'/' . $this->randomMachineName();
     file_put_contents($filename, $this->tarball);
 
     // Set up the active storage collections to test import.
diff --git a/core/modules/config/src/Tests/ConfigFileContentTest.php b/core/modules/config/src/Tests/ConfigFileContentTest.php
index 0cc51dd..dd931b4 100644
--- a/core/modules/config/src/Tests/ConfigFileContentTest.php
+++ b/core/modules/config/src/Tests/ConfigFileContentTest.php
@@ -183,7 +183,7 @@ function testReadWriteConfig() {
    * Tests serialization of configuration to file.
    */
   function testSerialization() {
-    $name = $this->randomName(10) . '.' . $this->randomName(10);
+    $name = $this->randomMachineName(10) . '.' . $this->randomName(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/src/Tests/ConfigImportRecreateTest.php b/core/modules/config/src/Tests/ConfigImportRecreateTest.php
index 9e58ee6..4dcf90c 100644
--- a/core/modules/config/src/Tests/ConfigImportRecreateTest.php
+++ b/core/modules/config/src/Tests/ConfigImportRecreateTest.php
@@ -59,7 +59,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/src/Tests/ConfigImportRenameValidationTest.php b/core/modules/config/src/Tests/ConfigImportRenameValidationTest.php
index a0bbb67..1dff818 100644
--- a/core/modules/config/src/Tests/ConfigImportRenameValidationTest.php
+++ b/core/modules/config/src/Tests/ConfigImportRenameValidationTest.php
@@ -68,10 +68,10 @@ public function setUp() {
    */
   public function testRenameValidation() {
     // Create a test entity.
-    $test_entity_id = $this->randomName();
+    $test_entity_id = $this->randomMachineName();
     $test_entity = entity_create('config_test', array(
       'id' => $test_entity_id,
-      'label' => $this->randomName(),
+      'label' => $this->randomMachineName(),
     ));
     $test_entity->save();
     $uuid = $test_entity->uuid();
@@ -84,8 +84,8 @@ public function testRenameValidation() {
 
     // Create a content type with a matching UUID in the active storage.
     $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(),
       'uuid' => $uuid,
     ));
     $content_type->save();
diff --git a/core/modules/config/src/Tests/ConfigLanguageOverrideWebTest.php b/core/modules/config/src/Tests/ConfigLanguageOverrideWebTest.php
index 8607ac1..8a1446a 100644
--- a/core/modules/config/src/Tests/ConfigLanguageOverrideWebTest.php
+++ b/core/modules/config/src/Tests/ConfigLanguageOverrideWebTest.php
@@ -32,7 +32,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/src/Tests/ConfigTranslationListUiTest.php b/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php
index 6618503..444274b 100644
--- a/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php
+++ b/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php
@@ -90,7 +90,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.
@@ -113,8 +113,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' => '',
@@ -159,9 +159,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();
 
@@ -184,8 +184,8 @@ public function doCustomContentTypeListTest() {
     // Create a test custom block type to decouple looking for translate
     // operations link so this does not test more than necessary.
     $block_content_type = entity_create('block_content_type', array(
-      'id' => Unicode::strtolower($this->randomName(16)),
-      'label' => $this->randomName(),
+      'id' => Unicode::strtolower($this->randomMachineName(16)),
+      'label' => $this->randomMachineName(),
       'revision' => FALSE
     ));
     $block_content_type->save();
@@ -209,8 +209,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();
 
@@ -233,8 +233,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();
 
@@ -257,8 +257,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();
 
@@ -281,7 +281,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();
@@ -304,7 +304,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.
@@ -361,7 +361,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'));
@@ -385,8 +385,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/src/Tests/ConfigTranslationOverviewTest.php b/core/modules/config_translation/src/Tests/ConfigTranslationOverviewTest.php
index 38c0644..a7f1c0b 100644
--- a/core/modules/config_translation/src/Tests/ConfigTranslationOverviewTest.php
+++ b/core/modules/config_translation/src/Tests/ConfigTranslationOverviewTest.php
@@ -77,7 +77,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/src/Tests/ConfigTranslationUiTest.php b/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php
index e0a0ddb..9253420 100644
--- a/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php
+++ b/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php
@@ -566,7 +566,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/src/Tests/ContactPersonalTest.php b/core/modules/contact/src/Tests/ContactPersonalTest.php
index eb033bd..3306418 100644
--- a/core/modules/contact/src/Tests/ContactPersonalTest.php
+++ b/core/modules/contact/src/Tests/ContactPersonalTest.php
@@ -247,10 +247,10 @@ protected function checkContactAccess($response, $contact_value = NULL) {
     else {
       $this->assertNoFieldChecked('edit-contact--2');
     }
-    $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' => FALSE,
@@ -280,8 +280,8 @@ protected function checkContactAccess($response, $contact_value = NULL) {
    */
   protected function submitPersonalContact(AccountInterface $account, array $message = array()) {
     $message += array(
-      'subject[0][value]' => $this->randomName(16),
-      'message[0][value]' => $this->randomName(64),
+      'subject[0][value]' => $this->randomMachineName(16),
+      'message[0][value]' => $this->randomMachineName(64),
     );
     $this->drupalPostForm('user/' . $account->id() . '/contact', $message, t('Send message'));
     return $message;
diff --git a/core/modules/contact/src/Tests/ContactSitewideTest.php b/core/modules/contact/src/Tests/ContactSitewideTest.php
index 2be4208..9e6b866 100644
--- a/core/modules/contact/src/Tests/ContactSitewideTest.php
+++ b/core/modules/contact/src/Tests/ContactSitewideTest.php
@@ -93,7 +93,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->randomName(16), $invalid_recipient, '', FALSE);
       $this->assertRaw(t('%recipient is an invalid email address.', array('%recipient' => $invalid_recipient)));
     }
 
@@ -107,13 +107,13 @@ function testSiteWideContact() {
     $recipients = array('simpletest@example.com', 'simpletest2@example.com', 'simpletest3@example.com');
     $max_length = EntityTypeInterface::BUNDLE_MAX_LENGTH;
     $max_length_exceeded = $max_length + 1;
-    $this->addCategory($id = drupal_strtolower($this->randomName($max_length_exceeded)), $label = $this->randomName($max_length_exceeded), implode(',', array($recipients[0])), '', TRUE);
+    $this->addCategory($id = drupal_strtolower($this->randomMachineName($max_length_exceeded)), $label = $this->randomName($max_length_exceeded), implode(',', array($recipients[0])), '', TRUE);
     $this->assertText(format_string('Machine-readable name cannot be longer than !max characters but is currently !exceeded characters long.', array('!max' => $max_length, '!exceeded' => $max_length_exceeded)));
-    $this->addCategory($id = drupal_strtolower($this->randomName($max_length)), $label = $this->randomName($max_length), implode(',', array($recipients[0])), '', TRUE);
+    $this->addCategory($id = drupal_strtolower($this->randomMachineName($max_length)), $label = $this->randomName($max_length), implode(',', array($recipients[0])), '', TRUE);
     $this->assertRaw(t('Category %label has been added.', array('%label' => $label)));
 
     // Create first valid category.
-    $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->randomName(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.
@@ -125,7 +125,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->randomName(30), FALSE);
     $config = \Drupal::config('contact.category.' . $id)->get();
     $this->assertEqual($config['label'], $label);
     $this->assertEqual($config['recipients'], array($recipients[0], $recipients[1]));
@@ -148,10 +148,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->randomName(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->randomName(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.
@@ -176,19 +176,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->randomName(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->randomName(16), $id, $this->randomName(64));
     $this->assertText(t('Your email 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->randomName(16), $id, $this->randomName(64));
     $this->assertRaw(t('The email 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->randomName(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->randomName(16), $id, '');
     $this->assertText(t('Message field is required.'));
 
     // Test contact form with no default category selected.
@@ -201,12 +201,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->randomName(16), $id, $this->randomName(64));
       $this->assertText(t('Your message has been sent.'));
     }
     // Submit contact form one over limit.
@@ -219,9 +219,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'));
@@ -245,8 +245,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]'];
@@ -260,9 +260,9 @@ function testSiteWideContact() {
 
     // Submit the contact form and verify the content.
     $edit = array(
-      'subject[0][value]' => $this->randomName(),
-      'message[0][value]' => $this->randomName(),
-      $field_name . '[0][value]' => $this->randomName(),
+      'subject[0][value]' => $this->randomMachineName(),
+      'message[0][value]' => $this->randomMachineName(),
+      $field_name . '[0][value]' => $this->randomMachineName(),
     );
     $this->drupalPostForm(NULL, $edit, t('Send message'));
     $mails = $this->drupalGetMails();
@@ -281,8 +281,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);
@@ -292,9 +292,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 email going to the sender.
     $captured_emails = $this->drupalGetMails(array('id' => 'contact_page_autoreply', 'to' => $email));
@@ -302,8 +302,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 email to the sender.
     $captured_emails = $this->drupalGetMails(array('id' => 'contact_page_autoreply', 'to' => $email));
@@ -311,8 +311,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/src/Tests/ContactStorageTest.php b/core/modules/contact/src/Tests/ContactStorageTest.php
index c5784a7..9d6c48a 100644
--- a/core/modules/contact/src/Tests/ContactStorageTest.php
+++ b/core/modules/contact/src/Tests/ContactStorageTest.php
@@ -49,7 +49,7 @@ public function testContactStorage() {
     $this->drupalLogin($admin_user);
     // Create first valid category.
     $mail = 'simpletest@example.com';
-    $this->addCategory($id = drupal_strtolower($this->randomName(16)), $label = $this->randomName(16), implode(',', array($mail)), '', TRUE);
+    $this->addCategory($id = drupal_strtolower($this->randomMachineName(16)), $label = $this->randomName(16), implode(',', array($mail)), '', TRUE);
     $this->assertRaw(t('Category %label has been added.', array('%label' => $label)));
 
     // Ensure that anonymous can submit site-wide contact form.
@@ -58,7 +58,7 @@ public function testContactStorage() {
     $this->drupalGet('contact');
     $this->assertText(t('Your email address'));
     $this->assertNoText(t('Category'));
-    $this->submitContact($name = $this->randomName(16), $mail, $subject = $this->randomName(16), $id, $message = $this->randomName(64));
+    $this->submitContact($name = $this->randomMachineName(16), $mail, $subject = $this->randomName(16), $id, $message = $this->randomName(64));
     $this->assertText(t('Your message has been sent.'));
 
     $messages = Message::loadMultiple();
diff --git a/core/modules/contact/src/Tests/Views/ContactFieldsTest.php b/core/modules/contact/src/Tests/Views/ContactFieldsTest.php
index da0175e..e74ec90 100644
--- a/core/modules/contact/src/Tests/Views/ContactFieldsTest.php
+++ b/core/modules/contact/src/Tests/Views/ContactFieldsTest.php
@@ -35,7 +35,7 @@ protected function setUp() {
     parent::setUp();
 
     $this->field_storage = entity_create('field_storage_config', array(
-      'name' => strtolower($this->randomName()),
+      'name' => strtolower($this->randomMachineName()),
       'entity_type' => 'contact_message',
       'type' => 'text'
     ));
diff --git a/core/modules/content_translation/src/Tests/ContentTestTranslationUITest.php b/core/modules/content_translation/src/Tests/ContentTestTranslationUITest.php
index 2120885..d26d971 100644
--- a/core/modules/content_translation/src/Tests/ContentTestTranslationUITest.php
+++ b/core/modules/content_translation/src/Tests/ContentTestTranslationUITest.php
@@ -43,7 +43,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/src/Tests/ContentTranslationContextualLinksTest.php b/core/modules/content_translation/src/Tests/ContentTranslationContextualLinksTest.php
index ab821d2..d845c42 100644
--- a/core/modules/content_translation/src/Tests/ContentTranslationContextualLinksTest.php
+++ b/core/modules/content_translation/src/Tests/ContentTranslationContextualLinksTest.php
@@ -57,7 +57,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/src/Tests/ContentTranslationSyncImageTest.php b/core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php
index f8edf5c..0751bb6 100644
--- a/core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php
+++ b/core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php
@@ -121,7 +121,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,
     );
@@ -149,8 +149,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);
 
@@ -175,8 +175,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);
 
@@ -211,8 +211,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/src/Tests/ContentTranslationSyncUnitTest.php b/core/modules/content_translation/src/Tests/ContentTranslationSyncUnitTest.php
index f06a83b..b05b446 100644
--- a/core/modules/content_translation/src/Tests/ContentTranslationSyncUnitTest.php
+++ b/core/modules/content_translation/src/Tests/ContentTranslationSyncUnitTest.php
@@ -95,7 +95,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/src/Tests/ContentTranslationUITest.php b/core/modules/content_translation/src/Tests/ContentTranslationUITest.php
index 10b56cb..27e8bc5 100644
--- a/core/modules/content_translation/src/Tests/ContentTranslationUITest.php
+++ b/core/modules/content_translation/src/Tests/ContentTranslationUITest.php
@@ -213,7 +213,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));
@@ -243,7 +243,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/src/Tests/ContentTranslationWorkflowsTest.php b/core/modules/content_translation/src/Tests/ContentTranslationWorkflowsTest.php
index 89e43b6..baa52b7 100644
--- a/core/modules/content_translation/src/Tests/ContentTranslationWorkflowsTest.php
+++ b/core/modules/content_translation/src/Tests/ContentTranslationWorkflowsTest.php
@@ -52,9 +52,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/src/Tests/DateTimeFieldTest.php b/core/modules/datetime/src/Tests/DateTimeFieldTest.php
index 7de2742..eefd3c3 100644
--- a/core/modules/datetime/src/Tests/DateTimeFieldTest.php
+++ b/core/modules/datetime/src/Tests/DateTimeFieldTest.php
@@ -53,7 +53,7 @@ function setUp() {
 
     // Create a field with settings to validate.
     $this->fieldStorage = entity_create('field_storage_config', array(
-      'name' => drupal_strtolower($this->randomName()),
+      'name' => drupal_strtolower($this->randomMachineName()),
       'entity_type' => 'entity_test',
       'type' => 'datetime',
       'settings' => array('datetime_type' => 'date'),
@@ -102,7 +102,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'));
@@ -171,7 +171,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),
     );
@@ -260,7 +260,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';
@@ -290,7 +290,7 @@ function testDefaultValue() {
 
     // Create a field storage with settings to validate.
     $field_storage = entity_create('field_storage_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/src/Tests/DateTimeItemTest.php b/core/modules/datetime/src/Tests/DateTimeItemTest.php
index e12e6f5..ad46561 100644
--- a/core/modules/datetime/src/Tests/DateTimeItemTest.php
+++ b/core/modules/datetime/src/Tests/DateTimeItemTest.php
@@ -54,7 +54,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.
@@ -66,7 +66,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/src/Tests/DbLogTest.php b/core/modules/dblog/src/Tests/DbLogTest.php
index 683479f..59af275 100644
--- a/core/modules/dblog/src/Tests/DbLogTest.php
+++ b/core/modules/dblog/src/Tests/DbLogTest.php
@@ -222,7 +222,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).
@@ -291,7 +291,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.
@@ -377,16 +377,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;
     }
@@ -404,7 +404,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;
   }
@@ -460,7 +460,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/src/Tests/Views/ViewsIntegrationTest.php b/core/modules/dblog/src/Tests/Views/ViewsIntegrationTest.php
index de7405f..0b9a63b 100644
--- a/core/modules/dblog/src/Tests/Views/ViewsIntegrationTest.php
+++ b/core/modules/dblog/src/Tests/Views/ViewsIntegrationTest.php
@@ -57,20 +57,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->randomName()),
       // 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/editor/src/Tests/EditorFileReferenceFilterTest.php b/core/modules/editor/src/Tests/EditorFileReferenceFilterTest.php
index 214f1e3..e03066e 100644
--- a/core/modules/editor/src/Tests/EditorFileReferenceFilterTest.php
+++ b/core/modules/editor/src/Tests/EditorFileReferenceFilterTest.php
@@ -53,13 +53,13 @@ function testEditorFileReferenceFilter() {
       return $filter->process($input, 'und');
     };
 
-    file_put_contents('public://llama.jpg', $this->randomName());
+    file_put_contents('public://llama.jpg', $this->randomMachineName());
     $image = entity_create('file', array('uri' => 'public://llama.jpg'));
     $image->save();
     $id = $image->id();
     $uuid = $image->uuid();
 
-    file_put_contents('public://alpaca.jpg', $this->randomName());
+    file_put_contents('public://alpaca.jpg', $this->randomMachineName());
     $image_2 = entity_create('file', array('uri' => 'public://alpaca.jpg'));
     $image_2->save();
     $id_2 = $image_2->id();
diff --git a/core/modules/editor/src/Tests/EditorLoadingTest.php b/core/modules/editor/src/Tests/EditorLoadingTest.php
index 9a2038f..e714595 100644
--- a/core/modules/editor/src/Tests/EditorLoadingTest.php
+++ b/core/modules/editor/src/Tests/EditorLoadingTest.php
@@ -135,7 +135,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/src/EditorConfigEntityUnitTest.php b/core/modules/editor/tests/src/EditorConfigEntityUnitTest.php
index c10e1ac..deb5bdc 100644
--- a/core/modules/editor/tests/src/EditorConfigEntityUnitTest.php
+++ b/core/modules/editor/tests/src/EditorConfigEntityUnitTest.php
@@ -70,8 +70,8 @@ class EditorConfigEntityUnitTest extends UnitTestCase {
    * {@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/src/Tests/EntityDisplayModeTest.php b/core/modules/entity/src/Tests/EntityDisplayModeTest.php
index 583d114..fb26524 100644
--- a/core/modules/entity/src/Tests/EntityDisplayModeTest.php
+++ b/core/modules/entity/src/Tests/EntityDisplayModeTest.php
@@ -45,7 +45,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->randomName()),
       'label' => $this->randomString(),
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -53,7 +53,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'));
@@ -91,7 +91,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->randomName()),
       'label' => $this->randomString(),
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -99,7 +99,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/src/Tests/EntityReferenceAdminTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceAdminTest.php
index 348bf4a..8846095 100644
--- a/core/modules/entity_reference/src/Tests/EntityReferenceAdminTest.php
+++ b/core/modules/entity_reference/src/Tests/EntityReferenceAdminTest.php
@@ -34,7 +34,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/src/Tests/EntityReferenceAutoCreateTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceAutoCreateTest.php
index a16b421..0014ca2 100644
--- a/core/modules/entity_reference/src/Tests/EntityReferenceAutoCreateTest.php
+++ b/core/modules/entity_reference/src/Tests/EntityReferenceAutoCreateTest.php
@@ -80,7 +80,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');
@@ -93,7 +93,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/src/Tests/EntityReferenceFieldDefaultValueTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceFieldDefaultValueTest.php
index b93f322..f34a7dd 100644
--- a/core/modules/entity_reference/src/Tests/EntityReferenceFieldDefaultValueTest.php
+++ b/core/modules/entity_reference/src/Tests/EntityReferenceFieldDefaultValueTest.php
@@ -43,7 +43,7 @@ function testEntityReferenceDefaultValue() {
     $referenced_node = $this->drupalCreateNode(array('type' => 'referenced_content'));
 
     $this->fieldStorage = entity_create('field_storage_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/src/Tests/EntityReferenceFormatterTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceFormatterTest.php
index e3653bb..28919d5 100644
--- a/core/modules/entity_reference/src/Tests/EntityReferenceFormatterTest.php
+++ b/core/modules/entity_reference/src/Tests/EntityReferenceFormatterTest.php
@@ -86,7 +86,7 @@ public function setUp() {
     ))->save();
 
     // Create the entity to be referenced.
-    $this->referencedEntity = entity_create($this->entityType, array('name' => $this->randomName()));
+    $this->referencedEntity = entity_create($this->entityType, array('name' => $this->randomMachineName()));
     $this->referencedEntity->body = array(
       'value' => '<p>Hello, world!</p>',
       'format' => 'full_html',
@@ -100,7 +100,7 @@ public function setUp() {
   public function testAccess() {
     $field_name = $this->fieldName;
 
-    $referencing_entity = entity_create($this->entityType, array('name' => $this->randomName()));
+    $referencing_entity = entity_create($this->entityType, array('name' => $this->randomMachineName()));
     $referencing_entity->save();
     $referencing_entity->{$field_name}->entity = $this->referencedEntity;
 
@@ -134,7 +134,7 @@ public function testIdFormatter() {
     $field_name = $this->fieldName;
 
     // Create the entity that will have the entity reference field.
-    $referencing_entity = entity_create($this->entityType, array('name' => $this->randomName()));
+    $referencing_entity = entity_create($this->entityType, array('name' => $this->randomMachineName()));
     $referencing_entity->save();
     $referencing_entity->{$field_name}->entity = $this->referencedEntity;
     $referencing_entity->{$field_name}->access = TRUE;
@@ -159,7 +159,7 @@ public function testEntityFormatter() {
     $field_name = $this->fieldName;
 
     // Create the entity that will have the entity reference field.
-    $referencing_entity = entity_create($this->entityType, array('name' => $this->randomName()));
+    $referencing_entity = entity_create($this->entityType, array('name' => $this->randomMachineName()));
     $referencing_entity->save();
     $referencing_entity->{$field_name}->entity = $this->referencedEntity;
     $referencing_entity->{$field_name}->access = TRUE;
diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceIntegrationTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceIntegrationTest.php
index cfe4042..c55d79c 100644
--- a/core/modules/entity_reference/src/Tests/EntityReferenceIntegrationTest.php
+++ b/core/modules/entity_reference/src/Tests/EntityReferenceIntegrationTest.php
@@ -68,7 +68,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),
@@ -90,7 +90,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() . ')';
       // Test an input of the entity label without a ' (entity_id)' suffix.
       $target_id .= ', ' . $referenced_entities[1]->label();
@@ -155,14 +155,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/src/Tests/EntityReferenceItemTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceItemTest.php
index 5e497fe..63fd88b 100644
--- a/core/modules/entity_reference/src/Tests/EntityReferenceItemTest.php
+++ b/core/modules/entity_reference/src/Tests/EntityReferenceItemTest.php
@@ -49,14 +49,14 @@ public function setUp() {
     $this->installEntitySchema('taxonomy_term');
 
     $this->vocabulary = entity_create('taxonomy_vocabulary', array(
-      'name' => $this->randomName(),
-      'vid' => drupal_strtolower($this->randomName()),
+      'name' => $this->randomMachineName(),
+      'vid' => drupal_strtolower($this->randomMachineName()),
       'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
     ));
     $this->vocabulary->save();
 
     $this->term = entity_create('taxonomy_term', array(
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       'vid' => $this->vocabulary->id(),
       'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
     ));
@@ -76,7 +76,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());
@@ -88,7 +88,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.
@@ -97,7 +97,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' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
     ));
@@ -110,7 +110,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();
   }
 
@@ -123,7 +123,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());
@@ -135,7 +135,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.
@@ -144,8 +144,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' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
     ));
     $vocabulary2->save();
@@ -157,7 +157,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/src/Tests/Boolean/BooleanFieldTest.php b/core/modules/field/src/Tests/Boolean/BooleanFieldTest.php
index 3ef06b7..f505e55 100644
--- a/core/modules/field/src/Tests/Boolean/BooleanFieldTest.php
+++ b/core/modules/field/src/Tests/Boolean/BooleanFieldTest.php
@@ -58,12 +58,12 @@ function setUp() {
    * Tests boolean field.
    */
   function testBooleanField() {
-    $on = $this->randomName();
-    $off = $this->randomName();
-    $label = $this->randomName();
+    $on = $this->randomMachineName();
+    $off = $this->randomMachineName();
+    $label = $this->randomMachineName();
 
     // Create a field with settings to validate.
-    $field_name = drupal_strtolower($this->randomName());
+    $field_name = drupal_strtolower($this->randomMachineName());
     $this->field = FieldStorageConfig::create(array(
       'name' => $field_name,
       'entity_type' => 'entity_test',
@@ -104,7 +104,7 @@ function testBooleanField() {
     // Submit and ensure it is accepted.
     $edit = array(
       'user_id' => 1,
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       "{$field_name}[value]" => 1,
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
diff --git a/core/modules/field/src/Tests/Boolean/BooleanItemTest.php b/core/modules/field/src/Tests/Boolean/BooleanItemTest.php
index 60cb878..02760d5 100644
--- a/core/modules/field/src/Tests/Boolean/BooleanItemTest.php
+++ b/core/modules/field/src/Tests/Boolean/BooleanItemTest.php
@@ -52,7 +52,7 @@ public function testBooleanItem() {
     $entity = entity_create('entity_test');
     $value = '1';
     $entity->field_boolean = $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/src/Tests/DisplayApiTest.php b/core/modules/field/src/Tests/DisplayApiTest.php
index 1172e21..41189e4 100644
--- a/core/modules/field/src/Tests/DisplayApiTest.php
+++ b/core/modules/field/src/Tests/DisplayApiTest.php
@@ -63,7 +63,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_storage = array(
@@ -83,13 +83,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(),
         ),
       ),
     );
@@ -133,7 +133,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,
       ),
     );
@@ -153,7 +153,7 @@ function testFieldItemListView() {
       'label' => 'visually_hidden',
       'type' => 'field_test_multiple',
       'settings' => array(
-        'test_formatter_setting_multiple' => $this->randomName(),
+        'test_formatter_setting_multiple' => $this->randomMachineName(),
         'alter' => TRUE,
       ),
     );
@@ -173,7 +173,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(),
       ),
     );
     $this->render($items->view($display));
@@ -220,7 +220,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'];
@@ -234,7 +234,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'];
@@ -272,7 +272,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/src/Tests/Email/EmailFieldTest.php b/core/modules/field/src/Tests/Email/EmailFieldTest.php
index 93e65f9..97c620f 100644
--- a/core/modules/field/src/Tests/Email/EmailFieldTest.php
+++ b/core/modules/field/src/Tests/Email/EmailFieldTest.php
@@ -53,7 +53,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->fieldStorage = entity_create('field_storage_config', array(
       'name' => $field_name,
       'entity_type' => 'entity_test',
@@ -91,7 +91,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/src/Tests/Email/EmailItemTest.php b/core/modules/field/src/Tests/Email/EmailItemTest.php
index ecca155..20bb137 100644
--- a/core/modules/field/src/Tests/Email/EmailItemTest.php
+++ b/core/modules/field/src/Tests/Email/EmailItemTest.php
@@ -56,7 +56,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.
@@ -68,7 +68,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/src/Tests/FieldAttachOtherTest.php b/core/modules/field/src/Tests/FieldAttachOtherTest.php
index 7356bce..eaf9ca1 100644
--- a/core/modules/field/src/Tests/FieldAttachOtherTest.php
+++ b/core/modules/field/src/Tests/FieldAttachOtherTest.php
@@ -56,7 +56,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',
@@ -66,7 +66,7 @@ function testEntityDisplayBuild() {
     );
     $display->setComponent($this->field_name, $display_options);
 
-    $formatter_setting_2 = $this->randomName();
+    $formatter_setting_2 = $this->randomMachineName();
     $display_options_2 = array(
       'label' => 'above',
       'type' => 'field_test_default',
@@ -108,7 +108,7 @@ function testEntityDisplayBuild() {
 
     // Multiple formatter.
     $entity = clone($entity_init);
-    $formatter_setting = $this->randomName();
+    $formatter_setting = $this->randomMachineName();
     $display->setComponent($this->field_name, array(
       'label' => 'above',
       'type' => 'field_test_multiple',
@@ -126,7 +126,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_name, array(
       'label' => 'above',
       'type' => 'field_test_with_prepare_view',
diff --git a/core/modules/field/src/Tests/FieldAttachStorageTest.php b/core/modules/field/src/Tests/FieldAttachStorageTest.php
index 05db62e..c4173b4 100644
--- a/core/modules/field/src/Tests/FieldAttachStorageTest.php
+++ b/core/modules/field/src/Tests/FieldAttachStorageTest.php
@@ -296,7 +296,7 @@ function testEntityCreateRenameBundle() {
     $cardinality = $this->field_storage->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.
@@ -313,7 +313,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.
@@ -335,7 +335,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.
@@ -343,7 +343,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_storage = array(
       'name' => $field_name,
       'entity_type' => $entity_type,
@@ -355,8 +355,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/src/Tests/FieldDataCountTest.php b/core/modules/field/src/Tests/FieldDataCountTest.php
index da72e0b..8e6e62e 100644
--- a/core/modules/field/src/Tests/FieldDataCountTest.php
+++ b/core/modules/field/src/Tests/FieldDataCountTest.php
@@ -56,7 +56,7 @@ public function testEntityCountAndHasData() {
 
     // Create 1 entity without the field.
     $entity = entity_create('entity_test');
-    $entity->name->value = $this->randomName();
+    $entity->name->value = $this->randomMachineName();
     $entity->save();
 
     $this->assertIdentical($field_storage->hasdata(), FALSE, 'There are no entities with field data.');
@@ -69,7 +69,7 @@ public function testEntityCountAndHasData() {
       $value2 = mt_rand(1,99);
       $entity->field_int[0]->value = $value;
       $entity->field_int[1]->value = $value2;
-      $entity->name->value = $this->randomName();
+      $entity->name->value = $this->randomMachineName();
       $entity->save();
     }
 
diff --git a/core/modules/field/src/Tests/FieldImportDeleteUninstallTest.php b/core/modules/field/src/Tests/FieldImportDeleteUninstallTest.php
index 56ce852..c26d912 100644
--- a/core/modules/field/src/Tests/FieldImportDeleteUninstallTest.php
+++ b/core/modules/field/src/Tests/FieldImportDeleteUninstallTest.php
@@ -67,7 +67,7 @@ public function testImportDeleteUninstall() {
     $value = '+0123456789';
     $entity->field_test = $value;
     $entity->field_int = '99';
-    $entity->name->value = $this->randomName();
+    $entity->name->value = $this->randomMachineName();
     $entity->save();
 
     // Verify entity has been created properly.
@@ -130,7 +130,7 @@ public function testImportAlreadyDeletedUninstall() {
       $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/field/src/Tests/FieldImportDeleteUninstallUiTest.php b/core/modules/field/src/Tests/FieldImportDeleteUninstallUiTest.php
index 2de4348..bb333b0 100644
--- a/core/modules/field/src/Tests/FieldImportDeleteUninstallUiTest.php
+++ b/core/modules/field/src/Tests/FieldImportDeleteUninstallUiTest.php
@@ -64,8 +64,8 @@ public function testImportDeleteUninstall() {
     $entity = entity_create('entity_test');
     $value = '+0123456789';
     $entity->field_tel = $value;
-    $entity->field_text = $this->randomName(20);
-    $entity->name->value = $this->randomName();
+    $entity->field_text = $this->randomMachineName(20);
+    $entity->name->value = $this->randomMachineName();
     $entity->save();
 
     // Delete the text field before exporting configuration so that we can test
diff --git a/core/modules/field/src/Tests/FieldInstanceCrudTest.php b/core/modules/field/src/Tests/FieldInstanceCrudTest.php
index 5af3b21..715dc40 100644
--- a/core/modules/field/src/Tests/FieldInstanceCrudTest.php
+++ b/core/modules/field/src/Tests/FieldInstanceCrudTest.php
@@ -44,7 +44,7 @@ function setUp() {
     parent::setUp();
 
     $this->fieldStorageDefinition = array(
-      'name' => drupal_strtolower($this->randomName()),
+      'name' => drupal_strtolower($this->randomMachineName()),
       'entity_type' => 'entity_test',
       'type' => 'test_field',
     );
@@ -98,7 +98,7 @@ function testCreateFieldInstance() {
 
     // Check that the specified field exists.
     try {
-      $this->instanceDefinition['field_name'] = $this->randomName();
+      $this->instanceDefinition['field_name'] = $this->randomMachineName();
       entity_create('field_instance_config', $this->instanceDefinition)->save();
       $this->fail(t('Cannot create an instance of a non-existing field.'));
     }
@@ -131,9 +131,9 @@ function testUpdateFieldInstance() {
     // Check that basic changes are saved.
     $instance = entity_load('field_instance_config', 'entity_test.' . $this->instanceDefinition['bundle'] . '.' . $this->instanceDefinition['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->instanceDefinition['bundle'] . '.' . $this->instanceDefinition['field_name']);
diff --git a/core/modules/field/src/Tests/FieldUnitTestBase.php b/core/modules/field/src/Tests/FieldUnitTestBase.php
index 9c82d59..e5060be 100644
--- a/core/modules/field/src/Tests/FieldUnitTestBase.php
+++ b/core/modules/field/src/Tests/FieldUnitTestBase.php
@@ -59,7 +59,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_storage = entity_create('field_storage_config', array(
       'name' => $this->$field_name,
       'entity_type' => $entity_type,
@@ -71,10 +71,10 @@ function createFieldWithInstance($suffix = '', $entity_type = 'entity_test', $bu
     $this->$instance_definition = array(
       'field_storage' => $this->$field_storage,
       '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);
@@ -84,7 +84,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/src/Tests/FormTest.php b/core/modules/field/src/Tests/FormTest.php
index 2457aa7..ac54630 100644
--- a/core/modules/field/src/Tests/FormTest.php
+++ b/core/modules/field/src/Tests/FormTest.php
@@ -79,11 +79,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(),
       ),
     );
   }
@@ -114,7 +114,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'));
@@ -125,7 +125,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'));
@@ -144,7 +144,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'));
@@ -157,7 +157,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'));
@@ -190,7 +190,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'));
@@ -221,7 +221,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'));
@@ -235,7 +235,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'));
@@ -281,7 +281,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.
@@ -463,7 +463,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'));
@@ -543,7 +543,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'));
@@ -558,7 +558,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,
     );
@@ -600,7 +600,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/src/Tests/NestedFormTest.php b/core/modules/field/src/Tests/NestedFormTest.php
index fc0c9b6..d6e4538 100644
--- a/core/modules/field/src/Tests/NestedFormTest.php
+++ b/core/modules/field/src/Tests/NestedFormTest.php
@@ -43,11 +43,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/src/Tests/Number/NumberFieldTest.php b/core/modules/field/src/Tests/Number/NumberFieldTest.php
index 80cbe94..bc02bf3 100644
--- a/core/modules/field/src/Tests/Number/NumberFieldTest.php
+++ b/core/modules/field/src/Tests/Number/NumberFieldTest.php
@@ -42,7 +42,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_storage_config', array(
       'name' => $field_name,
       'entity_type' => 'entity_test',
@@ -80,7 +80,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'));
@@ -134,7 +134,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_storage_config', array(
       'name' => $field_name,
       'entity_type' => 'entity_test',
@@ -173,7 +173,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'));
@@ -185,7 +185,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'));
@@ -195,7 +195,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'));
@@ -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]" => $maximum + 1,
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -222,7 +222,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'));
@@ -238,7 +238,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_storage_config', array(
       'name' => $field_name,
       'entity_type' => 'entity_test',
@@ -275,7 +275,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'));
@@ -325,13 +325,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));
 
@@ -397,7 +397,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/src/Tests/Number/NumberItemTest.php b/core/modules/field/src/Tests/Number/NumberItemTest.php
index 645b8d1..3121510 100644
--- a/core/modules/field/src/Tests/Number/NumberItemTest.php
+++ b/core/modules/field/src/Tests/Number/NumberItemTest.php
@@ -55,7 +55,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/src/Tests/ShapeItemTest.php b/core/modules/field/src/Tests/ShapeItemTest.php
index 771bc67..19ce849 100644
--- a/core/modules/field/src/Tests/ShapeItemTest.php
+++ b/core/modules/field/src/Tests/ShapeItemTest.php
@@ -57,7 +57,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/src/Tests/TestItemTest.php b/core/modules/field/src/Tests/TestItemTest.php
index 742bc6b..348a1fc 100644
--- a/core/modules/field/src/Tests/TestItemTest.php
+++ b/core/modules/field/src/Tests/TestItemTest.php
@@ -56,7 +56,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/src/Tests/TranslationTest.php b/core/modules/field/src/Tests/TranslationTest.php
index 6a5f045..f4dfb5f 100644
--- a/core/modules/field/src/Tests/TranslationTest.php
+++ b/core/modules/field/src/Tests/TranslationTest.php
@@ -75,7 +75,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';
 
@@ -139,7 +139,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;
     $field_storage = entity_create('field_storage_config', $field_definition);
diff --git a/core/modules/field/src/Tests/TranslationWebTest.php b/core/modules/field/src/Tests/TranslationWebTest.php
index 752a8a4..3a07147 100644
--- a/core/modules/field/src/Tests/TranslationWebTest.php
+++ b/core/modules/field/src/Tests/TranslationWebTest.php
@@ -54,7 +54,7 @@ class TranslationWebTest extends FieldTestBase {
   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,
@@ -110,7 +110,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/src/Tests/Views/ApiDataTest.php b/core/modules/field/src/Tests/Views/ApiDataTest.php
index 86763c2..dad9d20 100644
--- a/core/modules/field/src/Tests/Views/ApiDataTest.php
+++ b/core/modules/field/src/Tests/Views/ApiDataTest.php
@@ -31,7 +31,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/src/Tests/Views/HandlerFieldFieldTest.php b/core/modules/field/src/Tests/Views/HandlerFieldFieldTest.php
index e3f53fa..e575a02 100644
--- a/core/modules/field/src/Tests/Views/HandlerFieldFieldTest.php
+++ b/core/modules/field/src/Tests/Views/HandlerFieldFieldTest.php
@@ -67,10 +67,10 @@ protected function setUp() {
 
       for ($key = 0; $key < 3; $key++) {
         $field_storage = $this->fieldStorages[$key];
-        $edit[$field_storage->getName()][0]['value'] = $this->randomName(8);
+        $edit[$field_storage->getName()][0]['value'] = $this->randomMachineName(8);
       }
       for ($j = 0; $j < 5; $j++) {
-        $edit[$this->fieldStorages[3]->getName()][$j]['value'] = $this->randomName(8);
+        $edit[$this->fieldStorages[3]->getName()][$j]['value'] = $this->randomMachineName(8);
       }
       // Set this field to be empty.
       $edit[$this->fieldStorages[4]->getName()] = array(array('value' => NULL));
diff --git a/core/modules/field/src/Tests/reEnableModuleFieldTest.php b/core/modules/field/src/Tests/reEnableModuleFieldTest.php
index 9543535..752de05 100644
--- a/core/modules/field/src/Tests/reEnableModuleFieldTest.php
+++ b/core/modules/field/src/Tests/reEnableModuleFieldTest.php
@@ -78,7 +78,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/src/FieldInstanceConfigEntityUnitTest.php b/core/modules/field/tests/src/FieldInstanceConfigEntityUnitTest.php
index 2d3b67f..76eae80 100644
--- a/core/modules/field/tests/src/FieldInstanceConfigEntityUnitTest.php
+++ b/core/modules/field/tests/src/FieldInstanceConfigEntityUnitTest.php
@@ -57,7 +57,7 @@ class FieldInstanceConfigEntityUnitTest extends UnitTestCase {
    * {@inheritdoc}
    */
   public function setUp() {
-    $this->entityTypeId = $this->randomName();
+    $this->entityTypeId = $this->randomMachineName();
     $this->entityType = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface');
 
     $this->entityManager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface');
diff --git a/core/modules/field/tests/src/FieldStorageConfigEntityUnitTest.php b/core/modules/field/tests/src/FieldStorageConfigEntityUnitTest.php
index b339512..579c961 100644
--- a/core/modules/field/tests/src/FieldStorageConfigEntityUnitTest.php
+++ b/core/modules/field/tests/src/FieldStorageConfigEntityUnitTest.php
@@ -70,7 +70,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_ui/src/Tests/FieldUiTestBase.php b/core/modules/field_ui/src/Tests/FieldUiTestBase.php
index 1196bb8..3041bcc 100644
--- a/core/modules/field_ui/src/Tests/FieldUiTestBase.php
+++ b/core/modules/field_ui/src/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' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
       'help' => '',
       'nodes' => array('article' => 'article'),
diff --git a/core/modules/field_ui/src/Tests/ManageFieldsTest.php b/core/modules/field_ui/src/Tests/ManageFieldsTest.php
index f3c1a11..207626c 100644
--- a/core/modules/field_ui/src/Tests/ManageFieldsTest.php
+++ b/core/modules/field_ui/src/Tests/ManageFieldsTest.php
@@ -24,8 +24,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.
@@ -251,12 +251,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(
@@ -347,7 +347,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;
 
@@ -408,7 +408,7 @@ function testDisallowedFieldNames() {
   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_name = strtolower($this->randomName(8));
+    $field_name = strtolower($this->randomMachineName(8));
     $field_storage = entity_create('field_storage_config', array(
       'name' => $field_name,
       'entity_type' => 'node',
@@ -495,7 +495,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,
@@ -512,7 +512,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/src/Tests/CopyTest.php b/core/modules/file/src/Tests/CopyTest.php
index 3ce3d2d..3a3a727 100644
--- a/core/modules/file/src/Tests/CopyTest.php
+++ b/core/modules/file/src/Tests/CopyTest.php
@@ -17,9 +17,9 @@ class CopyTest extends FileManagedUnitTestBase {
    * 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.
@@ -47,7 +47,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);
@@ -87,7 +87,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);
@@ -125,7 +125,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/src/Tests/DownloadTest.php b/core/modules/file/src/Tests/DownloadTest.php
index 54f3da7..043f73b 100644
--- a/core/modules/file/src/Tests/DownloadTest.php
+++ b/core/modules/file/src/Tests/DownloadTest.php
@@ -71,7 +71,7 @@ protected function doPrivateFileTransferTest() {
     // 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());
 
@@ -91,7 +91,7 @@ protected function doPrivateFileTransferTest() {
     $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/src/Tests/FileFieldDisplayTest.php b/core/modules/file/src/Tests/FileFieldDisplayTest.php
index 8759d61..281ad34 100644
--- a/core/modules/file/src/Tests/FileFieldDisplayTest.php
+++ b/core/modules/file/src/Tests/FileFieldDisplayTest.php
@@ -20,7 +20,7 @@ class FileFieldDisplayTest extends FileFieldTestBase {
    * 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',
@@ -70,7 +70,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/src/Tests/FileFieldPathTest.php b/core/modules/file/src/Tests/FileFieldPathTest.php
index 2c1ae66..865317a 100644
--- a/core/modules/file/src/Tests/FileFieldPathTest.php
+++ b/core/modules/file/src/Tests/FileFieldPathTest.php
@@ -17,7 +17,7 @@ class FileFieldPathTest extends FileFieldTestBase {
    * 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/src/Tests/FileFieldRSSContentTest.php b/core/modules/file/src/Tests/FileFieldRSSContentTest.php
index 4031caf..db265c2 100644
--- a/core/modules/file/src/Tests/FileFieldRSSContentTest.php
+++ b/core/modules/file/src/Tests/FileFieldRSSContentTest.php
@@ -25,7 +25,7 @@ class FileFieldRSSContentTest extends FileFieldTestBase {
    * 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/src/Tests/FileFieldRevisionTest.php b/core/modules/file/src/Tests/FileFieldRevisionTest.php
index a02e7a0..b45b200 100644
--- a/core/modules/file/src/Tests/FileFieldRevisionTest.php
+++ b/core/modules/file/src/Tests/FileFieldRevisionTest.php
@@ -26,7 +26,7 @@ class FileFieldRevisionTest extends FileFieldTestBase {
    */
   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/src/Tests/FileFieldTestBase.php b/core/modules/file/src/Tests/FileFieldTestBase.php
index 78f39c9..b0efe1b 100644
--- a/core/modules/file/src/Tests/FileFieldTestBase.php
+++ b/core/modules/file/src/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/src/Tests/FileFieldValidateTest.php b/core/modules/file/src/Tests/FileFieldValidateTest.php
index f4fc092..182ffad 100644
--- a/core/modules/file/src/Tests/FileFieldValidateTest.php
+++ b/core/modules/file/src/Tests/FileFieldValidateTest.php
@@ -25,7 +25,7 @@ class FileFieldValidateTest extends FileFieldTestBase {
    */
   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 = FieldInstanceConfig::loadByName('node', $type_name, $field_name);
 
@@ -33,7 +33,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.');
 
@@ -53,7 +53,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.');
 
@@ -70,7 +70,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.
@@ -116,7 +116,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/src/Tests/FileFieldWidgetTest.php b/core/modules/file/src/Tests/FileFieldWidgetTest.php
index 5c4f0f6..9ae0940 100644
--- a/core/modules/file/src/Tests/FileFieldWidgetTest.php
+++ b/core/modules/file/src/Tests/FileFieldWidgetTest.php
@@ -30,7 +30,7 @@ class FileFieldWidgetTest extends FileFieldTestBase {
    */
   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');
@@ -187,7 +187,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];
@@ -204,7 +204,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 = FieldInstanceConfig::loadByName('node', $type_name, $field_name);
 
@@ -251,8 +251,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/comment/manage/comment/fields', $edit, t('Save'));
@@ -265,7 +265,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]']);
@@ -274,7 +274,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'));
 
@@ -314,7 +314,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/src/Tests/FileItemTest.php b/core/modules/file/src/Tests/FileItemTest.php
index 3474906..21646e8 100644
--- a/core/modules/file/src/Tests/FileItemTest.php
+++ b/core/modules/file/src/Tests/FileItemTest.php
@@ -50,7 +50,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',
     ));
@@ -65,8 +65,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());
@@ -81,7 +81,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/src/Tests/FileManagedTestBase.php b/core/modules/file/src/Tests/FileManagedTestBase.php
index 91edf6b..f4e9c6f 100644
--- a/core/modules/file/src/Tests/FileManagedTestBase.php
+++ b/core/modules/file/src/Tests/FileManagedTestBase.php
@@ -185,7 +185,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/src/Tests/FileManagedUnitTestBase.php b/core/modules/file/src/Tests/FileManagedUnitTestBase.php
index 503490f..dfa2234 100644
--- a/core/modules/file/src/Tests/FileManagedUnitTestBase.php
+++ b/core/modules/file/src/Tests/FileManagedUnitTestBase.php
@@ -35,7 +35,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/src/Tests/FilePrivateTest.php b/core/modules/file/src/Tests/FilePrivateTest.php
index 0159a59..9fa2045 100644
--- a/core/modules/file/src/Tests/FilePrivateTest.php
+++ b/core/modules/file/src/Tests/FilePrivateTest.php
@@ -33,7 +33,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/src/Tests/FileTokenReplaceTest.php b/core/modules/file/src/Tests/FileTokenReplaceTest.php
index 481e8f4..36fe888 100644
--- a/core/modules/file/src/Tests/FileTokenReplaceTest.php
+++ b/core/modules/file/src/Tests/FileTokenReplaceTest.php
@@ -25,7 +25,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/src/Tests/MoveTest.php b/core/modules/file/src/Tests/MoveTest.php
index 14f72e2..9b1bfc2 100644
--- a/core/modules/file/src/Tests/MoveTest.php
+++ b/core/modules/file/src/Tests/MoveTest.php
@@ -17,9 +17,9 @@ class MoveTest extends FileManagedUnitTestBase {
    * 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.
@@ -48,7 +48,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);
@@ -83,7 +83,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);
@@ -115,7 +115,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
@@ -137,7 +137,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/src/Tests/SaveDataTest.php b/core/modules/file/src/Tests/SaveDataTest.php
index 2131528..8368e0b 100644
--- a/core/modules/file/src/Tests/SaveDataTest.php
+++ b/core/modules/file/src/Tests/SaveDataTest.php
@@ -17,7 +17,7 @@ class SaveDataTest extends FileManagedUnitTestBase {
    * 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.');
@@ -39,7 +39,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';
@@ -66,7 +66,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.');
@@ -94,7 +94,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.');
@@ -119,7 +119,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/src/Tests/SaveUploadTest.php b/core/modules/file/src/Tests/SaveUploadTest.php
index 29e625f..363b675 100644
--- a/core/modules/file/src/Tests/SaveUploadTest.php
+++ b/core/modules/file/src/Tests/SaveUploadTest.php
@@ -97,7 +97,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/src/Tests/SpaceUsedTest.php b/core/modules/file/src/Tests/SpaceUsedTest.php
index 0d9bc65..15acf1b 100644
--- a/core/modules/file/src/Tests/SpaceUsedTest.php
+++ b/core/modules/file/src/Tests/SpaceUsedTest.php
@@ -43,7 +43,7 @@ function setUp() {
    *   The file entity.
    */
   protected function createFileWithSize($uri, $size, $uid, $status = FILE_STATUS_PERMANENT) {
-    file_put_contents($uri, $this->randomName($size));
+    file_put_contents($uri, $this->randomMachineName($size));
     $file = entity_create('file', array(
       'uri' => $uri,
       'uid' => $uid,
diff --git a/core/modules/file/src/Tests/ValidatorTest.php b/core/modules/file/src/Tests/ValidatorTest.php
index cb767dd..4f81f08 100644
--- a/core/modules/file/src/Tests/ValidatorTest.php
+++ b/core/modules/file/src/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/src/Tests/FilterAdminTest.php b/core/modules/filter/src/Tests/FilterAdminTest.php
index e438162..49ab6bc 100644
--- a/core/modules/filter/src/Tests/FilterAdminTest.php
+++ b/core/modules/filter/src/Tests/FilterAdminTest.php
@@ -98,8 +98,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,
@@ -231,8 +231,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;
@@ -269,12 +269,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'));
@@ -339,7 +339,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/src/Tests/FilterDefaultFormatTest.php b/core/modules/filter/src/Tests/FilterDefaultFormatTest.php
index f1e6f00..5bde08e 100644
--- a/core/modules/filter/src/Tests/FilterDefaultFormatTest.php
+++ b/core/modules/filter/src/Tests/FilterDefaultFormatTest.php
@@ -34,8 +34,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/src/Tests/FilterFormatAccessTest.php b/core/modules/filter/src/Tests/FilterFormatAccessTest.php
index 9f4234f..08a5888 100644
--- a/core/modules/filter/src/Tests/FilterFormatAccessTest.php
+++ b/core/modules/filter/src/Tests/FilterFormatAccessTest.php
@@ -84,8 +84,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();
@@ -213,8 +213,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]']);
@@ -229,7 +229,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.');
 
@@ -269,7 +269,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'));
@@ -304,7 +304,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/src/Tests/FilterHooksTest.php b/core/modules/filter/src/Tests/FilterHooksTest.php
index 670adf9..a5f142b 100644
--- a/core/modules/filter/src/Tests/FilterHooksTest.php
+++ b/core/modules/filter/src/Tests/FilterHooksTest.php
@@ -31,7 +31,7 @@ class FilterHooksTest extends WebTestBase {
    */
   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";
 
@@ -39,9 +39,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'));
@@ -58,10 +58,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/src/Tests/FilterNoFormatTest.php b/core/modules/filter/src/Tests/FilterNoFormatTest.php
index 64a8337..b173eb1 100644
--- a/core/modules/filter/src/Tests/FilterNoFormatTest.php
+++ b/core/modules/filter/src/Tests/FilterNoFormatTest.php
@@ -32,7 +32,7 @@ class FilterNoFormatTest extends WebTestBase {
   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/src/Tests/FilterUnitTest.php b/core/modules/filter/src/Tests/FilterUnitTest.php
index 1895588..aa74bcc 100644
--- a/core/modules/filter/src/Tests/FilterUnitTest.php
+++ b/core/modules/filter/src/Tests/FilterUnitTest.php
@@ -252,7 +252,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/src/Tests/ForumBlockTest.php b/core/modules/forum/src/Tests/ForumBlockTest.php
index 30d14d9..a83b631 100644
--- a/core/modules/forum/src/Tests/ForumBlockTest.php
+++ b/core/modules/forum/src/Tests/ForumBlockTest.php
@@ -158,8 +158,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/src/Tests/ForumIndexTest.php b/core/modules/forum/src/Tests/ForumIndexTest.php
index 9e2e9ff..292729b 100644
--- a/core/modules/forum/src/Tests/ForumIndexTest.php
+++ b/core/modules/forum/src/Tests/ForumIndexTest.php
@@ -39,10 +39,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/src/Tests/ForumNodeAccessTest.php b/core/modules/forum/src/Tests/ForumNodeAccessTest.php
index ad51808..30fbfcd 100644
--- a/core/modules/forum/src/Tests/ForumNodeAccessTest.php
+++ b/core/modules/forum/src/Tests/ForumNodeAccessTest.php
@@ -45,10 +45,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[0][value]' => TRUE,
     );
     $this->drupalPostForm('node/add/forum', $edit, t('Save'), array('query' => array('forum_id' => 1)));
@@ -56,10 +56,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/src/Tests/ForumTest.php b/core/modules/forum/src/Tests/ForumTest.php
index e1d6749..0570f05 100644
--- a/core/modules/forum/src/Tests/ForumTest.php
+++ b/core/modules/forum/src/Tests/ForumTest.php
@@ -183,7 +183,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);
 
@@ -219,8 +219,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'));
 
@@ -321,8 +321,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.
@@ -359,8 +359,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,
@@ -451,8 +451,8 @@ function testForumWithNewPost() {
     $this->drupalLogin($this->post_comment_user);
     // Post a reply to the topic.
     $edit = array();
-    $edit['subject[0][value]'] = $this->randomName();
-    $edit['comment_body[0][value]'] = $this->randomName();
+    $edit['subject[0][value]'] = $this->randomMachineName();
+    $edit['comment_body[0][value]'] = $this->randomMachineName();
     $this->drupalPostForm('node/' . $node->id(), $edit, t('Save'));
     $this->assertResponse(200);
 
@@ -481,8 +481,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,
@@ -572,7 +572,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/src/Tests/ForumUninstallTest.php b/core/modules/forum/src/Tests/ForumUninstallTest.php
index 8b6fca1..388910c 100644
--- a/core/modules/forum/src/Tests/ForumUninstallTest.php
+++ b/core/modules/forum/src/Tests/ForumUninstallTest.php
@@ -60,7 +60,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/forum/src/Tests/Views/ForumIntegrationTest.php b/core/modules/forum/src/Tests/Views/ForumIntegrationTest.php
index 4bcaee4..de169f6 100644
--- a/core/modules/forum/src/Tests/Views/ForumIntegrationTest.php
+++ b/core/modules/forum/src/Tests/Views/ForumIntegrationTest.php
@@ -45,7 +45,7 @@ protected function setUp() {
   public function testForumIntegration() {
     // Create a forum.
     $entity_manager = $this->container->get('entity.manager');
-    $term = $entity_manager->getStorage('taxonomy_term')->create(array('vid' => 'forums', 'name' => $this->randomName()));
+    $term = $entity_manager->getStorage('taxonomy_term')->create(array('vid' => 'forums', 'name' => $this->randomMachineName()));
     $term->save();
 
     $comment_storage = $entity_manager->getStorage('comment');
diff --git a/core/modules/hal/src/Tests/DenormalizeTest.php b/core/modules/hal/src/Tests/DenormalizeTest.php
index 9021534..761b804 100644
--- a/core/modules/hal/src/Tests/DenormalizeTest.php
+++ b/core/modules/hal/src/Tests/DenormalizeTest.php
@@ -122,26 +122,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',
         ),
@@ -187,7 +187,7 @@ public function testPatchDenormailzation() {
       ),
       'field_test_text' => array(
         array(
-          'value' => $this->randomName(),
+          'value' => $this->randomMachineName(),
           'format' => 'full_html',
         ),
       ),
diff --git a/core/modules/hal/src/Tests/EntityTest.php b/core/modules/hal/src/Tests/EntityTest.php
index d281704..317185f 100644
--- a/core/modules/hal/src/Tests/EntityTest.php
+++ b/core/modules/hal/src/Tests/EntityTest.php
@@ -42,7 +42,7 @@ 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();
 
     // Add comment type.
@@ -55,15 +55,15 @@ public function testNode() {
     $this->container->get('comment.manager')->addDefaultField('node', 'example_type');
 
     $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();
@@ -94,11 +94,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();
@@ -126,7 +126,7 @@ public function testComment() {
     $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();
 
     // Add comment type.
@@ -139,23 +139,23 @@ public function testComment() {
     $this->container->get('comment.manager')->addDefaultField('node', 'example_type');
 
     $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();
 
     $comment = entity_create('comment', array(
       'uid' => $user->id(),
-      'subject' => $this->randomName(),
-      'comment_body' => $this->randomName(),
+      'subject' => $this->randomMachineName(),
+      'comment_body' => $this->randomMachineName(),
       'entity_id' => $node->id(),
       'entity_type' => 'node',
       'field_name' => 'comment'
diff --git a/core/modules/hal/src/Tests/NormalizeTest.php b/core/modules/hal/src/Tests/NormalizeTest.php
index 63b7fc6..c79d6e9 100644
--- a/core/modules/hal/src/Tests/NormalizeTest.php
+++ b/core/modules/hal/src/Tests/NormalizeTest.php
@@ -35,10 +35,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(
@@ -47,7 +47,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/src/Tests/FileMoveTest.php b/core/modules/image/src/Tests/FileMoveTest.php
index 4f3c8dd..6a4454b 100644
--- a/core/modules/image/src/Tests/FileMoveTest.php
+++ b/core/modules/image/src/Tests/FileMoveTest.php
@@ -42,7 +42,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/src/Tests/ImageAdminStylesTest.php b/core/modules/image/src/Tests/ImageAdminStylesTest.php
index 990c93f..df1c439 100644
--- a/core/modules/image/src/Tests/ImageAdminStylesTest.php
+++ b/core/modules/image/src/Tests/ImageAdminStylesTest.php
@@ -64,7 +64,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(
@@ -167,8 +167,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,
@@ -255,14 +255,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(
@@ -285,7 +285,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,
@@ -361,7 +361,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();
 
@@ -390,13 +390,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/src/Tests/ImageFieldDefaultImagesTest.php b/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php
index 978adf5..d0fabfa 100644
--- a/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php
+++ b/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php
@@ -29,7 +29,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));
@@ -43,7 +43,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());
     $storage_settings['default_image'] = array(
       'fid' => $default_images['field']->id(),
       'alt' => '',
@@ -285,7 +285,7 @@ public function testDefaultImages() {
    */
   public function testInvalidDefaultImage() {
     $field_storage = entity_create('field_storage_config', array(
-      'name' => drupal_strtolower($this->randomName()),
+      'name' => drupal_strtolower($this->randomMachineName()),
       'entity_type' => 'node',
       'type' => 'image',
       'settings' => array(
@@ -302,7 +302,7 @@ public function testInvalidDefaultImage() {
     $field_instance = entity_create('field_instance_config',  array(
       'field_storage' => $field_storage,
       'bundle' => 'page',
-      'label' => $this->randomName(),
+      'label' => $this->randomMachineName(),
       'settings' => array(
         'default_image' => array(
           'fid' => 100000,
diff --git a/core/modules/image/src/Tests/ImageFieldDisplayTest.php b/core/modules/image/src/Tests/ImageFieldDisplayTest.php
index 465a580..77d112b 100644
--- a/core/modules/image/src/Tests/ImageFieldDisplayTest.php
+++ b/core/modules/image/src/Tests/ImageFieldDisplayTest.php
@@ -46,7 +46,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.
@@ -167,7 +167,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,
@@ -210,8 +210,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,
     );
@@ -226,8 +226,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->getFieldStorageDefinition()->getSchema();
@@ -267,7 +267,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
@@ -339,7 +339,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/src/Tests/ImageFieldTestBase.php b/core/modules/image/src/Tests/ImageFieldTestBase.php
index 48b69f1..9ab5577 100644
--- a/core/modules/image/src/Tests/ImageFieldTestBase.php
+++ b/core/modules/image/src/Tests/ImageFieldTestBase.php
@@ -110,7 +110,7 @@ function createImageField($name, $type_name, $storage_settings = array(), $insta
    */
   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/src/Tests/ImageFieldValidateTest.php b/core/modules/image/src/Tests/ImageFieldValidateTest.php
index 96670e8..22daeb3 100644
--- a/core/modules/image/src/Tests/ImageFieldValidateTest.php
+++ b/core/modules/image/src/Tests/ImageFieldValidateTest.php
@@ -17,7 +17,7 @@ class ImageFieldValidateTest extends ImageFieldTestBase {
    * 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(
@@ -53,7 +53,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/src/Tests/ImageItemTest.php b/core/modules/image/src/Tests/ImageItemTest.php
index 5b84266..9fc9f71 100644
--- a/core/modules/image/src/Tests/ImageItemTest.php
+++ b/core/modules/image/src/Tests/ImageItemTest.php
@@ -70,9 +70,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());
@@ -95,7 +95,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();
@@ -112,7 +112,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/src/Tests/ImageStyleFlushTest.php b/core/modules/image/src/Tests/ImageStyleFlushTest.php
index 7db6de8..1ebe27b 100644
--- a/core/modules/image/src/Tests/ImageStyleFlushTest.php
+++ b/core/modules/image/src/Tests/ImageStyleFlushTest.php
@@ -47,7 +47,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/src/Tests/ImageThemeFunctionTest.php b/core/modules/image/src/Tests/ImageThemeFunctionTest.php
index 789cb1f..335f150 100644
--- a/core/modules/image/src/Tests/ImageThemeFunctionTest.php
+++ b/core/modules/image/src/Tests/ImageThemeFunctionTest.php
@@ -81,7 +81,7 @@ function testImageFormatterTheme() {
     $entity->save();
 
     // Create the base element that we'll use in the tests below.
-    $path = $this->randomName();
+    $path = $this->randomMachineName();
     $base_element = array(
       '#theme' => 'image_formatter',
       '#image_style' => 'test',
@@ -106,7 +106,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 = $base_element;
     $element['#path']['path'] = '';
     $element['#path']['options'] = array(
diff --git a/core/modules/language/src/Tests/LanguageBrowserDetectionUnitTest.php b/core/modules/language/src/Tests/LanguageBrowserDetectionUnitTest.php
index 2c35dcb..62ee8e3 100644
--- a/core/modules/language/src/Tests/LanguageBrowserDetectionUnitTest.php
+++ b/core/modules/language/src/Tests/LanguageBrowserDetectionUnitTest.php
@@ -131,7 +131,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/src/Tests/LanguageConfigurationElementTest.php b/core/modules/language/src/Tests/LanguageConfigurationElementTest.php
index 26ad991..5a65eba 100644
--- a/core/modules/language/src/Tests/LanguageConfigurationElementTest.php
+++ b/core/modules/language/src/Tests/LanguageConfigurationElementTest.php
@@ -64,7 +64,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/src/Tests/LanguageListTest.php b/core/modules/language/src/Tests/LanguageListTest.php
index 8a32f83..e37573d 100644
--- a/core/modules/language/src/Tests/LanguageListTest.php
+++ b/core/modules/language/src/Tests/LanguageListTest.php
@@ -44,7 +44,7 @@ function testLanguageList() {
 
     // Add custom language.
     $langcode = 'xx';
-    $name = $this->randomName(16);
+    $name = $this->randomMachineName(16);
     $edit = array(
       'predefined_langcode' => 'custom',
       'langcode' => $langcode,
@@ -77,7 +77,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,
     );
@@ -128,7 +128,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,
@@ -162,10 +162,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/src/Tests/LanguageSwitchingTest.php b/core/modules/language/src/Tests/LanguageSwitchingTest.php
index dd9a850..8ba95d0 100644
--- a/core/modules/language/src/Tests/LanguageSwitchingTest.php
+++ b/core/modules/language/src/Tests/LanguageSwitchingTest.php
@@ -40,7 +40,7 @@ function testLanguageBlock() {
     $block = $this->drupalPlaceBlock('language_block:' . LanguageInterface::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/src/Tests/LanguageUrlRewritingTest.php b/core/modules/language/src/Tests/LanguageUrlRewritingTest.php
index 6ff3125..36b183b 100644
--- a/core/modules/language/src/Tests/LanguageUrlRewritingTest.php
+++ b/core/modules/language/src/Tests/LanguageUrlRewritingTest.php
@@ -52,7 +52,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');
 
     // Check that URL rewriting is not applied to subrequests.
@@ -85,7 +85,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/src/Tests/LinkFieldTest.php b/core/modules/link/src/Tests/LinkFieldTest.php
index e2f6209..2b67ec3 100644
--- a/core/modules/link/src/Tests/LinkFieldTest.php
+++ b/core/modules/link/src/Tests/LinkFieldTest.php
@@ -60,7 +60,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->fieldStorage = entity_create('field_storage_config', array(
       'name' => $field_name,
@@ -149,7 +149,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'));
@@ -172,7 +172,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'));
@@ -184,7 +184,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->fieldStorage = entity_create('field_storage_config', array(
       'name' => $field_name,
@@ -270,7 +270,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]" => '',
     );
@@ -284,10 +284,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'));
@@ -302,7 +302,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->fieldStorage = entity_create('field_storage_config', array(
       'name' => $field_name,
@@ -346,7 +346,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]" => '',
@@ -444,7 +444,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->fieldStorage = entity_create('field_storage_config', array(
       'name' => $field_name,
@@ -486,7 +486,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/src/Tests/LinkFieldUITest.php b/core/modules/link/src/Tests/LinkFieldUITest.php
index cdcbe04..54c8f73 100644
--- a/core/modules/link/src/Tests/LinkFieldUITest.php
+++ b/core/modules/link/src/Tests/LinkFieldUITest.php
@@ -39,7 +39,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/src/Tests/LinkItemTest.php b/core/modules/link/src/Tests/LinkItemTest.php
index f5692d2..1033fff 100644
--- a/core/modules/link/src/Tests/LinkItemTest.php
+++ b/core/modules/link/src/Tests/LinkItemTest.php
@@ -50,13 +50,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.
@@ -73,7 +73,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);
@@ -83,8 +83,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/src/Tests/LocaleConfigTranslationTest.php b/core/modules/locale/src/Tests/LocaleConfigTranslationTest.php
index 8eaad50..69b2771 100644
--- a/core/modules/locale/src/Tests/LocaleConfigTranslationTest.php
+++ b/core/modules/locale/src/Tests/LocaleConfigTranslationTest.php
@@ -48,7 +48,7 @@ public 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,
@@ -65,7 +65,7 @@ public 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,
@@ -141,7 +141,7 @@ public 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,
@@ -180,7 +180,7 @@ public 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/src/Tests/LocaleContentTest.php b/core/modules/locale/src/Tests/LocaleContentTest.php
index c0ffd60..67cc176 100644
--- a/core/modules/locale/src/Tests/LocaleContentTest.php
+++ b/core/modules/locale/src/Tests/LocaleContentTest.php
@@ -71,7 +71,7 @@ public 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,
@@ -105,8 +105,8 @@ public 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/src/Tests/LocaleImportFunctionalTest.php b/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php
index 0c7b9de..10fd513 100644
--- a/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php
+++ b/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php
@@ -91,7 +91,7 @@ public 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,
@@ -263,7 +263,7 @@ public function testConfigPoFile() {
     $edit = array(
       'predefined_langcode' => 'custom',
       'langcode' => $langcode,
-      'name' => $this->randomName(16),
+      'name' => $this->randomMachineName(16),
       'direction' => LanguageInterface::DIRECTION_LTR,
     );
     $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
diff --git a/core/modules/locale/src/Tests/LocalePathTest.php b/core/modules/locale/src/Tests/LocalePathTest.php
index 4876043..e4d379d 100644
--- a/core/modules/locale/src/Tests/LocalePathTest.php
+++ b/core/modules/locale/src/Tests/LocalePathTest.php
@@ -46,7 +46,7 @@ public 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(
@@ -71,7 +71,7 @@ public 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,
@@ -80,7 +80,7 @@ public 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,
@@ -97,7 +97,7 @@ public 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/src/Tests/LocaleStringTest.php b/core/modules/locale/src/Tests/LocaleStringTest.php
index 7148d6a..64cacca 100644
--- a/core/modules/locale/src/Tests/LocaleStringTest.php
+++ b/core/modules/locale/src/Tests/LocaleStringTest.php
@@ -122,9 +122,9 @@ public 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());
@@ -179,8 +179,8 @@ public function testStringSearchAPI() {
    */
   public 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),
     ));
   }
 
@@ -202,7 +202,7 @@ public 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/src/Tests/LocaleTranslationUiTest.php b/core/modules/locale/src/Tests/LocaleTranslationUiTest.php
index 9991eaf..1aed818 100644
--- a/core/modules/locale/src/Tests/LocaleTranslationUiTest.php
+++ b/core/modules/locale/src/Tests/LocaleTranslationUiTest.php
@@ -49,10 +49,10 @@ public 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);
@@ -209,7 +209,7 @@ public 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(
@@ -242,7 +242,7 @@ public 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'));
 
@@ -269,16 +269,16 @@ public 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.
@@ -326,9 +326,9 @@ public 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);
@@ -343,7 +343,7 @@ public function testStringSearch() {
     $edit = array(
       'predefined_langcode' => 'custom',
       'langcode' => 'yy',
-      'name' => $this->randomName(16),
+      'name' => $this->randomMachineName(16),
       'direction' => LanguageInterface::DIRECTION_LTR,
     );
     $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
@@ -446,7 +446,7 @@ public 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,
@@ -467,15 +467,15 @@ public 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();
 
@@ -517,7 +517,7 @@ public 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/src/Tests/LocaleUpdateTest.php b/core/modules/locale/src/Tests/LocaleUpdateTest.php
index b656601..932da71 100644
--- a/core/modules/locale/src/Tests/LocaleUpdateTest.php
+++ b/core/modules/locale/src/Tests/LocaleUpdateTest.php
@@ -407,7 +407,7 @@ public function testEnableCustomLanguage() {
     // Create 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_ui/src/Tests/MenuLanguageTest.php b/core/modules/menu_ui/src/Tests/MenuLanguageTest.php
index 9267c28..ab3f5e1 100644
--- a/core/modules/menu_ui/src/Tests/MenuLanguageTest.php
+++ b/core/modules/menu_ui/src/Tests/MenuLanguageTest.php
@@ -40,7 +40,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);
     }
@@ -52,7 +52,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,
@@ -160,7 +160,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_ui/src/Tests/MenuNodeTest.php b/core/modules/menu_ui/src/Tests/MenuNodeTest.php
index 819bd56..ffa21a2 100644
--- a/core/modules/menu_ui/src/Tests/MenuNodeTest.php
+++ b/core/modules/menu_ui/src/Tests/MenuNodeTest.php
@@ -52,7 +52,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(),
@@ -70,7 +70,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(),
@@ -116,7 +116,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();
@@ -138,7 +138,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_ui/src/Tests/MenuTest.php b/core/modules/menu_ui/src/Tests/MenuTest.php
index f707eb9..b7cccb6 100644
--- a/core/modules/menu_ui/src/Tests/MenuTest.php
+++ b/core/modules/menu_ui/src/Tests/MenuTest.php
@@ -109,7 +109,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
@@ -125,8 +125,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,
@@ -140,7 +140,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);
@@ -156,8 +156,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' => '',
@@ -174,7 +174,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'));
 
@@ -435,7 +435,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'));
 
@@ -514,7 +514,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');
   }
@@ -545,7 +545,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,
@@ -652,7 +652,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/src/RowTest.php b/core/modules/migrate/tests/src/RowTest.php
index 7f01333..2ba35c0 100644
--- a/core/modules/migrate/tests/src/RowTest.php
+++ b/core/modules/migrate/tests/src/RowTest.php
@@ -157,7 +157,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,
@@ -168,8 +168,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/migrate/tests/src/process/DedupeEntityTest.php b/core/modules/migrate/tests/src/process/DedupeEntityTest.php
index 1e4bee5..9dbca53 100644
--- a/core/modules/migrate/tests/src/process/DedupeEntityTest.php
+++ b/core/modules/migrate/tests/src/process/DedupeEntityTest.php
@@ -72,7 +72,7 @@ public function testDedupe($count, $postfix = '', $start = NULL, $length = NULL)
     $configuration['length'] = isset($length) ? $length : NULL;
     $plugin = new DedupeEntity($configuration, 'dedupe_entity', array(), $this->getMigration(), $this->entityQueryFactory);
     $this->entityQueryExpects($count);
-    $value = $this->randomName(32);
+    $value = $this->randomMachineName(32);
     $actual = $plugin->transform($value, $this->migrateExecutable, $this->row, 'testproperty');
     $expected = Unicode::substr($value, $start, $length);
     $expected .= $count ? $postfix . $count : '';
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateBlockTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateBlockTest.php
index 1618d1e..a22bacb 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateBlockTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateBlockTest.php
@@ -39,8 +39,8 @@ public function setUp() {
     $entities = array(
       entity_create('menu', array('id' => 'primary-links')),
       entity_create('menu', array('id' => 'secondary-links')),
-      entity_create('block_content', array('id' => 1, 'type' => 'basic', 'info' => $this->randomName(8))),
-      entity_create('block_content', array('id' => 2, 'type' => 'basic', 'info' => $this->randomName(8))),
+      entity_create('block_content', array('id' => 1, 'type' => 'basic', 'info' => $this->randomMachineName(8))),
+      entity_create('block_content', array('id' => 2, 'type' => 'basic', 'info' => $this->randomMachineName(8))),
     );
     foreach ($entities as $entity) {
       $entity->enforceIsNew(TRUE);
diff --git a/core/modules/node/src/Tests/Condition/NodeConditionTest.php b/core/modules/node/src/Tests/Condition/NodeConditionTest.php
index d362c22..c6325d1 100644
--- a/core/modules/node/src/Tests/Condition/NodeConditionTest.php
+++ b/core/modules/node/src/Tests/Condition/NodeConditionTest.php
@@ -39,11 +39,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/src/Tests/MultiStepNodeFormBasicOptionsTest.php b/core/modules/node/src/Tests/MultiStepNodeFormBasicOptionsTest.php
index 5026920..33375fa 100644
--- a/core/modules/node/src/Tests/MultiStepNodeFormBasicOptionsTest.php
+++ b/core/modules/node/src/Tests/MultiStepNodeFormBasicOptionsTest.php
@@ -30,7 +30,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_storage_config', array(
       'name' => $this->field_name,
       'entity_type' => 'node',
@@ -43,7 +43,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/src/Tests/NodeAccessFieldTest.php b/core/modules/node/src/Tests/NodeAccessFieldTest.php
index 04adb72..b8ebed3 100644
--- a/core/modules/node/src/Tests/NodeAccessFieldTest.php
+++ b/core/modules/node/src/Tests/NodeAccessFieldTest.php
@@ -52,7 +52,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_storage_config', array(
       'name' => $this->field_name,
       'entity_type' => 'node',
@@ -77,7 +77,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/src/Tests/NodeAccessPagerTest.php b/core/modules/node/src/Tests/NodeAccessPagerTest.php
index 4e2c018..2dac0ad 100644
--- a/core/modules/node/src/Tests/NodeAccessPagerTest.php
+++ b/core/modules/node/src/Tests/NodeAccessPagerTest.php
@@ -46,9 +46,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/src/Tests/NodeAdminTest.php b/core/modules/node/src/Tests/NodeAdminTest.php
index 6a69315..8db8c21 100644
--- a/core/modules/node/src/Tests/NodeAdminTest.php
+++ b/core/modules/node/src/Tests/NodeAdminTest.php
@@ -44,7 +44,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/src/Tests/NodeCreationTest.php b/core/modules/node/src/Tests/NodeCreationTest.php
index a305ca5..ba85902 100644
--- a/core/modules/node/src/Tests/NodeCreationTest.php
+++ b/core/modules/node/src/Tests/NodeCreationTest.php
@@ -45,8 +45,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.
@@ -125,8 +125,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/src/Tests/NodeEntityViewModeAlterTest.php b/core/modules/node/src/Tests/NodeEntityViewModeAlterTest.php
index a979ef8..232fde7 100644
--- a/core/modules/node/src/Tests/NodeEntityViewModeAlterTest.php
+++ b/core/modules/node/src/Tests/NodeEntityViewModeAlterTest.php
@@ -28,7 +28,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/src/Tests/NodeFieldMultilingualTest.php b/core/modules/node/src/Tests/NodeFieldMultilingualTest.php
index 80edda3..5365633 100644
--- a/core/modules/node/src/Tests/NodeFieldMultilingualTest.php
+++ b/core/modules/node/src/Tests/NodeFieldMultilingualTest.php
@@ -68,9 +68,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();
@@ -87,7 +87,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'));
@@ -112,9 +112,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/src/Tests/NodeLastChangedTest.php b/core/modules/node/src/Tests/NodeLastChangedTest.php
index f3e20fd..5160ad0 100644
--- a/core/modules/node/src/Tests/NodeLastChangedTest.php
+++ b/core/modules/node/src/Tests/NodeLastChangedTest.php
@@ -33,7 +33,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/src/Tests/NodePostSettingsTest.php b/core/modules/node/src/Tests/NodePostSettingsTest.php
index f0b74cc..2446ecb 100644
--- a/core/modules/node/src/Tests/NodePostSettingsTest.php
+++ b/core/modules/node/src/Tests/NodePostSettingsTest.php
@@ -34,8 +34,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.
@@ -51,8 +51,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/src/Tests/NodeRevisionPermissionsTest.php b/core/modules/node/src/Tests/NodeRevisionPermissionsTest.php
index 57c32c3..46f50e8 100644
--- a/core/modules/node/src/Tests/NodeRevisionPermissionsTest.php
+++ b/core/modules/node/src/Tests/NodeRevisionPermissionsTest.php
@@ -44,7 +44,7 @@ function setUp() {
         // Create a revision for the same nid and settings with a random log.
         $revision = clone $nodes[$type];
         $revision->setNewRevision();
-        $revision->revision_log = $this->randomName(32);
+        $revision->revision_log = $this->randomMachineName(32);
         $revision->save();
         $this->node_revisions[$type][] = $revision;
       }
diff --git a/core/modules/node/src/Tests/NodeRevisionsAllTest.php b/core/modules/node/src/Tests/NodeRevisionsAllTest.php
index ddaa1e9..6d777f0 100644
--- a/core/modules/node/src/Tests/NodeRevisionsAllTest.php
+++ b/core/modules/node/src/Tests/NodeRevisionsAllTest.php
@@ -48,12 +48,12 @@ function setUp() {
     // Create three revisions.
     $revision_count = 3;
     for ($i = 0; $i < $revision_count; $i++) {
-      $logs[] = $node->revision_log = $this->randomName(32);
+      $logs[] = $node->revision_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/src/Tests/NodeRevisionsTest.php b/core/modules/node/src/Tests/NodeRevisionsTest.php
index 16bb759..b1a7674 100644
--- a/core/modules/node/src/Tests/NodeRevisionsTest.php
+++ b/core/modules/node/src/Tests/NodeRevisionsTest.php
@@ -48,12 +48,12 @@ function setUp() {
     // Create three revisions.
     $revision_count = 3;
     for ($i = 0; $i < $revision_count; $i++) {
-      $logs[] = $node->revision_log = $this->randomName(32);
+      $logs[] = $node->revision_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();
@@ -128,7 +128,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();
@@ -158,14 +158,14 @@ function testRevisions() {
    */
   function testNodeRevisionWithoutLogMessage() {
     // Create a node with an initial log message.
-    $revision_log = $this->randomName(10);
+    $revision_log = $this->randomMachineName(10);
     $node = $this->drupalCreateNode(array('revision_log' => $revision_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;
@@ -183,7 +183,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/src/Tests/NodeSaveTest.php b/core/modules/node/src/Tests/NodeSaveTest.php
index 75e3651..a8a0b26 100644
--- a/core/modules/node/src/Tests/NodeSaveTest.php
+++ b/core/modules/node/src/Tests/NodeSaveTest.php
@@ -42,10 +42,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,
@@ -74,7 +74,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();
@@ -101,7 +101,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/src/Tests/NodeTitleTest.php b/core/modules/node/src/Tests/NodeTitleTest.php
index f9c2f84..e34862d 100644
--- a/core/modules/node/src/Tests/NodeTitleTest.php
+++ b/core/modules/node/src/Tests/NodeTitleTest.php
@@ -39,7 +39,7 @@ function testNodeTitle() {
     // 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/src/Tests/NodeTitleXSSTest.php b/core/modules/node/src/Tests/NodeTitleXSSTest.php
index 37537b0..0f4a99a 100644
--- a/core/modules/node/src/Tests/NodeTitleXSSTest.php
+++ b/core/modules/node/src/Tests/NodeTitleXSSTest.php
@@ -23,7 +23,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/src/Tests/NodeTokenReplaceTest.php b/core/modules/node/src/Tests/NodeTokenReplaceTest.php
index a80ed79..c93516e 100644
--- a/core/modules/node/src/Tests/NodeTokenReplaceTest.php
+++ b/core/modules/node/src/Tests/NodeTokenReplaceTest.php
@@ -55,7 +55,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->randomName(16), 'format' => 'plain_text')),
     ));
     $node->save();
 
@@ -102,7 +102,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/src/Tests/NodeTranslationUITest.php b/core/modules/node/src/Tests/NodeTranslationUITest.php
index ea4cb9f..140cbe5 100644
--- a/core/modules/node/src/Tests/NodeTranslationUITest.php
+++ b/core/modules/node/src/Tests/NodeTranslationUITest.php
@@ -71,7 +71,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);
   }
 
   /**
@@ -201,7 +201,7 @@ function testTranslationLinkTheme() {
    */
   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/src/Tests/NodeTypeInitialLanguageTest.php b/core/modules/node/src/Tests/NodeTypeInitialLanguageTest.php
index 19edadf..ea5910c 100644
--- a/core/modules/node/src/Tests/NodeTypeInitialLanguageTest.php
+++ b/core/modules/node/src/Tests/NodeTypeInitialLanguageTest.php
@@ -95,8 +95,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/src/Tests/NodeTypePersistenceTest.php b/core/modules/node/src/Tests/NodeTypePersistenceTest.php
index 683b07c..62c2783 100644
--- a/core/modules/node/src/Tests/NodeTypePersistenceTest.php
+++ b/core/modules/node/src/Tests/NodeTypePersistenceTest.php
@@ -35,7 +35,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/src/Tests/NodeTypeRenameConfigImportTest.php b/core/modules/node/src/Tests/NodeTypeRenameConfigImportTest.php
index e817b8b..ca6e476 100644
--- a/core/modules/node/src/Tests/NodeTypeRenameConfigImportTest.php
+++ b/core/modules/node/src/Tests/NodeTypeRenameConfigImportTest.php
@@ -40,8 +40,8 @@ public function setUp() {
    */
   public function testConfigurationRename() {
     $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();
     $staged_type = $content_type->type;
@@ -53,7 +53,7 @@ public function testConfigurationRename() {
     $this->copyConfig($active, $staging);
 
     // Change the machine name of the content type.
-    $content_type->type = Unicode::strtolower($this->randomName(8));
+    $content_type->type = Unicode::strtolower($this->randomMachineName(8));
     $content_type->save();
     $active_type = $content_type->type;
     $renamed_config_name = $content_type->getEntityType()->getConfigPrefix() . '.' . $content_type->id();
diff --git a/core/modules/node/src/Tests/PageEditTest.php b/core/modules/node/src/Tests/PageEditTest.php
index 9ab628e..e7b4226 100644
--- a/core/modules/node/src/Tests/PageEditTest.php
+++ b/core/modules/node/src/Tests/PageEditTest.php
@@ -33,8 +33,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.
@@ -56,8 +56,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'));
 
@@ -71,8 +71,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'));
 
@@ -98,8 +98,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/src/Tests/PagePreviewTest.php b/core/modules/node/src/Tests/PagePreviewTest.php
index 868e752..d160c8b 100644
--- a/core/modules/node/src/Tests/PagePreviewTest.php
+++ b/core/modules/node/src/Tests/PagePreviewTest.php
@@ -38,9 +38,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' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
       'help' => '',
     ));
@@ -50,8 +50,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' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
     ));
@@ -60,7 +60,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_storage_config', array(
       'name' => $this->field_name,
       'entity_type' => 'node',
@@ -110,8 +110,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'));
 
@@ -142,8 +142,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.');
@@ -158,7 +158,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.');
@@ -183,10 +183,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['revision_log'] = $this->randomName(32);
+    $edit['revision_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/src/Tests/Views/FrontPageTest.php b/core/modules/node/src/Tests/Views/FrontPageTest.php
index b68ab0f..13c93e3 100644
--- a/core/modules/node/src/Tests/Views/FrontPageTest.php
+++ b/core/modules/node/src/Tests/Views/FrontPageTest.php
@@ -42,7 +42,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)
@@ -62,7 +62,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.
@@ -89,7 +89,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);
@@ -98,7 +98,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();
@@ -106,7 +106,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/src/Tests/Views/NodeRevisionWizardTest.php b/core/modules/node/src/Tests/Views/NodeRevisionWizardTest.php
index d2d08ed..800b52f 100644
--- a/core/modules/node/src/Tests/Views/NodeRevisionWizardTest.php
+++ b/core/modules/node/src/Tests/Views/NodeRevisionWizardTest.php
@@ -43,9 +43,9 @@ public function testViewAdd() {
     $node->save();
 
     $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]'] = FALSE;
     $view['show[wizard_key]'] = 'node_revision';
     $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
diff --git a/core/modules/node/src/Tests/Views/RowPluginTest.php b/core/modules/node/src/Tests/Views/RowPluginTest.php
index 698c86d..4813bd6 100644
--- a/core/modules/node/src/Tests/Views/RowPluginTest.php
+++ b/core/modules/node/src/Tests/Views/RowPluginTest.php
@@ -59,9 +59,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(),
             ),
           ),
         )
@@ -87,11 +87,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/src/Tests/OptionsDynamicValuesTestBase.php b/core/modules/options/src/Tests/OptionsDynamicValuesTestBase.php
index c5986d0..ddb22ad 100644
--- a/core/modules/options/src/Tests/OptionsDynamicValuesTestBase.php
+++ b/core/modules/options/src/Tests/OptionsDynamicValuesTestBase.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/src/Tests/OptionsFieldUITest.php b/core/modules/options/src/Tests/OptionsFieldUITest.php
index d6b7009..d7dbe48 100644
--- a/core/modules/options/src/Tests/OptionsFieldUITest.php
+++ b/core/modules/options/src/Tests/OptionsFieldUITest.php
@@ -39,7 +39,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;
@@ -170,7 +170,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(
@@ -267,12 +267,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_integer');
     $node = $this->drupalCreateNode(array('type' => $this->type));
 
-    $on = $this->randomName();
-    $off = $this->randomName();
+    $on = $this->randomMachineName();
+    $off = $this->randomMachineName();
     $edit = array(
       'field[settings][allowed_values]' =>
         "1|$on
diff --git a/core/modules/options/src/Tests/OptionsWidgetsTest.php b/core/modules/options/src/Tests/OptionsWidgetsTest.php
index 28cae40..f9c4287 100644
--- a/core/modules/options/src/Tests/OptionsWidgetsTest.php
+++ b/core/modules/options/src/Tests/OptionsWidgetsTest.php
@@ -110,7 +110,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;
@@ -167,7 +167,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;
@@ -257,7 +257,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;
@@ -356,7 +356,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;
diff --git a/core/modules/path/src/Tests/PathAdminTest.php b/core/modules/path/src/Tests/PathAdminTest.php
index f3b48a0..57d2b93 100644
--- a/core/modules/path/src/Tests/PathAdminTest.php
+++ b/core/modules/path/src/Tests/PathAdminTest.php
@@ -38,14 +38,14 @@ public function testPathFiltering() {
     $node2 = $this->drupalCreateNode();
 
     // Create aliases.
-    $alias1 = $this->randomName(8);
+    $alias1 = $this->randomMachineName(8);
     $edit = array(
       'source' => 'node/' . $node1->id(),
       'alias' => $alias1,
     );
     $this->drupalPostForm('admin/config/search/path/add', $edit, t('Save'));
 
-    $alias2 = $this->randomName(8);
+    $alias2 = $this->randomMachineName(8);
     $edit = array(
       'source' => 'node/' . $node2->id(),
       'alias' => $alias2,
@@ -70,7 +70,7 @@ public function testPathFiltering() {
 
     // Filter by a random string with a different length.
     $edit = array(
-      'filter' => $this->randomName(10),
+      'filter' => $this->randomMachineName(10),
     );
     $this->drupalPostForm(NULL, $edit, t('Filter'));
     $this->assertNoLinkByHref($alias1);
diff --git a/core/modules/path/src/Tests/PathAliasTest.php b/core/modules/path/src/Tests/PathAliasTest.php
index 2aa65f4..aef543b 100644
--- a/core/modules/path/src/Tests/PathAliasTest.php
+++ b/core/modules/path/src/Tests/PathAliasTest.php
@@ -40,7 +40,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.
@@ -71,7 +71,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.
@@ -122,7 +122,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);
@@ -141,7 +141,7 @@ function testNodeAlias() {
 
     // Create alias.
     $edit = array();
-    $edit['path[0][alias]'] = $this->randomName(8);
+    $edit['path[0][alias]'] = $this->randomMachineName(8);
     $this->drupalPostForm('node/' . $node1->id() . '/edit', $edit, t('Save'));
 
     // Confirm that the alias works.
@@ -211,7 +211,7 @@ function testDuplicateNodeAlias() {
     // Create one node with a random alias.
     $node_one = $this->drupalCreateNode();
     $edit = array();
-    $edit['path[0][alias]'] = $this->randomName();
+    $edit['path[0][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/src/Tests/PathLanguageTest.php b/core/modules/path/src/Tests/PathLanguageTest.php
index 2f3ba9a..43a85f6 100644
--- a/core/modules/path/src/Tests/PathLanguageTest.php
+++ b/core/modules/path/src/Tests/PathLanguageTest.php
@@ -70,7 +70,7 @@ function setUp() {
    */
   function testAliasTranslation() {
     $english_node = $this->drupalCreateNode(array('type' => 'page', 'langcode' => 'en'));
-    $english_alias = $this->randomName();
+    $english_alias = $this->randomMachineName();
 
     // Edit the node to set language and path.
     $edit = array();
@@ -86,9 +86,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[0][alias]'] = $french_alias;
     $this->drupalPostForm(NULL, $edit, t('Save (this translation)'));
 
diff --git a/core/modules/path/src/Tests/PathLanguageUiTest.php b/core/modules/path/src/Tests/PathLanguageUiTest.php
index 59df2bf..0027b53 100644
--- a/core/modules/path/src/Tests/PathLanguageUiTest.php
+++ b/core/modules/path/src/Tests/PathLanguageUiTest.php
@@ -43,7 +43,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;
@@ -57,7 +57,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;
@@ -72,7 +72,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/src/Tests/PathTaxonomyTermTest.php b/core/modules/path/src/Tests/PathTaxonomyTermTest.php
index c7ae9d3..7c44b46 100644
--- a/core/modules/path/src/Tests/PathTaxonomyTermTest.php
+++ b/core/modules/path/src/Tests/PathTaxonomyTermTest.php
@@ -42,11 +42,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[0][alias]' => $this->randomName(),
+      'path[0][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();
@@ -63,7 +63,7 @@ function testTermAlias() {
 
     // Change the term's URL alias.
     $edit2 = array();
-    $edit2['path[0][alias]'] = $this->randomName();
+    $edit2['path[0][alias]'] = $this->randomMachineName();
     $this->drupalPostForm('taxonomy/term/' . $tid . '/edit', $edit2, t('Save'));
 
     // Confirm that the changed alias works.
diff --git a/core/modules/quickedit/src/Tests/QuickEditAutocompleteTermTest.php b/core/modules/quickedit/src/Tests/QuickEditAutocompleteTermTest.php
index e4bdbd6..7e91724 100644
--- a/core/modules/quickedit/src/Tests/QuickEditAutocompleteTermTest.php
+++ b/core/modules/quickedit/src/Tests/QuickEditAutocompleteTermTest.php
@@ -200,8 +200,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/rdf/src/Tests/CommentAttributesTest.php b/core/modules/rdf/src/Tests/CommentAttributesTest.php
index e8b15d7..5026274 100644
--- a/core/modules/rdf/src/Tests/CommentAttributesTest.php
+++ b/core/modules/rdf/src/Tests/CommentAttributesTest.php
@@ -155,7 +155,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(), 0, $anonymous_user);
@@ -331,8 +331,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/src/Tests/Field/EntityReferenceRdfaTest.php b/core/modules/rdf/src/Tests/Field/EntityReferenceRdfaTest.php
index 1f04d0a..3510a16 100644
--- a/core/modules/rdf/src/Tests/Field/EntityReferenceRdfaTest.php
+++ b/core/modules/rdf/src/Tests/Field/EntityReferenceRdfaTest.php
@@ -62,11 +62,11 @@ public function setUp() {
     ))->save();
 
     // Create the entity to be referenced.
-    $this->target_entity = entity_create($this->entityType, array('name' => $this->randomName()));
+    $this->target_entity = entity_create($this->entityType, array('name' => $this->randomMachineName()));
     $this->target_entity->save();
 
     // Create the entity that will have the entity reference field.
-    $this->entity = entity_create($this->entityType, array('name' => $this->randomName()));
+    $this->entity = entity_create($this->entityType, array('name' => $this->randomMachineName()));
     $this->entity->save();
     $this->entity->{$this->fieldName}->entity = $this->target_entity;
     $this->entity->{$this->fieldName}->access = TRUE;
diff --git a/core/modules/rdf/src/Tests/Field/FieldRdfaDatatypeCallbackTest.php b/core/modules/rdf/src/Tests/Field/FieldRdfaDatatypeCallbackTest.php
index 7d62d0e..7dc6c74 100644
--- a/core/modules/rdf/src/Tests/Field/FieldRdfaDatatypeCallbackTest.php
+++ b/core/modules/rdf/src/Tests/Field/FieldRdfaDatatypeCallbackTest.php
@@ -38,7 +38,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/src/Tests/Field/TaxonomyTermReferenceRdfaTest.php b/core/modules/rdf/src/Tests/Field/TaxonomyTermReferenceRdfaTest.php
index cefd98c..98d086a 100644
--- a/core/modules/rdf/src/Tests/Field/TaxonomyTermReferenceRdfaTest.php
+++ b/core/modules/rdf/src/Tests/Field/TaxonomyTermReferenceRdfaTest.php
@@ -48,8 +48,8 @@ public function setUp() {
     $this->installEntitySchema('taxonomy_term');
 
     $vocabulary = entity_create('taxonomy_vocabulary', array(
-      'name' => $this->randomName(),
-      'vid' => drupal_strtolower($this->randomName()),
+      'name' => $this->randomMachineName(),
+      'vid' => drupal_strtolower($this->randomMachineName()),
       'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
     ));
     $vocabulary->save();
@@ -75,7 +75,7 @@ public function setUp() {
     ))->save();
 
     $this->term = entity_create('taxonomy_term', array(
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
       'vid' => $vocabulary->id(),
       'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
     ));
diff --git a/core/modules/rdf/src/Tests/FileFieldAttributesTest.php b/core/modules/rdf/src/Tests/FileFieldAttributesTest.php
index 3253fff..40a65da 100644
--- a/core/modules/rdf/src/Tests/FileFieldAttributesTest.php
+++ b/core/modules/rdf/src/Tests/FileFieldAttributesTest.php
@@ -46,7 +46,7 @@ class FileFieldAttributesTest extends FileFieldTestBase {
 
   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/src/Tests/NodeAttributesTest.php b/core/modules/rdf/src/Tests/NodeAttributesTest.php
index 8b2badf..413971f 100644
--- a/core/modules/rdf/src/Tests/NodeAttributesTest.php
+++ b/core/modules/rdf/src/Tests/NodeAttributesTest.php
@@ -49,7 +49,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/src/Tests/StandardProfileTest.php b/core/modules/rdf/src/Tests/StandardProfileTest.php
index be714fa..52f241d 100644
--- a/core/modules/rdf/src/Tests/StandardProfileTest.php
+++ b/core/modules/rdf/src/Tests/StandardProfileTest.php
@@ -124,8 +124,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();
@@ -501,8 +501,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/src/Tests/UserAttributesTest.php b/core/modules/rdf/src/Tests/UserAttributesTest.php
index a6d11d3..d717155 100644
--- a/core/modules/rdf/src/Tests/UserAttributesTest.php
+++ b/core/modules/rdf/src/Tests/UserAttributesTest.php
@@ -48,9 +48,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/src/RdfMappingConfigEntityUnitTest.php b/core/modules/rdf/tests/src/RdfMappingConfigEntityUnitTest.php
index c1b63db..3051e32 100644
--- a/core/modules/rdf/tests/src/RdfMappingConfigEntityUnitTest.php
+++ b/core/modules/rdf/tests/src/RdfMappingConfigEntityUnitTest.php
@@ -49,7 +49,7 @@ class RdfMappingConfigEntityUnitTest extends UnitTestCase {
    * {@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())
@@ -71,7 +71,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())
@@ -101,15 +101,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/src/Tests/ResponsiveImageFieldDisplayTest.php b/core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php
index d6a09bc..27450e6 100644
--- a/core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php
+++ b/core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php
@@ -108,7 +108,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/src/ResponsiveImageMappingEntityTest.php b/core/modules/responsive_image/tests/src/ResponsiveImageMappingEntityTest.php
index ff7abd1..506bd00 100644
--- a/core/modules/responsive_image/tests/src/ResponsiveImageMappingEntityTest.php
+++ b/core/modules/responsive_image/tests/src/ResponsiveImageMappingEntityTest.php
@@ -70,8 +70,8 @@ class ResponsiveImageMappingEntityTest extends UnitTestCase {
    * {@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')
@@ -85,7 +85,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('name' => 'test', 'id' => $this->breakpointGroupId)));
 
     $this->breakpointGroupStorage = $this->getMock('\Drupal\Core\Config\Entity\ConfigEntityStorageInterface');
diff --git a/core/modules/rest/src/Tests/CreateTest.php b/core/modules/rest/src/Tests/CreateTest.php
index 5476dbf..20478c7 100644
--- a/core/modules/rest/src/Tests/CreateTest.php
+++ b/core/modules/rest/src/Tests/CreateTest.php
@@ -97,7 +97,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/src/Tests/RESTTestBase.php b/core/modules/rest/src/Tests/RESTTestBase.php
index 1e19be2..a89ed89 100644
--- a/core/modules/rest/src/Tests/RESTTestBase.php
+++ b/core/modules/rest/src/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/src/Tests/UpdateTest.php b/core/modules/rest/src/Tests/UpdateTest.php
index e5a0193..3d133c9 100644
--- a/core/modules/rest/src/Tests/UpdateTest.php
+++ b/core/modules/rest/src/Tests/UpdateTest.php
@@ -138,7 +138,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/src/Tests/Views/StyleSerializerTest.php b/core/modules/rest/src/Tests/Views/StyleSerializerTest.php
index fa2e954..ea19d5e 100644
--- a/core/modules/rest/src/Tests/Views/StyleSerializerTest.php
+++ b/core/modules/rest/src/Tests/Views/StyleSerializerTest.php
@@ -198,9 +198,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',
     );
 
@@ -209,7 +209,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/src/Tests/SearchBlockTest.php b/core/modules/search/src/Tests/SearchBlockTest.php
index d700df8..591e729 100644
--- a/core/modules/search/src/Tests/SearchBlockTest.php
+++ b/core/modules/search/src/Tests/SearchBlockTest.php
@@ -91,16 +91,16 @@ protected function testSearchFormBlock() {
 
     // Test that after entering a too-short keyword in the form, you can then
     // search again with a longer keyword. First test using the block form.
-    $this->submitGetForm('node', array('keys' => $this->randomName(1)), t('Search'));
+    $this->submitGetForm('node', array('keys' => $this->randomMachineName(1)), t('Search'));
     $this->assertText('You must include at least one positive keyword', 'Keyword message is displayed when searching for short word');
     $this->assertNoText(t('Please enter some keywords'), 'With short word entered, no keywords message is not displayed');
-    $this->submitGetForm(NULL, array('keys' => $this->randomName()), t('Search'), 'search-block-form');
+    $this->submitGetForm(NULL, array('keys' => $this->randomMachineName()), t('Search'), 'search-block-form');
     $this->assertNoText('You must include at least one positive keyword', 'Keyword message is not displayed when searching for long word after short word search');
 
     // Same test again, using the search page form for the second search this
     // time.
-    $this->submitGetForm('node', array('keys' => $this->randomName(1)), t('Search'));
-    $this->drupalPostForm(NULL, array('keys' => $this->randomName()), t('Search'), array(), array(), 'search-form');
+    $this->submitGetForm('node', array('keys' => $this->randomMachineName(1)), t('Search'));
+    $this->drupalPostForm(NULL, array('keys' => $this->randomMachineName()), t('Search'), array(), array(), 'search-form');
     $this->assertNoText('You must include at least one positive keyword', 'Keyword message is not displayed when searching for long word after short word search');
 
   }
diff --git a/core/modules/search/src/Tests/SearchCommentCountToggleTest.php b/core/modules/search/src/Tests/SearchCommentCountToggleTest.php
index 29cb1a0..9f2733b 100644
--- a/core/modules/search/src/Tests/SearchCommentCountToggleTest.php
+++ b/core/modules/search/src/Tests/SearchCommentCountToggleTest.php
@@ -52,8 +52,8 @@ function setUp() {
 
     // Create a comment array
     $edit_comment = array();
-    $edit_comment['subject[0][value]'] = $this->randomName();
-    $edit_comment['comment_body[0][value]'] = $this->randomName();
+    $edit_comment['subject[0][value]'] = $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/src/Tests/SearchConfigSettingsFormTest.php b/core/modules/search/src/Tests/SearchConfigSettingsFormTest.php
index 84ef12a..856ecb9 100644
--- a/core/modules/search/src/Tests/SearchConfigSettingsFormTest.php
+++ b/core/modules/search/src/Tests/SearchConfigSettingsFormTest.php
@@ -81,13 +81,13 @@ 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/pages', $edit, t('Save configuration'));
     $this->assertNoText(t('The configuration options have been saved.'), 'Form does not save with an invalid word length.');
 
     // Test logging setting. It should be off by default.
-    $text = $this->randomName(5);
+    $text = $this->randomMachineName(5);
     $this->drupalPostForm('search/node', array('keys' => $text), t('Search'));
     $this->drupalGet('admin/reports/dblog');
     $this->assertNoLink('Searched Content for ' . $text . '.', 'Search was not logged');
@@ -95,7 +95,7 @@ function testSearchSettingsPage() {
     // Turn on logging.
     $edit = array('logging' => TRUE);
     $this->drupalPostForm('admin/config/search/pages', $edit, t('Save configuration'));
-    $text = $this->randomName(5);
+    $text = $this->randomMachineName(5);
     $this->drupalPostForm('search/node', array('keys' => $text), t('Search'));
     $this->drupalGet('admin/reports/dblog');
     $this->assertLink('Searched Content for ' . $text . '.', 0, 'Search was logged');
@@ -241,8 +241,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'])));
@@ -253,7 +253,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.'));
@@ -261,8 +261,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/src/Tests/SearchKeywordsConditionsTest.php b/core/modules/search/src/Tests/SearchKeywordsConditionsTest.php
index d1217cf..e3c6b01 100644
--- a/core/modules/search/src/Tests/SearchKeywordsConditionsTest.php
+++ b/core/modules/search/src/Tests/SearchKeywordsConditionsTest.php
@@ -42,14 +42,14 @@ 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", array('query' => array('keys' => $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", array('query' => array('keys' => 'bike', 'search_conditions' => $keys)));
     $this->assertText("Dummy search snippet to display.");
     $this->assertRaw(print_r(array('keys' => 'bike', 'search_conditions' => $keys), TRUE));
diff --git a/core/modules/search/src/Tests/SearchLanguageTest.php b/core/modules/search/src/Tests/SearchLanguageTest.php
index e6a158a..d2c42b2 100644
--- a/core/modules/search/src/Tests/SearchLanguageTest.php
+++ b/core/modules/search/src/Tests/SearchLanguageTest.php
@@ -51,19 +51,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',
       ),
     );
@@ -74,12 +74,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/src/Tests/SearchMultilingualEntityTest.php b/core/modules/search/src/Tests/SearchMultilingualEntityTest.php
index f354940..8c9e833 100644
--- a/core/modules/search/src/Tests/SearchMultilingualEntityTest.php
+++ b/core/modules/search/src/Tests/SearchMultilingualEntityTest.php
@@ -76,19 +76,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',
       ),
       // After the third node, we don't care what the settings are. But we
@@ -112,14 +112,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();
 
     // Verify that we have 8 nodes left to do.
diff --git a/core/modules/search/src/Tests/SearchPageOverrideTest.php b/core/modules/search/src/Tests/SearchPageOverrideTest.php
index 3855eb2..a7edf87 100644
--- a/core/modules/search/src/Tests/SearchPageOverrideTest.php
+++ b/core/modules/search/src/Tests/SearchPageOverrideTest.php
@@ -35,7 +35,7 @@ function setUp() {
   }
 
   function testSearchPageHook() {
-    $keys = 'bike shed ' . $this->randomName();
+    $keys = 'bike shed ' . $this->randomMachineName();
     $this->drupalGet("search/dummy_path", array('query' => array('keys' => $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/src/Tests/SearchPageTextTest.php b/core/modules/search/src/Tests/SearchPageTextTest.php
index 901751a..c9dc323 100644
--- a/core/modules/search/src/Tests/SearchPageTextTest.php
+++ b/core/modules/search/src/Tests/SearchPageTextTest.php
@@ -34,7 +34,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'));
@@ -50,7 +50,7 @@ function testSearchText() {
 
     // Test that search keywords containing slashes are correctly loaded
     // from the GET params and displayed in the search form.
-    $arg = $this->randomName() . '/' . $this->randomName();
+    $arg = $this->randomMachineName() . '/' . $this->randomMachineName();
     $this->drupalGet('search/node', array('query' => array('keys' => $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.');
@@ -61,7 +61,7 @@ function testSearchText() {
     $keys = array();
     for ($i = 0; $i < $limit + 1; $i++) {
       // Use a key of 4 characters to ensure we never generate 'AND' or 'OR'.
-      $keys[] = $this->randomName(4);
+      $keys[] = $this->randomMachineName(4);
       if ($i % 2 == 0) {
         $keys[] = 'OR';
       }
@@ -79,18 +79,18 @@ function testSearchText() {
 
     // Make sure the "Please enter some keywords" message is NOT displayed if
     // you use "or" words or phrases in Advanced Search.
-    $this->drupalPostForm('search/node', array('or' => $this->randomName() . ' ' . $this->randomName()), t('Advanced search'));
+    $this->drupalPostForm('search/node', array('or' => $this->randomMachineName() . ' ' . $this->randomMachineName()), t('Advanced search'));
     $this->assertNoText(t('Please enter some keywords'), 'With advanced OR keywords entered, no keywords message is not displayed on node page');
-    $this->drupalPostForm('search/node', array('phrase' => '"' . $this->randomName() . '" "' . $this->randomName() . '"'), t('Advanced search'));
+    $this->drupalPostForm('search/node', array('phrase' => '"' . $this->randomMachineName() . '" "' . $this->randomMachineName() . '"'), t('Advanced search'));
     $this->assertNoText(t('Please enter some keywords'), 'With advanced phrase entered, no keywords message is not displayed on node page');
 
     // Verify that if you search for a too-short keyword, you get the right
     // message, and that if after that you search for a longer keyword, you
     // do not still see the message.
-    $this->drupalPostForm('search/node', array('keys' => $this->randomName(1)), t('Search'));
+    $this->drupalPostForm('search/node', array('keys' => $this->randomMachineName(1)), t('Search'));
     $this->assertText('You must include at least one positive keyword', 'Keyword message is displayed when searching for short word');
     $this->assertNoText(t('Please enter some keywords'), 'With short word entered, no keywords message is not displayed');
-    $this->drupalPostForm(NULL, array('keys' => $this->randomName()), t('Search'));
+    $this->drupalPostForm(NULL, array('keys' => $this->randomMachineName()), t('Search'));
     $this->assertNoText('You must include at least one positive keyword', 'Keyword message is not displayed when searching for long word after short word search');
 
     // Test that if you search for a URL with .. in it, you still end up at
diff --git a/core/modules/serialization/src/Tests/EntitySerializationTest.php b/core/modules/serialization/src/Tests/EntitySerializationTest.php
index 8a91589..deb55b2 100644
--- a/core/modules/serialization/src/Tests/EntitySerializationTest.php
+++ b/core/modules/serialization/src/Tests/EntitySerializationTest.php
@@ -50,10 +50,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/src/Tests/ShortcutLinksTest.php b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php
index 2b65d21..e13b4eb 100644
--- a/core/modules/shortcut/src/Tests/ShortcutLinksTest.php
+++ b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php
@@ -32,7 +32,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']);
 
@@ -49,7 +49,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'],
@@ -113,7 +113,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/src/Tests/ShortcutSetsTest.php b/core/modules/shortcut/src/Tests/ShortcutSetsTest.php
index c4c26c7..21de52e 100644
--- a/core/modules/shortcut/src/Tests/ShortcutSetsTest.php
+++ b/core/modules/shortcut/src/Tests/ShortcutSetsTest.php
@@ -22,8 +22,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']);
@@ -36,7 +36,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.
@@ -50,7 +50,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);
@@ -63,7 +63,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'));
@@ -89,7 +89,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'));
@@ -101,7 +101,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)));
@@ -113,7 +113,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);
@@ -126,7 +126,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');
@@ -145,7 +145,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/src/Tests/ShortcutTestBase.php b/core/modules/shortcut/src/Tests/ShortcutTestBase.php
index 6d9e240..3e1099e 100644
--- a/core/modules/shortcut/src/Tests/ShortcutTestBase.php
+++ b/core/modules/shortcut/src/Tests/ShortcutTestBase.php
@@ -90,7 +90,7 @@ function setUp() {
    */
   function generateShortcutSet($label = '', $id = NULL) {
     $set = ShortcutSet::create(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/src/InstallerTestBase.php b/core/modules/simpletest/src/InstallerTestBase.php
index df33c41..34354a5 100644
--- a/core/modules/simpletest/src/InstallerTestBase.php
+++ b/core/modules/simpletest/src/InstallerTestBase.php
@@ -82,7 +82,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/src/TestBase.php b/core/modules/simpletest/src/TestBase.php
index e6fe068..59787d7 100644
--- a/core/modules/simpletest/src/TestBase.php
+++ b/core/modules/simpletest/src/TestBase.php
@@ -1302,7 +1302,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.
@@ -1363,7 +1363,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/src/Tests/MailCaptureTest.php b/core/modules/simpletest/src/Tests/MailCaptureTest.php
index bbbd026..e8999a4 100644
--- a/core/modules/simpletest/src/Tests/MailCaptureTest.php
+++ b/core/modules/simpletest/src/Tests/MailCaptureTest.php
@@ -54,7 +54,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/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php
index ac2f0a0..960d690 100644
--- a/core/modules/simpletest/src/WebTestBase.php
+++ b/core/modules/simpletest/src/WebTestBase.php
@@ -182,7 +182,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.
    *
@@ -216,7 +216,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
@@ -239,7 +239,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'       => '',
@@ -268,7 +268,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(),
     );
 
@@ -295,7 +295,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 {
@@ -393,9 +393,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(
@@ -548,7 +548,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;
@@ -588,7 +588,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)) {
@@ -793,7 +793,7 @@ protected function setUp() {
       'uid' => 1,
       'name' => 'admin',
       'mail' => 'admin@example.com',
-      'pass_raw' => $this->randomName(),
+      'pass_raw' => $this->randomMachineName(),
     ));
 
     // Some tests (SessionTest and SessionHttpsTest) need to examine whether the
diff --git a/core/modules/statistics/src/Tests/StatisticsLoggingTest.php b/core/modules/statistics/src/Tests/StatisticsLoggingTest.php
index 82a9764..9d28a43 100644
--- a/core/modules/statistics/src/Tests/StatisticsLoggingTest.php
+++ b/core/modules/statistics/src/Tests/StatisticsLoggingTest.php
@@ -44,7 +44,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/src/Tests/Action/ActionUnitTest.php b/core/modules/system/src/Tests/Action/ActionUnitTest.php
index 2a5934c..937c6e0 100644
--- a/core/modules/system/src/Tests/Action/ActionUnitTest.php
+++ b/core/modules/system/src/Tests/Action/ActionUnitTest.php
@@ -60,7 +60,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/src/Tests/Block/SystemMenuBlockTest.php b/core/modules/system/src/Tests/Block/SystemMenuBlockTest.php
index 0d1d00b..95a4258 100644
--- a/core/modules/system/src/Tests/Block/SystemMenuBlockTest.php
+++ b/core/modules/system/src/Tests/Block/SystemMenuBlockTest.php
@@ -31,8 +31,8 @@ class SystemMenuBlockTest extends DrupalUnitTestBase {
    */
   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/src/Tests/Cache/ClearTest.php b/core/modules/system/src/Tests/Cache/ClearTest.php
index 740ec8e..6239339 100644
--- a/core/modules/system/src/Tests/Cache/ClearTest.php
+++ b/core/modules/system/src/Tests/Cache/ClearTest.php
@@ -18,7 +18,7 @@ class ClearTest extends CacheTestBase {
 
   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/src/Tests/Cache/GenericCacheBackendUnitTestBase.php b/core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php
index 96d850d..a949b35 100644
--- a/core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php
+++ b/core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php
@@ -108,7 +108,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/src/Tests/Common/AddFeedTest.php b/core/modules/system/src/Tests/Common/AddFeedTest.php
index 3dd0c67..beeb522 100644
--- a/core/modules/system/src/Tests/Common/AddFeedTest.php
+++ b/core/modules/system/src/Tests/Common/AddFeedTest.php
@@ -21,13 +21,13 @@ class AddFeedTest extends WebTestBase {
    * 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->randomName(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->randomName(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(),
@@ -48,15 +48,15 @@ function testBasicFeedAddNoTitle() {
       ),
       'path with title' => array(
         'url' => url($path_for_title, array('absolute' => TRUE)),
-        'title' => $this->randomName(12),
+        'title' => $this->randomMachineName(12),
       ),
       'external URL with title' => array(
         'url' => $external_for_title,
-        'title' => $this->randomName(12),
+        'title' => $this->randomMachineName(12),
       ),
       'local URL with title' => array(
         'url' => $fully_qualified_for_title,
-        'title' => $this->randomName(12),
+        'title' => $this->randomMachineName(12),
       ),
     );
 
diff --git a/core/modules/system/src/Tests/Common/RegionContentTest.php b/core/modules/system/src/Tests/Common/RegionContentTest.php
index 6b2d3a4..779f129 100644
--- a/core/modules/system/src/Tests/Common/RegionContentTest.php
+++ b/core/modules/system/src/Tests/Common/RegionContentTest.php
@@ -22,13 +22,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/src/Tests/Common/RenderTest.php b/core/modules/system/src/Tests/Common/RenderTest.php
index e673208..7c1a780 100644
--- a/core/modules/system/src/Tests/Common/RenderTest.php
+++ b/core/modules/system/src/Tests/Common/RenderTest.php
@@ -279,8 +279,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(
@@ -391,8 +391,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/src/Tests/Common/RenderWebTest.php b/core/modules/system/src/Tests/Common/RenderWebTest.php
index 13ed788..3c8725a 100644
--- a/core/modules/system/src/Tests/Common/RenderWebTest.php
+++ b/core/modules/system/src/Tests/Common/RenderWebTest.php
@@ -31,63 +31,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',
@@ -97,15 +97,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,
       ),
@@ -118,7 +118,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'],
@@ -127,14 +127,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/src/Tests/Common/UrlTest.php b/core/modules/system/src/Tests/Common/UrlTest.php
index 0457146..e6d71e9 100644
--- a/core/modules/system/src/Tests/Common/UrlTest.php
+++ b/core/modules/system/src/Tests/Common/UrlTest.php
@@ -32,7 +32,7 @@ class UrlTest extends WebTestBase {
    */
   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));
@@ -41,7 +41,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);
@@ -113,15 +113,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(
@@ -266,7 +266,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.');
 
@@ -277,13 +277,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->randomName(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->randomName(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/src/Tests/Common/WriteRecordTest.php b/core/modules/system/src/Tests/Common/WriteRecordTest.php
index 59d37da..b019328 100644
--- a/core/modules/system/src/Tests/Common/WriteRecordTest.php
+++ b/core/modules/system/src/Tests/Common/WriteRecordTest.php
@@ -132,7 +132,7 @@ function testDrupalWriteRecord() {
 
     // Insert an object record for a table with a multi-field primary key.
     $composite_primary = new \stdClass();
-    $composite_primary->name = $this->randomName();
+    $composite_primary->name = $this->randomMachineName();
     $composite_primary->age = mt_rand();
     $insert_result = drupal_write_record('test_composite_primary', $composite_primary);
     $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/src/Tests/Condition/ConditionFormTest.php b/core/modules/system/src/Tests/Condition/ConditionFormTest.php
index 3bc69f4..2ccb51d 100644
--- a/core/modules/system/src/Tests/Condition/ConditionFormTest.php
+++ b/core/modules/system/src/Tests/Condition/ConditionFormTest.php
@@ -28,7 +28,7 @@ class ConditionFormTest extends WebTestBase {
   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/src/Tests/Database/ConnectionTest.php b/core/modules/system/src/Tests/Database/ConnectionTest.php
index 4c93094..f3e67ad 100644
--- a/core/modules/system/src/Tests/Database/ConnectionTest.php
+++ b/core/modules/system/src/Tests/Database/ConnectionTest.php
@@ -40,7 +40,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/src/Tests/Database/SelectComplexTest.php b/core/modules/system/src/Tests/Database/SelectComplexTest.php
index 13f6589..7932816 100644
--- a/core/modules/system/src/Tests/Database/SelectComplexTest.php
+++ b/core/modules/system/src/Tests/Database/SelectComplexTest.php
@@ -327,8 +327,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' => 'replica'));
diff --git a/core/modules/system/src/Tests/Database/SelectTest.php b/core/modules/system/src/Tests/Database/SelectTest.php
index 3579f83..26dd109 100644
--- a/core/modules/system/src/Tests/Database/SelectTest.php
+++ b/core/modules/system/src/Tests/Database/SelectTest.php
@@ -310,7 +310,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/src/Tests/Entity/ConfigEntityQueryTest.php b/core/modules/system/src/Tests/Entity/ConfigEntityQueryTest.php
index d29ed00..528c73b 100644
--- a/core/modules/system/src/Tests/Entity/ConfigEntityQueryTest.php
+++ b/core/modules/system/src/Tests/Entity/ConfigEntityQueryTest.php
@@ -59,7 +59,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,
@@ -70,7 +70,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,
@@ -81,7 +81,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,
@@ -92,7 +92,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,
@@ -103,7 +103,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/src/Tests/Entity/EntityFieldTest.php b/core/modules/system/src/Tests/Entity/EntityFieldTest.php
index 5d5b9e4..2371957 100644
--- a/core/modules/system/src/Tests/Entity/EntityFieldTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityFieldTest.php
@@ -56,9 +56,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.
@@ -100,12 +100,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)));
 
@@ -195,16 +195,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/src/Tests/Entity/EntityFormTest.php b/core/modules/system/src/Tests/Entity/EntityFormTest.php
index fca9c00..9a21340 100644
--- a/core/modules/system/src/Tests/Entity/EntityFormTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityFormTest.php
@@ -57,13 +57,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/src/Tests/Entity/EntityLanguageTestBase.php b/core/modules/system/src/Tests/Entity/EntityLanguageTestBase.php
index b257907..19cf1ad 100644
--- a/core/modules/system/src/Tests/Entity/EntityLanguageTestBase.php
+++ b/core/modules/system/src/Tests/Entity/EntityLanguageTestBase.php
@@ -63,10 +63,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/src/Tests/Entity/EntityQueryRelationshipTest.php b/core/modules/system/src/Tests/Entity/EntityQueryRelationshipTest.php
index 552ba65..cce7128 100644
--- a/core/modules/system/src/Tests/Entity/EntityQueryRelationshipTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityQueryRelationshipTest.php
@@ -69,11 +69,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',
@@ -91,7 +91,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();
@@ -103,7 +103,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/src/Tests/Entity/EntityQueryTest.php b/core/modules/system/src/Tests/Entity/EntityQueryTest.php
index 9e3d7b6..478068e 100644
--- a/core/modules/system/src/Tests/Entity/EntityQueryTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityQueryTest.php
@@ -56,8 +56,8 @@ function setUp() {
 
     $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_storage = entity_create('field_storage_config', array(
         'name' => $field_name,
@@ -74,7 +74,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 ($field_storages as $field_storage) {
@@ -127,12 +127,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) {
@@ -433,7 +433,7 @@ protected function testCount() {
       'translatable' => TRUE,
     ));
     $field_storage->save();
-    $bundle = $this->randomName();
+    $bundle = $this->randomMachineName();
     entity_create('field_instance_config', array(
       'field_storage' => $field_storage,
       'bundle' => $bundle,
diff --git a/core/modules/system/src/Tests/Entity/EntityRevisionsTest.php b/core/modules/system/src/Tests/Entity/EntityRevisionsTest.php
index c7f7c5f..9b0a076 100644
--- a/core/modules/system/src/Tests/Entity/EntityRevisionsTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityRevisionsTest.php
@@ -74,8 +74,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/src/Tests/Entity/EntityTranslationFormTest.php b/core/modules/system/src/Tests/Entity/EntityTranslationFormTest.php
index 197b871..246b053 100644
--- a/core/modules/system/src/Tests/Entity/EntityTranslationFormTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityTranslationFormTest.php
@@ -56,8 +56,8 @@ function testEntityFormLanguage() {
 
     // Create a node with language LanguageInterface::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;
@@ -87,8 +87,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.');
@@ -106,7 +106,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/src/Tests/Entity/EntityTranslationTest.php b/core/modules/system/src/Tests/Entity/EntityTranslationTest.php
index 51117b4..f5b690f 100644
--- a/core/modules/system/src/Tests/Entity/EntityTranslationTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityTranslationTest.php
@@ -137,7 +137,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];
 
@@ -189,7 +189,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)),
         );
       }
@@ -290,7 +290,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();
@@ -308,9 +308,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.');
@@ -352,7 +352,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) {
@@ -371,7 +371,7 @@ function testEntityTranslationAPI() {
 
     // Check that removing an invalid translation causes an exception to be
     // thrown.
-    foreach (array($default_langcode, LanguageInterface::LANGCODE_DEFAULT, $this->randomName()) as $invalid_langcode) {
+    foreach (array($default_langcode, LanguageInterface::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);
@@ -395,12 +395,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.');
 
@@ -418,7 +418,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;
@@ -447,7 +447,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);
     }
 
@@ -563,8 +563,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) {
@@ -582,7 +582,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/src/Tests/Entity/EntityUUIDTest.php b/core/modules/system/src/Tests/Entity/EntityUUIDTest.php
index a5de69a..07107bb 100644
--- a/core/modules/system/src/Tests/Entity/EntityUUIDTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityUUIDTest.php
@@ -43,7 +43,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);
@@ -51,7 +51,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/src/Tests/Entity/EntityUnitTestBase.php b/core/modules/system/src/Tests/Entity/EntityUnitTestBase.php
index 24a4de9..bcc086c 100644
--- a/core/modules/system/src/Tests/Entity/EntityUnitTestBase.php
+++ b/core/modules/system/src/Tests/Entity/EntityUnitTestBase.php
@@ -66,8 +66,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);
@@ -75,7 +75,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/src/Tests/Entity/EntityValidationTest.php b/core/modules/system/src/Tests/Entity/EntityValidationTest.php
index eaa3dae..ec858bd 100644
--- a/core/modules/system/src/Tests/Entity/EntityValidationTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityValidationTest.php
@@ -48,9 +48,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/src/Tests/Entity/EntityViewBuilderTest.php b/core/modules/system/src/Tests/Entity/EntityViewBuilderTest.php
index 61854f2..a7e4162 100644
--- a/core/modules/system/src/Tests/Entity/EntityViewBuilderTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityViewBuilderTest.php
@@ -183,7 +183,7 @@ public function testEntityViewBuilderWeight() {
   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/src/Tests/Entity/EntityViewControllerTest.php b/core/modules/system/src/Tests/Entity/EntityViewControllerTest.php
index bc07bd0..1c19d39 100644
--- a/core/modules/system/src/Tests/Entity/EntityViewControllerTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityViewControllerTest.php
@@ -34,7 +34,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();
@@ -82,7 +82,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/src/Tests/Entity/FieldAccessTest.php b/core/modules/system/src/Tests/Entity/FieldAccessTest.php
index cfbb6c9..30c874b 100644
--- a/core/modules/system/src/Tests/Entity/FieldAccessTest.php
+++ b/core/modules/system/src/Tests/Entity/FieldAccessTest.php
@@ -52,7 +52,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/src/Tests/Entity/FieldSqlStorageTest.php b/core/modules/system/src/Tests/Entity/FieldSqlStorageTest.php
index ee1ca2c..2ae87fc 100644
--- a/core/modules/system/src/Tests/Entity/FieldSqlStorageTest.php
+++ b/core/modules/system/src/Tests/Entity/FieldSqlStorageTest.php
@@ -63,7 +63,7 @@ function setUp() {
     $this->installEntitySchema('entity_test_rev');
     $entity_type = 'entity_test_rev';
 
-    $this->field_name = strtolower($this->randomName());
+    $this->field_name = strtolower($this->randomMachineName());
     $this->field_cardinality = 4;
     $this->fieldStorage = entity_create('field_storage_config', array(
       'name' => $this->field_name,
@@ -255,7 +255,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(FieldStorageConfig::NAME_MAX_LENGTH - 1));
+    $name_base = drupal_strtolower($this->randomMachineName(FieldStorageConfig::NAME_MAX_LENGTH - 1));
     $field_names = array();
     $values = array();
     for ($i = 0; $i < 2; $i++) {
diff --git a/core/modules/system/src/Tests/Entity/FieldTranslationSqlStorageTest.php b/core/modules/system/src/Tests/Entity/FieldTranslationSqlStorageTest.php
index b112957..511eeec 100644
--- a/core/modules/system/src/Tests/Entity/FieldTranslationSqlStorageTest.php
+++ b/core/modules/system/src/Tests/Entity/FieldTranslationSqlStorageTest.php
@@ -27,8 +27,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();
@@ -61,7 +61,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, $entity_type);
diff --git a/core/modules/system/src/Tests/File/DirectoryTest.php b/core/modules/system/src/Tests/File/DirectoryTest.php
index c4ca643..c27ec88 100644
--- a/core/modules/system/src/Tests/File/DirectoryTest.php
+++ b/core/modules/system/src/Tests/File/DirectoryTest.php
@@ -21,8 +21,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');
@@ -46,7 +46,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->randomName();
     $this->assertTrue(drupal_mkdir($absolute_path, 0775, TRUE), 'No error reported when creating new absolute directories.', 'File');
     $this->assertDirectoryPermissions($absolute_path, 0775);
   }
@@ -56,7 +56,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->randomName();
     $this->assertFalse(is_dir($directory), 'Directory does not exist prior to testing.');
 
     // Non-existent directory.
diff --git a/core/modules/system/src/Tests/File/FileTestBase.php b/core/modules/system/src/Tests/File/FileTestBase.php
index 40a00e2..d939255 100644
--- a/core/modules/system/src/Tests/File/FileTestBase.php
+++ b/core/modules/system/src/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/src/Tests/File/NameMungingTest.php b/core/modules/system/src/Tests/File/NameMungingTest.php
index 7dfa878..669af77 100644
--- a/core/modules/system/src/Tests/File/NameMungingTest.php
+++ b/core/modules/system/src/Tests/File/NameMungingTest.php
@@ -16,7 +16,7 @@ class NameMungingTest extends FileTestBase {
   function setUp() {
     parent::setUp();
     $this->bad_extension = 'php';
-    $this->name = $this->randomName() . '.' . $this->bad_extension . '.txt';
+    $this->name = $this->randomMachineName() . '.' . $this->bad_extension . '.txt';
   }
 
   /**
@@ -35,7 +35,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/src/Tests/File/ReadOnlyStreamWrapperTest.php b/core/modules/system/src/Tests/File/ReadOnlyStreamWrapperTest.php
index 96747b0..c9cb68b 100644
--- a/core/modules/system/src/Tests/File/ReadOnlyStreamWrapperTest.php
+++ b/core/modules/system/src/Tests/File/ReadOnlyStreamWrapperTest.php
@@ -33,7 +33,7 @@ class ReadOnlyStreamWrapperTest extends FileTestBase {
    */
   function testWriteFunctions() {
     // Generate a test file
-    $filename = $this->randomName();
+    $filename = $this->randomMachineName();
     $filepath = conf_path() . '/files/' . $filename;
     file_put_contents($filepath, $filename);
 
@@ -64,7 +64,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.)
@@ -76,7 +76,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/src/Tests/File/UnmanagedCopyTest.php b/core/modules/system/src/Tests/File/UnmanagedCopyTest.php
index 5a3a4de..0169702 100644
--- a/core/modules/system/src/Tests/File/UnmanagedCopyTest.php
+++ b/core/modules/system/src/Tests/File/UnmanagedCopyTest.php
@@ -23,7 +23,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.');
@@ -32,7 +32,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.');
@@ -50,9 +50,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/src/Tests/File/UnmanagedDeleteRecursiveTest.php b/core/modules/system/src/Tests/File/UnmanagedDeleteRecursiveTest.php
index 892f317..50fdbc1 100644
--- a/core/modules/system/src/Tests/File/UnmanagedDeleteRecursiveTest.php
+++ b/core/modules/system/src/Tests/File/UnmanagedDeleteRecursiveTest.php
@@ -18,7 +18,7 @@ class UnmanagedDeleteRecursiveTest extends FileTestBase {
    */
   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/src/Tests/File/UnmanagedDeleteTest.php b/core/modules/system/src/Tests/File/UnmanagedDeleteTest.php
index a3638aa..4c649da 100644
--- a/core/modules/system/src/Tests/File/UnmanagedDeleteTest.php
+++ b/core/modules/system/src/Tests/File/UnmanagedDeleteTest.php
@@ -30,7 +30,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/src/Tests/File/UnmanagedMoveTest.php b/core/modules/system/src/Tests/File/UnmanagedMoveTest.php
index 6e79062..8fe2014 100644
--- a/core/modules/system/src/Tests/File/UnmanagedMoveTest.php
+++ b/core/modules/system/src/Tests/File/UnmanagedMoveTest.php
@@ -23,7 +23,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.');
@@ -32,7 +32,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);
@@ -51,7 +51,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->randomName());
     $this->assertFalse($new_filepath, 'Moving a missing file fails.');
   }
 
diff --git a/core/modules/system/src/Tests/File/UnmanagedSaveDataTest.php b/core/modules/system/src/Tests/File/UnmanagedSaveDataTest.php
index f3548f2..fc715c6 100644
--- a/core/modules/system/src/Tests/File/UnmanagedSaveDataTest.php
+++ b/core/modules/system/src/Tests/File/UnmanagedSaveDataTest.php
@@ -17,7 +17,7 @@ class UnmanagedSaveDataTest extends FileTestBase {
    * 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/src/Tests/Form/ElementsTableSelectTest.php b/core/modules/system/src/Tests/Form/ElementsTableSelectTest.php
index b0ce2f8..e059905 100644
--- a/core/modules/system/src/Tests/Form/ElementsTableSelectTest.php
+++ b/core/modules/system/src/Tests/Form/ElementsTableSelectTest.php
@@ -206,7 +206,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 = \Drupal::formBuilder()->getFormStateDefaults();
 
     $form['op'] = array('#type' => 'submit', '#value' => t('Submit'));
diff --git a/core/modules/system/src/Tests/Form/FormCacheTest.php b/core/modules/system/src/Tests/Form/FormCacheTest.php
index b33c749..33bc874 100644
--- a/core/modules/system/src/Tests/Form/FormCacheTest.php
+++ b/core/modules/system/src/Tests/Form/FormCacheTest.php
@@ -28,12 +28,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 = \Drupal::formBuilder()->getFormStateDefaults();
-    $this->form_state['example'] = $this->randomName();
+    $this->form_state['example'] = $this->randomMachineName();
   }
 
   /**
@@ -59,7 +59,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 = \Drupal::formBuilder()->getFormStateDefaults();
     $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');
@@ -71,7 +71,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 = \Drupal::formBuilder()->getFormStateDefaults();
diff --git a/core/modules/system/src/Tests/Form/FormTest.php b/core/modules/system/src/Tests/Form/FormTest.php
index 2b4850e..ba11f78 100644
--- a/core/modules/system/src/Tests/Form/FormTest.php
+++ b/core/modules/system/src/Tests/Form/FormTest.php
@@ -55,43 +55,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->randomName(), $this->randomName(), $this->randomName()));
     $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->randomName(), $this->randomName(), $this->randomName()));
     $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->randomName(), $this->randomName(), $this->randomName()));
     $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.
@@ -100,7 +100,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 = \Drupal::formBuilder()->getFormStateDefaults();
           $form['op'] = array('#type' => 'submit', '#value' => t('Submit'));
diff --git a/core/modules/system/src/Tests/Form/LanguageSelectElementTest.php b/core/modules/system/src/Tests/Form/LanguageSelectElementTest.php
index 9aa3400..be393be 100644
--- a/core/modules/system/src/Tests/Form/LanguageSelectElementTest.php
+++ b/core/modules/system/src/Tests/Form/LanguageSelectElementTest.php
@@ -34,13 +34,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/src/Tests/Form/RedirectTest.php b/core/modules/system/src/Tests/Form/RedirectTest.php
index 51be0d8..cf8c5a0 100644
--- a/core/modules/system/src/Tests/Form/RedirectTest.php
+++ b/core/modules/system/src/Tests/Form/RedirectTest.php
@@ -34,7 +34,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.');
@@ -50,7 +50,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/src/Tests/Form/ValidationTest.php b/core/modules/system/src/Tests/Form/ValidationTest.php
index d62d526..607db5c 100644
--- a/core/modules/system/src/Tests/Form/ValidationTest.php
+++ b/core/modules/system/src/Tests/Form/ValidationTest.php
@@ -176,7 +176,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/src/Tests/Installer/SiteNameTest.php b/core/modules/system/src/Tests/Installer/SiteNameTest.php
index 983b208..484e3e8 100644
--- a/core/modules/system/src/Tests/Installer/SiteNameTest.php
+++ b/core/modules/system/src/Tests/Installer/SiteNameTest.php
@@ -27,7 +27,7 @@ class SiteNameTest extends WebTestBase {
    * 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/src/Tests/KeyValueStore/DatabaseStorageExpirableTest.php b/core/modules/system/src/Tests/KeyValueStore/DatabaseStorageExpirableTest.php
index 115ad3b..b18befa 100644
--- a/core/modules/system/src/Tests/KeyValueStore/DatabaseStorageExpirableTest.php
+++ b/core/modules/system/src/Tests/KeyValueStore/DatabaseStorageExpirableTest.php
@@ -106,7 +106,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).
@@ -145,12 +145,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/src/Tests/KeyValueStore/GarbageCollectionTest.php b/core/modules/system/src/Tests/KeyValueStore/GarbageCollectionTest.php
index 6341f51..ca63c3b 100644
--- a/core/modules/system/src/Tests/KeyValueStore/GarbageCollectionTest.php
+++ b/core/modules/system/src/Tests/KeyValueStore/GarbageCollectionTest.php
@@ -35,7 +35,7 @@ protected function tearDown() {
    * Tests garbage collection.
    */
   public function testGarbageCollection() {
-    $collection = $this->randomName();
+    $collection = $this->randomMachineName();
     $store = new DatabaseStorageExpirable($collection, new PhpSerialize(), Database::getConnection());
 
     // Insert some items and confirm that they're set.
diff --git a/core/modules/system/src/Tests/KeyValueStore/KeyValueContentEntityStorageTest.php b/core/modules/system/src/Tests/KeyValueStore/KeyValueContentEntityStorageTest.php
index 9dd9b22..c43f385 100644
--- a/core/modules/system/src/Tests/KeyValueStore/KeyValueContentEntityStorageTest.php
+++ b/core/modules/system/src/Tests/KeyValueStore/KeyValueContentEntityStorageTest.php
@@ -79,7 +79,7 @@ function testCRUD() {
 
     // Verify properties on a newly created entity.
     $entity_test = entity_create('entity_test_label', $expected = array(
-      'id' => $this->randomName(),
+      'id' => $this->randomMachineName(),
       'name' => $this->randomString(),
     ));
     $this->assertIdentical($entity_test->id->value, $expected['id']);
@@ -133,7 +133,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->randomName(4));
     for ($i = 1; $i < 3; $i++) {
       $old_id = $ids[$i - 1];
       $new_id = $ids[$i];
diff --git a/core/modules/system/src/Tests/KeyValueStore/StorageTestBase.php b/core/modules/system/src/Tests/KeyValueStore/StorageTestBase.php
index 396f028..0190e6b 100644
--- a/core/modules/system/src/Tests/KeyValueStore/StorageTestBase.php
+++ b/core/modules/system/src/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/src/Tests/Mail/WrapMailUnitTest.php b/core/modules/system/src/Tests/Mail/WrapMailUnitTest.php
index e9a6619..d687e78 100644
--- a/core/modules/system/src/Tests/Mail/WrapMailUnitTest.php
+++ b/core/modules/system/src/Tests/Mail/WrapMailUnitTest.php
@@ -21,12 +21,12 @@ class WrapMailUnitTest extends UnitTestBase {
    */
   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->randomName(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/src/Tests/Menu/BreadcrumbTest.php b/core/modules/system/src/Tests/Menu/BreadcrumbTest.php
index f1bf640..1fffa67 100644
--- a/core/modules/system/src/Tests/Menu/BreadcrumbTest.php
+++ b/core/modules/system/src/Tests/Menu/BreadcrumbTest.php
@@ -170,7 +170,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/src/Tests/Menu/MenuRouterTest.php b/core/modules/system/src/Tests/Menu/MenuRouterTest.php
index cc64d4b..045b8c0 100644
--- a/core/modules/system/src/Tests/Menu/MenuRouterTest.php
+++ b/core/modules/system/src/Tests/Menu/MenuRouterTest.php
@@ -66,7 +66,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/src/Tests/ParamConverter/UpcastingTest.php b/core/modules/system/src/Tests/ParamConverter/UpcastingTest.php
index a9f8335..0809777 100644
--- a/core/modules/system/src/Tests/ParamConverter/UpcastingTest.php
+++ b/core/modules/system/src/Tests/ParamConverter/UpcastingTest.php
@@ -29,7 +29,7 @@ class UpcastingTest extends WebTestBase {
    * 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';
 
@@ -52,8 +52,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/src/Tests/Path/AliasTest.php b/core/modules/system/src/Tests/Path/AliasTest.php
index 5727d52..0deddc8 100644
--- a/core/modules/system/src/Tests/Path/AliasTest.php
+++ b/core/modules/system/src/Tests/Path/AliasTest.php
@@ -172,28 +172,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();
@@ -205,7 +205,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/src/Tests/Path/UrlAlterFunctionalTest.php b/core/modules/system/src/Tests/Path/UrlAlterFunctionalTest.php
index 92ab50f..6f81d0d 100644
--- a/core/modules/system/src/Tests/Path/UrlAlterFunctionalTest.php
+++ b/core/modules/system/src/Tests/Path/UrlAlterFunctionalTest.php
@@ -63,7 +63,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/src/Tests/Plugin/ContextPluginTest.php b/core/modules/system/src/Tests/Plugin/ContextPluginTest.php
index 392d9d4..d67d055 100644
--- a/core/modules/system/src/Tests/Plugin/ContextPluginTest.php
+++ b/core/modules/system/src/Tests/Plugin/ContextPluginTest.php
@@ -25,7 +25,7 @@ class ContextPluginTest extends KernelTestBase {
    * 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/src/Tests/Queue/QueueTest.php b/core/modules/system/src/Tests/Queue/QueueTest.php
index 20dd70f..269c0a7 100644
--- a/core/modules/system/src/Tests/Queue/QueueTest.php
+++ b/core/modules/system/src/Tests/Queue/QueueTest.php
@@ -32,9 +32,9 @@ class QueueTest extends DrupalUnitTestBase {
   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);
@@ -45,9 +45,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);
@@ -65,7 +65,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->randomName());
     }
 
     // Queue items 1 and 2 in the queue1.
diff --git a/core/modules/system/src/Tests/Routing/RouteProviderTest.php b/core/modules/system/src/Tests/Routing/RouteProviderTest.php
index 1600f8e..5f365bc 100644
--- a/core/modules/system/src/Tests/Routing/RouteProviderTest.php
+++ b/core/modules/system/src/Tests/Routing/RouteProviderTest.php
@@ -398,7 +398,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/src/Tests/Routing/RouterTest.php b/core/modules/system/src/Tests/Routing/RouterTest.php
index a7bb8b2..7fd3f97 100644
--- a/core/modules/system/src/Tests/Routing/RouterTest.php
+++ b/core/modules/system/src/Tests/Routing/RouterTest.php
@@ -52,7 +52,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/src/Tests/Session/SessionHttpsTest.php b/core/modules/system/src/Tests/Session/SessionHttpsTest.php
index dadd7cd..b96ecc5 100644
--- a/core/modules/system/src/Tests/Session/SessionHttpsTest.php
+++ b/core/modules/system/src/Tests/Session/SessionHttpsTest.php
@@ -135,7 +135,7 @@ protected function testMixedModeSslSession() {
 
     $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.');
@@ -265,7 +265,7 @@ protected function testCsrfTokenWithMixedModeSsl() {
     // retrieved over HTTP works.
     $form = $this->xpath('//form[@id="session-test-form"]');
     $form[0]['action'] = $this->httpsUrl('session-test/form');
-    $edit = array('input' => $this->randomName(32));
+    $edit = array('input' => $this->randomMachineName(32));
     $this->curlClose();
     $this->drupalPostForm(NULL, $edit, 'Save', array('Cookie: ' . $secure_session_name . '=' . $ssid));
     $this->assertText(String::format('Ok: @input', array('@input' => $edit['input'])));
diff --git a/core/modules/system/src/Tests/Session/SessionTest.php b/core/modules/system/src/Tests/Session/SessionTest.php
index b65ca9f..f058e76 100644
--- a/core/modules/system/src/Tests/Session/SessionTest.php
+++ b/core/modules/system/src/Tests/Session/SessionTest.php
@@ -83,7 +83,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');
@@ -91,7 +91,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');
@@ -109,14 +109,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/src/Tests/System/CronQueueTest.php b/core/modules/system/src/Tests/System/CronQueueTest.php
index a74838b..f1f5fae 100644
--- a/core/modules/system/src/Tests/System/CronQueueTest.php
+++ b/core/modules/system/src/Tests/System/CronQueueTest.php
@@ -31,7 +31,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->randomName()));
 
     // Run cron; the worker for this queue should throw an exception and handle
     // it.
diff --git a/core/modules/system/src/Tests/System/CronRunTest.php b/core/modules/system/src/Tests/System/CronRunTest.php
index 39fe2b6..3f3fdef 100644
--- a/core/modules/system/src/Tests/System/CronRunTest.php
+++ b/core/modules/system/src/Tests/System/CronRunTest.php
@@ -32,7 +32,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/src/Tests/System/DateFormatsMachineNameTest.php b/core/modules/system/src/Tests/System/DateFormatsMachineNameTest.php
index 218ce12..84ed5f7 100644
--- a/core/modules/system/src/Tests/System/DateFormatsMachineNameTest.php
+++ b/core/modules/system/src/Tests/System/DateFormatsMachineNameTest.php
@@ -61,9 +61,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',
     );
@@ -72,7 +72,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/src/Tests/System/DateTimeTest.php b/core/modules/system/src/Tests/System/DateTimeTest.php
index 2300b86..bea87fd 100644
--- a/core/modules/system/src/Tests/System/DateTimeTest.php
+++ b/core/modules/system/src/Tests/System/DateTimeTest.php
@@ -77,7 +77,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/src/Tests/System/FrontPageTest.php b/core/modules/system/src/Tests/System/FrontPageTest.php
index fd72bc2..40c5257 100644
--- a/core/modules/system/src/Tests/System/FrontPageTest.php
+++ b/core/modules/system/src/Tests/System/FrontPageTest.php
@@ -43,7 +43,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,
     );
     $this->drupalCreateNode($settings);
diff --git a/core/modules/system/src/Tests/System/PageNotFoundTest.php b/core/modules/system/src/Tests/System/PageNotFoundTest.php
index 89066a6..dfeac94 100644
--- a/core/modules/system/src/Tests/System/PageNotFoundTest.php
+++ b/core/modules/system/src/Tests/System/PageNotFoundTest.php
@@ -29,7 +29,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.
@@ -38,7 +38,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/src/Tests/System/PageTitleTest.php b/core/modules/system/src/Tests/System/PageTitleTest.php
index 4daa836..c5ef3ec 100644
--- a/core/modules/system/src/Tests/System/PageTitleTest.php
+++ b/core/modules/system/src/Tests/System/PageTitleTest.php
@@ -48,8 +48,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/src/Tests/System/RetrieveFileTest.php b/core/modules/system/src/Tests/System/RetrieveFileTest.php
index 256415a..fc161eb 100644
--- a/core/modules/system/src/Tests/System/RetrieveFileTest.php
+++ b/core/modules/system/src/Tests/System/RetrieveFileTest.php
@@ -20,8 +20,8 @@ class RetrieveFileTest extends WebTestBase {
    */
   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.');
@@ -40,7 +40,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/src/Tests/System/ShutdownFunctionsTest.php b/core/modules/system/src/Tests/System/ShutdownFunctionsTest.php
index 17b4026..d32148c 100644
--- a/core/modules/system/src/Tests/System/ShutdownFunctionsTest.php
+++ b/core/modules/system/src/Tests/System/ShutdownFunctionsTest.php
@@ -35,8 +35,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/src/Tests/System/SystemAuthorizeTest.php b/core/modules/system/src/Tests/System/SystemAuthorizeTest.php
index 53e5c80..8d729d9 100644
--- a/core/modules/system/src/Tests/System/SystemAuthorizeTest.php
+++ b/core/modules/system/src/Tests/System/SystemAuthorizeTest.php
@@ -50,7 +50,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/src/Tests/System/ThemeTest.php b/core/modules/system/src/Tests/System/ThemeTest.php
index 15298f6..e676143 100644
--- a/core/modules/system/src/Tests/System/ThemeTest.php
+++ b/core/modules/system/src/Tests/System/ThemeTest.php
@@ -42,7 +42,7 @@ function testThemeSettings() {
     // Ensure invalid theme settings form URLs return a proper 404.
     $this->drupalGet('admin/appearance/settings/bartik');
     $this->assertResponse(404, 'The theme settings form URL for a disabled theme could not be found.');
-    $this->drupalGet('admin/appearance/settings/' . $this->randomName());
+    $this->drupalGet('admin/appearance/settings/' . $this->randomMachineName());
     $this->assertResponse(404, 'The theme settings form URL for a non-existent theme could not be found.');
 
     // Specify a filesystem path to be used for the logo.
diff --git a/core/modules/system/src/Tests/Theme/EntityFilteringThemeTest.php b/core/modules/system/src/Tests/Theme/EntityFilteringThemeTest.php
index cbb2492..5a25eab 100644
--- a/core/modules/system/src/Tests/Theme/EntityFilteringThemeTest.php
+++ b/core/modules/system/src/Tests/Theme/EntityFilteringThemeTest.php
@@ -113,7 +113,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/src/Tests/Transliteration/TransliterationTest.php b/core/modules/system/src/Tests/Transliteration/TransliterationTest.php
index 27aa4dd..5c9add1 100644
--- a/core/modules/system/src/Tests/Transliteration/TransliterationTest.php
+++ b/core/modules/system/src/Tests/Transliteration/TransliterationTest.php
@@ -27,7 +27,7 @@ class TransliterationTest extends DrupalUnitTestBase {
    * 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/src/Tests/LegacyTest.php b/core/modules/taxonomy/src/Tests/LegacyTest.php
index 409b990..4c90598 100644
--- a/core/modules/taxonomy/src/Tests/LegacyTest.php
+++ b/core/modules/taxonomy/src/Tests/LegacyTest.php
@@ -73,11 +73,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/src/Tests/RssTest.php b/core/modules/taxonomy/src/Tests/RssTest.php
index 334937d..a4805b1 100644
--- a/core/modules/taxonomy/src/Tests/RssTest.php
+++ b/core/modules/taxonomy/src/Tests/RssTest.php
@@ -88,7 +88,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/src/Tests/TaxonomyImageTest.php b/core/modules/taxonomy/src/Tests/TaxonomyImageTest.php
index f1d6aff..7d8589e 100644
--- a/core/modules/taxonomy/src/Tests/TaxonomyImageTest.php
+++ b/core/modules/taxonomy/src/Tests/TaxonomyImageTest.php
@@ -73,7 +73,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/src/Tests/TaxonomyTermReferenceItemTest.php b/core/modules/taxonomy/src/Tests/TaxonomyTermReferenceItemTest.php
index ee13d0f..b2072f2 100644
--- a/core/modules/taxonomy/src/Tests/TaxonomyTermReferenceItemTest.php
+++ b/core/modules/taxonomy/src/Tests/TaxonomyTermReferenceItemTest.php
@@ -39,8 +39,8 @@ public function setUp() {
     $this->installEntitySchema('taxonomy_term');
 
     $vocabulary = entity_create('taxonomy_vocabulary', array(
-      'name' => $this->randomName(),
-      'vid' => drupal_strtolower($this->randomName()),
+      'name' => $this->randomMachineName(),
+      'vid' => drupal_strtolower($this->randomMachineName()),
       'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
     ));
     $vocabulary->save();
@@ -65,7 +65,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' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
     ));
@@ -80,7 +80,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());
@@ -92,7 +92,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.
@@ -101,7 +101,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' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
     ));
diff --git a/core/modules/taxonomy/src/Tests/TaxonomyTestBase.php b/core/modules/taxonomy/src/Tests/TaxonomyTestBase.php
index 3840c65..cdf7395 100644
--- a/core/modules/taxonomy/src/Tests/TaxonomyTestBase.php
+++ b/core/modules/taxonomy/src/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' => LanguageInterface::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/src/Tests/TermFieldMultipleVocabularyTest.php b/core/modules/taxonomy/src/Tests/TermFieldMultipleVocabularyTest.php
index d3894d8..41ad77b 100644
--- a/core/modules/taxonomy/src/Tests/TermFieldMultipleVocabularyTest.php
+++ b/core/modules/taxonomy/src/Tests/TermFieldMultipleVocabularyTest.php
@@ -36,7 +36,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_storage_config', array(
       'name' => $this->field_name,
       'entity_type' => 'entity_test',
@@ -87,7 +87,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'));
@@ -129,7 +129,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/src/Tests/TermFieldTest.php b/core/modules/taxonomy/src/Tests/TermFieldTest.php
index 37f59ee..96cd6d8 100644
--- a/core/modules/taxonomy/src/Tests/TermFieldTest.php
+++ b/core/modules/taxonomy/src/Tests/TermFieldTest.php
@@ -46,7 +46,7 @@ function setUp() {
     $this->vocabulary = $this->createVocabulary();
 
     // Setup a field.
-    $this->field_name = drupal_strtolower($this->randomName());
+    $this->field_name = drupal_strtolower($this->randomMachineName());
     $this->field_storage = entity_create('field_storage_config', array(
       'name' => $this->field_name,
       'entity_type' => 'entity_test',
@@ -110,7 +110,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'));
@@ -167,7 +167,7 @@ function testTaxonomyTermFieldChangeMachineName() {
     );
     $this->field_storage->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/src/Tests/TermIndexTest.php b/core/modules/taxonomy/src/Tests/TermIndexTest.php
index 76bc278..bc7b098 100644
--- a/core/modules/taxonomy/src/Tests/TermIndexTest.php
+++ b/core/modules/taxonomy/src/Tests/TermIndexTest.php
@@ -27,7 +27,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_storage_config', array(
       'name' => $this->field_name_1,
       'entity_type' => 'node',
@@ -58,7 +58,7 @@ function setUp() {
       ))
       ->save();
 
-    $this->field_name_2 = drupal_strtolower($this->randomName());
+    $this->field_name_2 = drupal_strtolower($this->randomMachineName());
     entity_create('field_storage_config', array(
       'name' => $this->field_name_2,
       'entity_type' => 'node',
@@ -100,8 +100,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'));
@@ -148,7 +148,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/src/Tests/TermLanguageTest.php b/core/modules/taxonomy/src/Tests/TermLanguageTest.php
index ffb7e47..591a790 100644
--- a/core/modules/taxonomy/src/Tests/TermLanguageTest.php
+++ b/core/modules/taxonomy/src/Tests/TermLanguageTest.php
@@ -32,7 +32,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);
     }
@@ -51,7 +51,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/src/Tests/TermTest.php b/core/modules/taxonomy/src/Tests/TermTest.php
index ce47f3c..da38bab 100644
--- a/core/modules/taxonomy/src/Tests/TermTest.php
+++ b/core/modules/taxonomy/src/Tests/TermTest.php
@@ -109,8 +109,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'));
 
@@ -153,15 +153,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->randomName(),
+      '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);
@@ -228,8 +228,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(FieldStorageConfig::loadByName('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)));
@@ -297,8 +297,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
     // TermForm::save() handles the invalid term ID correctly.
@@ -323,8 +323,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.
@@ -353,7 +353,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");
@@ -439,8 +439,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.
@@ -534,8 +534,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/src/Tests/TermTranslationUITest.php b/core/modules/taxonomy/src/Tests/TermTranslationUITest.php
index e0d3271..2160214 100644
--- a/core/modules/taxonomy/src/Tests/TermTranslationUITest.php
+++ b/core/modules/taxonomy/src/Tests/TermTranslationUITest.php
@@ -39,7 +39,7 @@ class TermTranslationUITest extends ContentTranslationUITest {
   function setUp() {
     $this->entityTypeId = 'taxonomy_term';
     $this->bundle = 'tags';
-    $this->name = $this->randomName();
+    $this->name = $this->randomMachineName();
     parent::setUp();
   }
 
@@ -52,7 +52,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' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
       'weight' => mt_rand(0, 10),
@@ -116,14 +116,14 @@ function testTranslateLinkVocabularyAdminPage() {
     $this->drupalLogin($this->admin_user);
 
     $values = array(
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
     );
     $translatable_tid = $this->createEntity($values, $this->langcodes[0], $this->vocabulary->id());
 
     // Create an untranslatable vocabulary.
     $untranslatable_vocabulary = entity_create('taxonomy_vocabulary', array(
       'name' => 'untranslatable_voc',
-      'description' => $this->randomName(),
+      'description' => $this->randomMachineName(),
       'vid' => 'untranslatable_voc',
       'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
       'weight' => mt_rand(0, 10),
@@ -131,7 +131,7 @@ function testTranslateLinkVocabularyAdminPage() {
     $untranslatable_vocabulary->save();
 
     $values = array(
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
     );
     $untranslatable_tid = $this->createEntity($values, $this->langcodes[0], $untranslatable_vocabulary->id());
 
diff --git a/core/modules/taxonomy/src/Tests/Views/TaxonomyTestBase.php b/core/modules/taxonomy/src/Tests/Views/TaxonomyTestBase.php
index ee9cc44..9aaff51 100644
--- a/core/modules/taxonomy/src/Tests/Views/TaxonomyTestBase.php
+++ b/core/modules/taxonomy/src/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/src/Tests/VocabularyCrudTest.php b/core/modules/taxonomy/src/Tests/VocabularyCrudTest.php
index 7ca73d4..f63325f 100644
--- a/core/modules/taxonomy/src/Tests/VocabularyCrudTest.php
+++ b/core/modules/taxonomy/src/Tests/VocabularyCrudTest.php
@@ -75,8 +75,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.
@@ -154,7 +154,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();
 
@@ -173,7 +173,7 @@ function testTaxonomyVocabularyChangeMachineName() {
   function testUninstallReinstall() {
     // Fields and field instances attached to taxonomy term bundles should be
     // removed when the module is uninstalled.
-    $field_name = drupal_strtolower($this->randomName() . '_field_name');
+    $field_name = drupal_strtolower($this->randomMachineName() . '_field_name');
     $storage_definition = array(
       'name' => $field_name,
       'entity_type' => 'taxonomy_term',
@@ -185,7 +185,7 @@ function testUninstallReinstall() {
       'field_name' => $field_name,
       'entity_type' => 'taxonomy_term',
       'bundle' => $this->vocabulary->id(),
-      'label' => $this->randomName() . '_label',
+      'label' => $this->randomMachineName() . '_label',
     );
     entity_create('field_instance_config', $instance_definition)->save();
 
diff --git a/core/modules/taxonomy/src/Tests/VocabularyLanguageTest.php b/core/modules/taxonomy/src/Tests/VocabularyLanguageTest.php
index 04d9a09..aed46d7 100644
--- a/core/modules/taxonomy/src/Tests/VocabularyLanguageTest.php
+++ b/core/modules/taxonomy/src/Tests/VocabularyLanguageTest.php
@@ -28,13 +28,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);
   }
@@ -49,9 +49,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'));
@@ -77,8 +77,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,
     );
@@ -116,7 +116,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/src/Tests/VocabularyPermissionsTest.php b/core/modules/taxonomy/src/Tests/VocabularyPermissionsTest.php
index a2d5996..f6c7480 100644
--- a/core/modules/taxonomy/src/Tests/VocabularyPermissionsTest.php
+++ b/core/modules/taxonomy/src/Tests/VocabularyPermissionsTest.php
@@ -32,7 +32,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.');
@@ -45,7 +45,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.');
 
@@ -73,7 +73,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/src/Tests/VocabularyUiTest.php b/core/modules/taxonomy/src/Tests/VocabularyUiTest.php
index 71389a1..b920d8e 100644
--- a/core/modules/taxonomy/src/Tests/VocabularyUiTest.php
+++ b/core/modules/taxonomy/src/Tests/VocabularyUiTest.php
@@ -31,9 +31,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.');
@@ -43,7 +43,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.');
@@ -61,7 +61,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'));
 
@@ -120,9 +120,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/telephone/src/Tests/TelephoneFieldTest.php b/core/modules/telephone/src/Tests/TelephoneFieldTest.php
index 22b7bec..002073e 100644
--- a/core/modules/telephone/src/Tests/TelephoneFieldTest.php
+++ b/core/modules/telephone/src/Tests/TelephoneFieldTest.php
@@ -81,7 +81,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",
     );
 
@@ -90,7 +90,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/src/Tests/TelephoneItemTest.php b/core/modules/telephone/src/Tests/TelephoneItemTest.php
index 733f1a3..13fc7c8 100644
--- a/core/modules/telephone/src/Tests/TelephoneItemTest.php
+++ b/core/modules/telephone/src/Tests/TelephoneItemTest.php
@@ -49,7 +49,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/src/Tests/Formatter/TextFormatterTest.php b/core/modules/text/src/Tests/Formatter/TextFormatterTest.php
index b9ba45a..4d99767 100644
--- a/core/modules/text/src/Tests/Formatter/TextFormatterTest.php
+++ b/core/modules/text/src/Tests/Formatter/TextFormatterTest.php
@@ -98,7 +98,7 @@ public function testFormatters() {
     );
 
     // Create the entity to be referenced.
-    $entity = entity_create($this->entityType, array('name' => $this->randomName()));
+    $entity = entity_create($this->entityType, array('name' => $this->randomMachineName()));
     $entity->processed_text = array(
       'value' => 'Hello, world!',
       'format' => 'my_text_format',
diff --git a/core/modules/text/src/Tests/Formatter/TextPlainUnitTest.php b/core/modules/text/src/Tests/Formatter/TextPlainUnitTest.php
index 327e318..167bcec 100644
--- a/core/modules/text/src/Tests/Formatter/TextPlainUnitTest.php
+++ b/core/modules/text/src/Tests/Formatter/TextPlainUnitTest.php
@@ -44,7 +44,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(
@@ -65,7 +65,7 @@ function setUp() {
     $this->instance = entity_create('field_instance_config', array(
       'field_storage' => $this->fieldStorage,
       'bundle' => $this->bundle,
-      'label' => $this->randomName(),
+      'label' => $this->randomMachineName(),
       'settings' => $this->instance_settings,
     ));
     $this->instance->save();
diff --git a/core/modules/text/src/Tests/TextFieldTest.php b/core/modules/text/src/Tests/TextFieldTest.php
index aee7022..efc29fa 100644
--- a/core/modules/text/src/Tests/TextFieldTest.php
+++ b/core/modules/text/src/Tests/TextFieldTest.php
@@ -43,7 +43,7 @@ function setUp() {
   function testTextFieldValidation() {
     // Create a field with settings to validate.
     $max_length = 3;
-    $field_name = drupal_strtolower($this->randomName());
+    $field_name = drupal_strtolower($this->randomMachineName());
     $field_storage = entity_create('field_storage_config', array(
       'name' => $field_name,
       'entity_type' => 'entity_test',
@@ -85,7 +85,7 @@ function testTextfieldWidgets() {
    */
   function _testTextfieldWidgets($field_type, $widget_type) {
     // Setup a field and instance
-    $field_name = drupal_strtolower($this->randomName());
+    $field_name = drupal_strtolower($this->randomMachineName());
     $field_storage = entity_create('field_storage_config', array(
       'name' => $field_name,
       'entity_type' => 'entity_test',
@@ -95,7 +95,7 @@ function _testTextfieldWidgets($field_type, $widget_type) {
     entity_create('field_instance_config', array(
       'field_storage' => $field_storage,
       'bundle' => 'entity_test',
-      'label' => $this->randomName() . '_label',
+      'label' => $this->randomMachineName() . '_label',
       'settings' => array(
         'text_processing' => TRUE,
       ),
@@ -119,10 +119,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(),
       "{$field_name}[0][value]" => $value,
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -151,7 +151,7 @@ function testTextfieldWidgetsFormatted() {
    */
   function _testTextfieldWidgetsFormatted($field_type, $widget_type) {
     // Setup a field and instance
-    $field_name = drupal_strtolower($this->randomName());
+    $field_name = drupal_strtolower($this->randomMachineName());
     $field_storage = entity_create('field_storage_config', array(
       'name' => $field_name,
       'entity_type' => 'entity_test',
@@ -161,7 +161,7 @@ function _testTextfieldWidgetsFormatted($field_type, $widget_type) {
     entity_create('field_instance_config', array(
       'field_storage' => $field_storage,
       'bundle' => 'entity_test',
-      'label' => $this->randomName() . '_label',
+      'label' => $this->randomMachineName() . '_label',
       'settings' => array(
         'text_processing' => TRUE,
       ),
@@ -191,10 +191,10 @@ function _testTextfieldWidgetsFormatted($field_type, $widget_type) {
     $this->assertNoFieldByName("{$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(),
       "{$field_name}[0][value]" => $value,
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
@@ -214,8 +214,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();
@@ -236,7 +236,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(),
       "{$field_name}[0][format]" => $format_id,
     );
     $this->drupalPostForm(NULL, $edit, t('Save'));
diff --git a/core/modules/text/src/Tests/TextWithSummaryItemTest.php b/core/modules/text/src/Tests/TextWithSummaryItemTest.php
index 67cbec5..d741246 100644
--- a/core/modules/text/src/Tests/TextWithSummaryItemTest.php
+++ b/core/modules/text/src/Tests/TextWithSummaryItemTest.php
@@ -62,10 +62,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());
diff --git a/core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php b/core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php
index a227a7f..9a7e84f 100644
--- a/core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php
+++ b/core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php
@@ -358,13 +358,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);
@@ -453,7 +453,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,
@@ -478,7 +478,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/src/Tests/ToolbarMenuTranslationTest.php b/core/modules/toolbar/src/Tests/ToolbarMenuTranslationTest.php
index 5e80dbf..f5579e0 100644
--- a/core/modules/toolbar/src/Tests/ToolbarMenuTranslationTest.php
+++ b/core/modules/toolbar/src/Tests/ToolbarMenuTranslationTest.php
@@ -62,7 +62,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/src/Tests/TrackerTest.php b/core/modules/tracker/src/Tests/TrackerTest.php
index 6a698ed..9f81ee5 100644
--- a/core/modules/tracker/src/Tests/TrackerTest.php
+++ b/core/modules/tracker/src/Tests/TrackerTest.php
@@ -56,11 +56,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,
     ));
 
@@ -82,28 +82,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[0][value]' => $this->randomName(),
-      'comment_body[0][value]' => $this->randomName(20),
+      'subject[0][value]' => $this->randomMachineName(),
+      'comment_body[0][value]' => $this->randomMachineName(20),
     );
     $this->drupalPostForm('comment/reply/node/' . $other_published_my_comment->id() . '/comment', $comment, t('Save'));
 
@@ -131,7 +131,7 @@ function testTrackerNewNodes() {
     $this->drupalLogin($this->user);
 
     $edit = array(
-      'title' => $this->randomName(8),
+      'title' => $this->randomMachineName(8),
     );
 
     $node = $this->drupalCreateNode($edit);
@@ -175,13 +175,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[0][value]' => $this->randomName(),
-      'comment_body[0][value]' => $this->randomName(20),
+      'subject[0][value]' => $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
@@ -201,8 +201,8 @@ function testTrackerNewComments() {
 
     // Add another comment as other_user.
     $comment = array(
-      'subject[0][value]' => $this->randomName(),
-      'comment_body[0][value]' => $this->randomName(20),
+      'subject[0][value]' => $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.
@@ -221,11 +221,11 @@ function testTrackerOrderingNewComments() {
     $this->drupalLogin($this->user);
 
     $node_one = $this->drupalCreateNode(array(
-      'title' => $this->randomName(8),
+      'title' => $this->randomMachineName(8),
     ));
 
     $node_two = $this->drupalCreateNode(array(
-      'title' => $this->randomName(8),
+      'title' => $this->randomMachineName(8),
     ));
 
     // Now get other_user to track these pieces of content.
@@ -233,8 +233,8 @@ function testTrackerOrderingNewComments() {
 
     // Add a comment to the first page.
     $comment = array(
-      'subject[0][value]' => $this->randomName(),
-      'comment_body[0][value]' => $this->randomName(20),
+      'subject[0][value]' => $this->randomMachineName(),
+      'comment_body[0][value]' => $this->randomMachineName(20),
     );
     $this->drupalPostForm('comment/reply/node/' . $node_one->id() . '/comment', $comment, t('Save'));
 
@@ -244,8 +244,8 @@ function testTrackerOrderingNewComments() {
 
     // Add a comment to the second page.
     $comment = array(
-      'subject[0][value]' => $this->randomName(),
-      'comment_body[0][value]' => $this->randomName(20),
+      'subject[0][value]' => $this->randomMachineName(),
+      'comment_body[0][value]' => $this->randomMachineName(20),
     );
     $this->drupalPostForm('comment/reply/node/' . $node_two->id() . '/comment', $comment, t('Save'));
 
@@ -264,8 +264,8 @@ function testTrackerOrderingNewComments() {
 
     // Add a comment to the second page.
     $comment = array(
-      'subject[0][value]' => $this->randomName(),
-      'comment_body[0][value]' => $this->randomName(20),
+      'subject[0][value]' => $this->randomMachineName(),
+      'comment_body[0][value]' => $this->randomMachineName(20),
     );
     $this->drupalPostForm('comment/reply/node/' . $node_one->id() . '/comment', $comment, t('Save'));
 
@@ -291,7 +291,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]);
     }
@@ -299,8 +299,8 @@ function testTrackerCronIndexing() {
     // Add a comment to the last node as other user.
     $this->drupalLogin($this->other_user);
     $comment = array(
-      'subject[0][value]' => $this->randomName(),
-      'comment_body[0][value]' => $this->randomName(20),
+      'subject[0][value]' => $this->randomMachineName(),
+      'comment_body[0][value]' => $this->randomMachineName(20),
     );
     $this->drupalPostForm('comment/reply/node/' . $nodes[3]->id() . '/comment', $comment, t('Save'));
 
@@ -345,7 +345,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/src/Tests/Views/TrackerTestBase.php b/core/modules/tracker/src/Tests/Views/TrackerTestBase.php
index 7f20868..4b69d9c 100644
--- a/core/modules/tracker/src/Tests/Views/TrackerTestBase.php
+++ b/core/modules/tracker/src/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[' . LanguageInterface::LANGCODE_NOT_SPECIFIED . '][0][value]' => $this->randomName(20),
+      'subject' => $this->randomMachineName(),
+      'comment_body[' . LanguageInterface::LANGCODE_NOT_SPECIFIED . '][0][value]' => $this->randomMachineName(20),
     ));
 
   }
diff --git a/core/modules/update/src/Tests/UpdateDeleteFileIfStaleTest.php b/core/modules/update/src/Tests/UpdateDeleteFileIfStaleTest.php
index e95e1d2..9f795c1 100644
--- a/core/modules/update/src/Tests/UpdateDeleteFileIfStaleTest.php
+++ b/core/modules/update/src/Tests/UpdateDeleteFileIfStaleTest.php
@@ -32,7 +32,7 @@ public function setUp() {
    * Tests the deletion of stale files.
    */
   function testUpdateDeleteFileIfStale() {
-    $file_name = file_unmanaged_save_data($this->randomName());
+    $file_name = file_unmanaged_save_data($this->randomMachineName());
     $this->assertNotNull($file_name);
 
     // During testing the file change and the stale checking occurs in the same
diff --git a/core/modules/user/src/Tests/Condition/UserRoleConditionTest.php b/core/modules/user/src/Tests/Condition/UserRoleConditionTest.php
index 781b521..e6dcc45 100644
--- a/core/modules/user/src/Tests/Condition/UserRoleConditionTest.php
+++ b/core/modules/user/src/Tests/Condition/UserRoleConditionTest.php
@@ -76,7 +76,7 @@ protected function setUp() {
     ))->save();
 
     // Create new role.
-    $rid = strtolower($this->randomName(8));
+    $rid = strtolower($this->randomMachineName(8));
     $label = $this->randomString(8);
     $role = Role::create(array(
       'id' => $rid,
@@ -95,7 +95,7 @@ protected function setUp() {
 
     // Setup an authenticated user for our tests.
     $this->authenticated = User::create(array(
-      'name' => $this->randomName(),
+      'name' => $this->randomMachineName(),
     ));
     $this->authenticated->save();
     // Add the custom role.
diff --git a/core/modules/user/src/Tests/TempStoreDatabaseTest.php b/core/modules/user/src/Tests/TempStoreDatabaseTest.php
index ee0fd78..f148696 100644
--- a/core/modules/user/src/Tests/TempStoreDatabaseTest.php
+++ b/core/modules/user/src/Tests/TempStoreDatabaseTest.php
@@ -78,7 +78,7 @@ protected function tearDown() {
   public function testUserTempStore() {
     // Create a key/value collection.
     $factory = new TempStoreFactory(new PhpSerialize(), Database::getConnection(), new DatabaseLockBackend(Database::getConnection()));
-    $collection = $this->randomName();
+    $collection = $this->randomMachineName();
 
     // Create two mock users.
     for ($i = 0; $i <= 1; $i++) {
@@ -91,7 +91,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/src/Tests/UserActionConfigSchemaTest.php b/core/modules/user/src/Tests/UserActionConfigSchemaTest.php
index 73d355b..bfc4ec8 100644
--- a/core/modules/user/src/Tests/UserActionConfigSchemaTest.php
+++ b/core/modules/user/src/Tests/UserActionConfigSchemaTest.php
@@ -39,7 +39,7 @@ class UserActionConfigSchemaTest extends KernelTestBase {
    * Tests whether the user action config schema are valid.
    */
   function testValidUserActionConfigSchema() {
-    $rid = strtolower($this->randomName(8));
+    $rid = strtolower($this->randomMachineName(8));
     Role::create(array('id' => $rid))->save();
 
     // Test user_add_role_action configuration.
diff --git a/core/modules/user/src/Tests/UserAdminLanguageTest.php b/core/modules/user/src/Tests/UserAdminLanguageTest.php
index be7a6cc..e661dcf 100644
--- a/core/modules/user/src/Tests/UserAdminLanguageTest.php
+++ b/core/modules/user/src/Tests/UserAdminLanguageTest.php
@@ -127,7 +127,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/src/Tests/UserAdminTest.php b/core/modules/user/src/Tests/UserAdminTest.php
index b6032f5..1f70264 100644
--- a/core/modules/user/src/Tests/UserAdminTest.php
+++ b/core/modules/user/src/Tests/UserAdminTest.php
@@ -29,7 +29,7 @@ class UserAdminTest extends WebTestBase {
   function testUserAdmin() {
     $user_a = $this->drupalCreateUser();
     $user_a->name = 'User A';
-    $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_b->name = 'User B';
@@ -149,15 +149,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/src/Tests/UserCancelTest.php b/core/modules/user/src/Tests/UserCancelTest.php
index 2b21c18..a84927b 100644
--- a/core/modules/user/src/Tests/UserCancelTest.php
+++ b/core/modules/user/src/Tests/UserCancelTest.php
@@ -199,8 +199,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,
@@ -314,8 +314,8 @@ function testUserDelete() {
 
     // Create comment.
     $edit = array();
-    $edit['subject[0][value]'] = $this->randomName(8);
-    $edit['comment_body[0][value]'] = $this->randomName(16);
+    $edit['subject[0][value]'] = $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/src/Tests/UserCreateFailMailTest.php b/core/modules/user/src/Tests/UserCreateFailMailTest.php
index c07b77e..677effe 100644
--- a/core/modules/user/src/Tests/UserCreateFailMailTest.php
+++ b/core/modules/user/src/Tests/UserCreateFailMailTest.php
@@ -33,10 +33,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/src/Tests/UserCreateTest.php b/core/modules/user/src/Tests/UserCreateTest.php
index d1bba88..48c0705 100644
--- a/core/modules/user/src/Tests/UserCreateTest.php
+++ b/core/modules/user/src/Tests/UserCreateTest.php
@@ -84,10 +84,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/src/Tests/UserEditTest.php b/core/modules/user/src/Tests/UserEditTest.php
index 68747a1..a468f4d 100644
--- a/core/modules/user/src/Tests/UserEditTest.php
+++ b/core/modules/user/src/Tests/UserEditTest.php
@@ -33,11 +33,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.');
@@ -45,7 +45,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('Email address'))));
 
@@ -55,7 +55,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/src/Tests/UserEditedOwnAccountTest.php b/core/modules/user/src/Tests/UserEditedOwnAccountTest.php
index 64ebf4e..6da8015 100644
--- a/core/modules/user/src/Tests/UserEditedOwnAccountTest.php
+++ b/core/modules/user/src/Tests/UserEditedOwnAccountTest.php
@@ -27,7 +27,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/src/Tests/UserEntityCallbacksTest.php b/core/modules/user/src/Tests/UserEntityCallbacksTest.php
index b2f21c0..c0ace48 100644
--- a/core/modules/user/src/Tests/UserEntityCallbacksTest.php
+++ b/core/modules/user/src/Tests/UserEntityCallbacksTest.php
@@ -43,7 +43,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/src/Tests/UserEntityReferenceTest.php b/core/modules/user/src/Tests/UserEntityReferenceTest.php
index 45d7a1a..81f7b09 100644
--- a/core/modules/user/src/Tests/UserEntityReferenceTest.php
+++ b/core/modules/user/src/Tests/UserEntityReferenceTest.php
@@ -40,14 +40,14 @@ function setUp() {
     parent::setUp();
 
     $this->role1 = entity_create('user_role', array(
-      'id' => strtolower($this->randomName(8)),
-      'label' => $this->randomName(8),
+      'id' => strtolower($this->randomMachineName(8)),
+      'label' => $this->randomMachineName(8),
     ));
     $this->role1->save();
 
     $this->role2 = entity_create('user_role', array(
-      'id' => strtolower($this->randomName(8)),
-      'label' => $this->randomName(8),
+      'id' => strtolower($this->randomMachineName(8)),
+      'label' => $this->randomMachineName(8),
     ));
     $this->role2->save();
 
diff --git a/core/modules/user/src/Tests/UserLanguageCreationTest.php b/core/modules/user/src/Tests/UserLanguageCreationTest.php
index e32718a..a7558d9 100644
--- a/core/modules/user/src/Tests/UserLanguageCreationTest.php
+++ b/core/modules/user/src/Tests/UserLanguageCreationTest.php
@@ -52,10 +52,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,
     );
@@ -72,10 +72,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'));
@@ -93,7 +93,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/src/Tests/UserLanguageTest.php b/core/modules/user/src/Tests/UserLanguageTest.php
index 5d32922..650d823 100644
--- a/core/modules/user/src/Tests/UserLanguageTest.php
+++ b/core/modules/user/src/Tests/UserLanguageTest.php
@@ -38,7 +38,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/src/Tests/UserPasswordResetTest.php b/core/modules/user/src/Tests/UserPasswordResetTest.php
index 1045e2c..bd919a8 100644
--- a/core/modules/user/src/Tests/UserPasswordResetTest.php
+++ b/core/modules/user/src/Tests/UserPasswordResetTest.php
@@ -50,7 +50,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('Email new password'));
 
     $this->assertText(t('Sorry, @name is not recognized as a username or an email address.', array('@name' => $edit['name'])), 'Validation error message shown when trying to request password for invalid account.');
@@ -134,8 +134,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/src/Tests/UserRegistrationTest.php b/core/modules/user/src/Tests/UserRegistrationTest.php
index 97aed33..cc025c8 100644
--- a/core/modules/user/src/Tests/UserRegistrationTest.php
+++ b/core/modules/user/src/Tests/UserRegistrationTest.php
@@ -37,7 +37,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 email address.'), 'User registered successfully.');
@@ -48,7 +48,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();
@@ -67,7 +67,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.
@@ -77,7 +77,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();
@@ -90,9 +90,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');
@@ -133,7 +133,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 email address.
@@ -167,9 +167,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'));
 
@@ -226,7 +226,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]'] = '';
@@ -266,7 +266,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/src/Tests/UserRolesAssignmentTest.php b/core/modules/user/src/Tests/UserRolesAssignmentTest.php
index 70ef6f6..07d99cd 100644
--- a/core/modules/user/src/Tests/UserRolesAssignmentTest.php
+++ b/core/modules/user/src/Tests/UserRolesAssignmentTest.php
@@ -52,8 +52,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/src/Tests/UserSaveTest.php b/core/modules/user/src/Tests/UserSaveTest.php
index 8fc891e..fdd468c 100644
--- a/core/modules/user/src/Tests/UserSaveTest.php
+++ b/core/modules/user/src/Tests/UserSaveTest.php
@@ -23,7 +23,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/src/Tests/UserSignatureTest.php b/core/modules/user/src/Tests/UserSignatureTest.php
index 244eff3..da6c519 100644
--- a/core/modules/user/src/Tests/UserSignatureTest.php
+++ b/core/modules/user/src/Tests/UserSignatureTest.php
@@ -79,7 +79,7 @@ function testUserSignature() {
     $node = $this->drupalCreateNode(array(
       'body' => array(
         0 => array(
-          'value' => $this->randomName(32),
+          'value' => $this->randomMachineName(32),
           'format' => 'full_html',
         ),
       ),
@@ -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,
     );
@@ -106,8 +106,8 @@ function testUserSignature() {
 
     // Create a comment.
     $edit = array();
-    $edit['subject[0][value]'] = $this->randomName(8);
-    $edit['comment_body[0][value]'] = $this->randomName(16);
+    $edit['subject[0][value]'] = $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/src/Tests/UserTranslationUITest.php b/core/modules/user/src/Tests/UserTranslationUITest.php
index c5b6a8f..4160e25 100644
--- a/core/modules/user/src/Tests/UserTranslationUITest.php
+++ b/core/modules/user/src/Tests/UserTranslationUITest.php
@@ -31,7 +31,7 @@ class UserTranslationUITest extends ContentTranslationUITest {
   function setUp() {
     $this->entityTypeId = 'user';
     $this->testLanguageSelector = FALSE;
-    $this->name = $this->randomName();
+    $this->name = $this->randomMachineName();
     parent::setUp();
 
     entity_get_controller('user')->resetCache();
diff --git a/core/modules/user/src/Tests/UserValidationTest.php b/core/modules/user/src/Tests/UserValidationTest.php
index 44cd775..6be3d5a 100644
--- a/core/modules/user/src/Tests/UserValidationTest.php
+++ b/core/modules/user/src/Tests/UserValidationTest.php
@@ -73,7 +73,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.');
@@ -93,7 +93,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();
@@ -101,7 +101,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/src/Tests/Views/ArgumentValidateTest.php b/core/modules/user/src/Tests/Views/ArgumentValidateTest.php
index 3bc83d9..d36b17d 100644
--- a/core/modules/user/src/Tests/Views/ArgumentValidateTest.php
+++ b/core/modules/user/src/Tests/Views/ArgumentValidateTest.php
@@ -58,7 +58,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/src/Tests/Views/HandlerFieldRoleTest.php b/core/modules/user/src/Tests/Views/HandlerFieldRoleTest.php
index 3c0a05f..5af5a3e 100644
--- a/core/modules/user/src/Tests/Views/HandlerFieldRoleTest.php
+++ b/core/modules/user/src/Tests/Views/HandlerFieldRoleTest.php
@@ -26,13 +26,13 @@ class HandlerFieldRoleTest extends UserTestBase {
 
   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/src/Tests/Views/HandlerFieldUserNameTest.php b/core/modules/user/src/Tests/Views/HandlerFieldUserNameTest.php
index f28b7d8..0091c9d 100644
--- a/core/modules/user/src/Tests/Views/HandlerFieldUserNameTest.php
+++ b/core/modules/user/src/Tests/Views/HandlerFieldUserNameTest.php
@@ -33,14 +33,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.');
@@ -52,7 +52,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/src/Tests/Views/HandlerFilterUserNameTest.php b/core/modules/user/src/Tests/Views/HandlerFilterUserNameTest.php
index e08f484..b582d34 100644
--- a/core/modules/user/src/Tests/Views/HandlerFilterUserNameTest.php
+++ b/core/modules/user/src/Tests/Views/HandlerFilterUserNameTest.php
@@ -96,7 +96,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)
@@ -106,7 +106,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(
@@ -137,7 +137,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);
@@ -145,7 +145,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/src/Tests/Views/UserDataTest.php b/core/modules/user/src/Tests/Views/UserDataTest.php
index 1e394e3..fe3f71a 100644
--- a/core/modules/user/src/Tests/Views/UserDataTest.php
+++ b/core/modules/user/src/Tests/Views/UserDataTest.php
@@ -37,7 +37,7 @@ class UserDataTest extends UserTestBase {
   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');
@@ -46,7 +46,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/src/Tests/DefaultViewsTest.php b/core/modules/views/src/Tests/DefaultViewsTest.php
index d33b863..c0feff5 100644
--- a/core/modules/views/src/Tests/DefaultViewsTest.php
+++ b/core/modules/views/src/Tests/DefaultViewsTest.php
@@ -45,9 +45,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' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
       'help' => '',
       'nodes' => array('page' => 'page'),
@@ -56,7 +56,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_storage_config', array(
       'name' => $this->field_name,
       'entity_type' => 'node',
@@ -153,8 +153,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/src/Tests/Entity/FieldEntityTest.php b/core/modules/views/src/Tests/Entity/FieldEntityTest.php
index 4ff36d8..d01ba1d 100644
--- a/core/modules/views/src/Tests/Entity/FieldEntityTest.php
+++ b/core/modules/views/src/Tests/Entity/FieldEntityTest.php
@@ -38,7 +38,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/src/Tests/Entity/FilterEntityBundleTest.php b/core/modules/views/src/Tests/Entity/FilterEntityBundleTest.php
index bdccc5d..ef04d33 100644
--- a/core/modules/views/src/Tests/Entity/FilterEntityBundleTest.php
+++ b/core/modules/views/src/Tests/Entity/FilterEntityBundleTest.php
@@ -57,7 +57,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/src/Tests/Entity/RowEntityRenderersTest.php b/core/modules/views/src/Tests/Entity/RowEntityRenderersTest.php
index 5d8a5f9..3c29b9e 100644
--- a/core/modules/views/src/Tests/Entity/RowEntityRenderersTest.php
+++ b/core/modules/views/src/Tests/Entity/RowEntityRenderersTest.php
@@ -85,7 +85,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/src/Tests/Entity/ViewEntityDependenciesTest.php b/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php
index 093cfb9..e111fe2 100644
--- a/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php
+++ b/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php
@@ -37,7 +37,7 @@ class ViewEntityDependenciesTest extends ViewTestBase {
   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/src/Tests/Handler/AreaEntityTest.php b/core/modules/views/src/Tests/Handler/AreaEntityTest.php
index ac62de1..29ba4de 100644
--- a/core/modules/views/src/Tests/Handler/AreaEntityTest.php
+++ b/core/modules/views/src/Tests/Handler/AreaEntityTest.php
@@ -74,7 +74,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/src/Tests/Handler/AreaTest.php b/core/modules/views/src/Tests/Handler/AreaTest.php
index be90e24..0df2ce0 100644
--- a/core/modules/views/src/Tests/Handler/AreaTest.php
+++ b/core/modules/views/src/Tests/Handler/AreaTest.php
@@ -69,7 +69,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/src/Tests/Handler/AreaTextTest.php b/core/modules/views/src/Tests/Handler/AreaTextTest.php
index a63b503..d0eaf14 100644
--- a/core/modules/views/src/Tests/Handler/AreaTextTest.php
+++ b/core/modules/views/src/Tests/Handler/AreaTextTest.php
@@ -39,7 +39,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/src/Tests/Handler/ArgumentStringTest.php b/core/modules/views/src/Tests/Handler/ArgumentStringTest.php
index 7d7cfa7..021fcf1 100644
--- a/core/modules/views/src/Tests/Handler/ArgumentStringTest.php
+++ b/core/modules/views/src/Tests/Handler/ArgumentStringTest.php
@@ -39,7 +39,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/src/Tests/Handler/FieldCustomTest.php b/core/modules/views/src/Tests/Handler/FieldCustomTest.php
index 08bc133..b6ffa2b 100644
--- a/core/modules/views/src/Tests/Handler/FieldCustomTest.php
+++ b/core/modules/views/src/Tests/Handler/FieldCustomTest.php
@@ -35,7 +35,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/src/Tests/Handler/FieldUnitTest.php b/core/modules/views/src/Tests/Handler/FieldUnitTest.php
index 85d9089..12fe74e 100644
--- a/core/modules/views/src/Tests/Handler/FieldUnitTest.php
+++ b/core/modules/views/src/Tests/Handler/FieldUnitTest.php
@@ -50,7 +50,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.');
   }
@@ -143,7 +143,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);
 
@@ -191,7 +191,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)));
@@ -242,8 +242,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;
@@ -461,7 +461,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.');
@@ -477,7 +477,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/src/Tests/Handler/FieldWebTest.php b/core/modules/views/src/Tests/Handler/FieldWebTest.php
index 603ace7..23e90b7 100644
--- a/core/modules/views/src/Tests/Handler/FieldWebTest.php
+++ b/core/modules/views/src/Tests/Handler/FieldWebTest.php
@@ -180,11 +180,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);
@@ -239,7 +239,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->randomName();
     $output = $id_field->theme($row);
     $this->assertSubString($output, str_replace(' ', '-', $path));
     $id_field->options['alter']['replace_spaces'] = FALSE;
@@ -261,7 +261,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);
@@ -286,7 +286,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);
@@ -294,21 +294,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);
@@ -340,7 +340,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) {
@@ -432,7 +432,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];
@@ -473,7 +473,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);
 
@@ -488,9 +488,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(
@@ -533,11 +533,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');
@@ -549,7 +549,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/src/Tests/Handler/HandlerTest.php b/core/modules/views/src/Tests/Handler/HandlerTest.php
index eedad87..334ed50 100644
--- a/core/modules/views/src/Tests/Handler/HandlerTest.php
+++ b/core/modules/views/src/Tests/Handler/HandlerTest.php
@@ -276,7 +276,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->randomName(), array(), 'broken_relationship');
     // Setup a valid relationship.
     $view->addHandler('default', 'relationship', 'comment_field_data', 'node', array('relationship' => 'cid'), 'valid_relationship');
     $view->initHandlers();
@@ -286,7 +286,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.');
 
@@ -328,8 +328,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/src/Tests/ModuleTest.php b/core/modules/views/src/Tests/ModuleTest.php
index e719a9c..1f52a19 100644
--- a/core/modules/views/src/Tests/ModuleTest.php
+++ b/core/modules/views/src/Tests/ModuleTest.php
@@ -50,8 +50,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/src/Tests/Plugin/ArgumentDefaultTest.php b/core/modules/views/src/Tests/Plugin/ArgumentDefaultTest.php
index 067325c..7499b31 100644
--- a/core/modules/views/src/Tests/Plugin/ArgumentDefaultTest.php
+++ b/core/modules/views/src/Tests/Plugin/ArgumentDefaultTest.php
@@ -105,7 +105,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');
@@ -116,7 +116,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/src/Tests/Plugin/BlockDependenciesTest.php b/core/modules/views/src/Tests/Plugin/BlockDependenciesTest.php
index ed394d0..d7d25c3 100644
--- a/core/modules/views/src/Tests/Plugin/BlockDependenciesTest.php
+++ b/core/modules/views/src/Tests/Plugin/BlockDependenciesTest.php
@@ -91,9 +91,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/src/Tests/Plugin/DisplayFeedTest.php b/core/modules/views/src/Tests/Plugin/DisplayFeedTest.php
index e012e41..7df3e31 100644
--- a/core/modules/views/src/Tests/Plugin/DisplayFeedTest.php
+++ b/core/modules/views/src/Tests/Plugin/DisplayFeedTest.php
@@ -45,7 +45,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/src/Tests/Plugin/ExposedFormTest.php b/core/modules/views/src/Tests/Plugin/ExposedFormTest.php
index f05abf3..2026571 100644
--- a/core/modules/views/src/Tests/Plugin/ExposedFormTest.php
+++ b/core/modules/views/src/Tests/Plugin/ExposedFormTest.php
@@ -57,7 +57,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();
 
@@ -105,7 +105,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/src/Tests/Plugin/JoinTest.php b/core/modules/views/src/Tests/Plugin/JoinTest.php
index 03d1439..05a2fad 100644
--- a/core/modules/views/src/Tests/Plugin/JoinTest.php
+++ b/core/modules/views/src/Tests/Plugin/JoinTest.php
@@ -130,8 +130,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/src/Tests/Plugin/RelationshipJoinTestBase.php b/core/modules/views/src/Tests/Plugin/RelationshipJoinTestBase.php
index 5542619..cdd1626 100644
--- a/core/modules/views/src/Tests/Plugin/RelationshipJoinTestBase.php
+++ b/core/modules/views/src/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/src/Tests/Plugin/RowEntityTest.php b/core/modules/views/src/Tests/Plugin/RowEntityTest.php
index e422d96..2d6e136 100644
--- a/core/modules/views/src/Tests/Plugin/RowEntityTest.php
+++ b/core/modules/views/src/Tests/Plugin/RowEntityTest.php
@@ -47,9 +47,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->randomName())));
     $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/src/Tests/Plugin/StyleOpmlTest.php b/core/modules/views/src/Tests/Plugin/StyleOpmlTest.php
index d4c8c1a..6580c0c 100644
--- a/core/modules/views/src/Tests/Plugin/StyleOpmlTest.php
+++ b/core/modules/views/src/Tests/Plugin/StyleOpmlTest.php
@@ -47,7 +47,7 @@ protected function setUp() {
   public function testOpmlOutput() {
     // Create a test feed.
     $values = array(
-      'title' => $this->randomName(10),
+      'title' => $this->randomMachineName(10),
       'url' => 'http://example.com/rss.xml',
       'refresh' => '900',
     );
diff --git a/core/modules/views/src/Tests/Plugin/StyleTableUnitTest.php b/core/modules/views/src/Tests/Plugin/StyleTableUnitTest.php
index 701aa80..3d132df 100644
--- a/core/modules/views/src/Tests/Plugin/StyleTableUnitTest.php
+++ b/core/modules/views/src/Tests/Plugin/StyleTableUnitTest.php
@@ -50,7 +50,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');
@@ -98,7 +98,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/src/Tests/Plugin/StyleTest.php b/core/modules/views/src/Tests/Plugin/StyleTest.php
index 223c23e..074abb7 100644
--- a/core/modules/views/src/Tests/Plugin/StyleTest.php
+++ b/core/modules/views/src/Tests/Plugin/StyleTest.php
@@ -61,7 +61,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();
@@ -80,7 +80,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);
@@ -171,14 +171,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';
@@ -222,7 +222,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/src/Tests/ViewExecutableTest.php b/core/modules/views/src/Tests/ViewExecutableTest.php
index e84232d..11a1b7f 100644
--- a/core/modules/views/src/Tests/ViewExecutableTest.php
+++ b/core/modules/views/src/Tests/ViewExecutableTest.php
@@ -313,12 +313,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/src/Tests/ViewStorageTest.php b/core/modules/views/src/Tests/ViewStorageTest.php
index 283c3b1..08c9e27 100644
--- a/core/modules/views/src/Tests/ViewStorageTest.php
+++ b/core/modules/views/src/Tests/ViewStorageTest.php
@@ -216,14 +216,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')));
@@ -238,7 +238,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');
@@ -275,7 +275,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);
@@ -296,7 +296,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/src/Tests/ViewsTaxonomyAutocompleteTest.php b/core/modules/views/src/Tests/ViewsTaxonomyAutocompleteTest.php
index 4e0cffb..4bec18c 100644
--- a/core/modules/views/src/Tests/ViewsTaxonomyAutocompleteTest.php
+++ b/core/modules/views/src/Tests/ViewsTaxonomyAutocompleteTest.php
@@ -95,8 +95,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' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
     ));
diff --git a/core/modules/views/src/Tests/Wizard/BasicTest.php b/core/modules/views/src/Tests/Wizard/BasicTest.php
index ba8507f..6c5fe34 100644
--- a/core/modules/views/src/Tests/Wizard/BasicTest.php
+++ b/core/modules/views/src/Tests/Wizard/BasicTest.php
@@ -27,9 +27,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);
@@ -50,14 +50,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);
@@ -92,16 +92,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);
@@ -158,12 +158,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/src/Tests/Wizard/ItemsPerPageTest.php b/core/modules/views/src/Tests/Wizard/ItemsPerPageTest.php
index 0a8fc28..edb2e79 100644
--- a/core/modules/views/src/Tests/Wizard/ItemsPerPageTest.php
+++ b/core/modules/views/src/Tests/Wizard/ItemsPerPageTest.php
@@ -35,18 +35,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/src/Tests/Wizard/MenuTest.php b/core/modules/views/src/Tests/Wizard/MenuTest.php
index 3e9b8be..198e774 100644
--- a/core/modules/views/src/Tests/Wizard/MenuTest.php
+++ b/core/modules/views/src/Tests/Wizard/MenuTest.php
@@ -20,15 +20,15 @@ class MenuTest extends WizardTestBase {
   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/src/Tests/Wizard/SortingTest.php b/core/modules/views/src/Tests/Wizard/SortingTest.php
index f05ae42..b5d236a 100644
--- a/core/modules/views/src/Tests/Wizard/SortingTest.php
+++ b/core/modules/views/src/Tests/Wizard/SortingTest.php
@@ -26,13 +26,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);
@@ -51,13 +51,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/src/Tests/Wizard/TaggedWithTest.php b/core/modules/views/src/Tests/Wizard/TaggedWithTest.php
index 5e095e3..0c7252d 100644
--- a/core/modules/views/src/Tests/Wizard/TaggedWithTest.php
+++ b/core/modules/views/src/Tests/Wizard/TaggedWithTest.php
@@ -104,15 +104,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
@@ -123,13 +123,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.
@@ -145,13 +145,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/src/Tests/Wizard/WizardPluginBaseUnitTest.php b/core/modules/views/src/Tests/Wizard/WizardPluginBaseUnitTest.php
index 37880d4..4123f1a 100644
--- a/core/modules/views/src/Tests/Wizard/WizardPluginBaseUnitTest.php
+++ b/core/modules/views/src/Tests/Wizard/WizardPluginBaseUnitTest.php
@@ -52,9 +52,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/src/Controller/ViewAjaxControllerTest.php b/core/modules/views/tests/src/Controller/ViewAjaxControllerTest.php
index 8b685af..b977412 100644
--- a/core/modules/views/tests/src/Controller/ViewAjaxControllerTest.php
+++ b/core/modules/views/tests/src/Controller/ViewAjaxControllerTest.php
@@ -173,7 +173,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/src/Plugin/Block/ViewsBlockTest.php b/core/modules/views/tests/src/Plugin/Block/ViewsBlockTest.php
index b3cb73b..8df1dfe 100644
--- a/core/modules/views/tests/src/Plugin/Block/ViewsBlockTest.php
+++ b/core/modules/views/tests/src/Plugin/Block/ViewsBlockTest.php
@@ -114,7 +114,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/src/Routing/ViewPageControllerTest.php b/core/modules/views/tests/src/Routing/ViewPageControllerTest.php
index 2811735..711c957 100644
--- a/core/modules/views/tests/src/Routing/ViewPageControllerTest.php
+++ b/core/modules/views/tests/src/Routing/ViewPageControllerTest.php
@@ -246,7 +246,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/src/ViewsDataTest.php b/core/modules/views/tests/src/ViewsDataTest.php
index 826faa7..d06cd06 100644
--- a/core/modules/views/tests/src/ViewsDataTest.php
+++ b/core/modules/views/tests/src/ViewsDataTest.php
@@ -179,7 +179,7 @@ public function testFullAndTableGetCache() {
     $expected_views_data = $this->viewsData();
     $table_name = 'views_test_data';
     $table_name_2 = 'views_test_data_2';
-    $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))
@@ -318,7 +318,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.
@@ -457,7 +457,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');
 
@@ -493,7 +493,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/src/Tests/DefaultViewsTest.php b/core/modules/views_ui/src/Tests/DefaultViewsTest.php
index 4692e66..67a57b9 100644
--- a/core/modules/views_ui/src/Tests/DefaultViewsTest.php
+++ b/core/modules/views_ui/src/Tests/DefaultViewsTest.php
@@ -48,7 +48,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'));
@@ -87,7 +87,7 @@ function testDefaultViews() {
     // Duplicate a view and set a custom name.
     $this->drupalGet('admin/structure/views');
     $this->clickViewsOperationLink(t('Duplicate'), '/glossary');
-    $random_name = strtolower($this->randomName());
+    $random_name = strtolower($this->randomMachineName());
     $this->drupalPostForm(NULL, array('id' => $random_name), t('Duplicate'));
     $this->assertUrl("admin/structure/views/view/$random_name", array(), 'The custom view name got saved.');
 
diff --git a/core/modules/views_ui/src/Tests/DisplayCRUDTest.php b/core/modules/views_ui/src/Tests/DisplayCRUDTest.php
index ab91fc4..fecf451 100644
--- a/core/modules/views_ui/src/Tests/DisplayCRUDTest.php
+++ b/core/modules/views_ui/src/Tests/DisplayCRUDTest.php
@@ -115,8 +115,8 @@ public function testDuplicateDisplay() {
     $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/src/Tests/DisplayExtenderUITest.php b/core/modules/views_ui/src/Tests/DisplayExtenderUITest.php
index 12c8ee0..8978539 100644
--- a/core/modules/views_ui/src/Tests/DisplayExtenderUITest.php
+++ b/core/modules/views_ui/src/Tests/DisplayExtenderUITest.php
@@ -36,7 +36,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/src/Tests/DisplayPathTest.php b/core/modules/views_ui/src/Tests/DisplayPathTest.php
index 5f8fb48..38f662e 100644
--- a/core/modules/views_ui/src/Tests/DisplayPathTest.php
+++ b/core/modules/views_ui/src/Tests/DisplayPathTest.php
@@ -39,7 +39,7 @@ protected function doBasicPathUITest() {
     $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/src/Tests/ExposedFormUITest.php b/core/modules/views_ui/src/Tests/ExposedFormUITest.php
index 8668b53..b867a26 100644
--- a/core/modules/views_ui/src/Tests/ExposedFormUITest.php
+++ b/core/modules/views_ui/src/Tests/ExposedFormUITest.php
@@ -112,7 +112,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/src/Tests/HandlerTest.php b/core/modules/views_ui/src/Tests/HandlerTest.php
index d4a7458..b16f908 100644
--- a/core/modules/views_ui/src/Tests/HandlerTest.php
+++ b/core/modules/views_ui/src/Tests/HandlerTest.php
@@ -91,7 +91,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/src/Tests/OverrideDisplaysTest.php b/core/modules/views_ui/src/Tests/OverrideDisplaysTest.php
index c758ecb..3b2ecf7 100644
--- a/core/modules/views_ui/src/Tests/OverrideDisplaysTest.php
+++ b/core/modules/views_ui/src/Tests/OverrideDisplaysTest.php
@@ -20,10 +20,10 @@ class OverrideDisplaysTest extends UITestBase {
   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'));
@@ -33,7 +33,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'));
@@ -61,7 +61,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'));
@@ -79,15 +79,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
@@ -128,7 +128,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]']);
@@ -149,7 +149,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]']);
@@ -171,19 +171,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/src/Tests/PreviewTest.php b/core/modules/views_ui/src/Tests/PreviewTest.php
index c251149..f133354 100644
--- a/core/modules/views_ui/src/Tests/PreviewTest.php
+++ b/core/modules/views_ui/src/Tests/PreviewTest.php
@@ -78,13 +78,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/src/Tests/QueryTest.php b/core/modules/views_ui/src/Tests/QueryTest.php
index c9eca9b..db8bed2 100644
--- a/core/modules/views_ui/src/Tests/QueryTest.php
+++ b/core/modules/views_ui/src/Tests/QueryTest.php
@@ -41,7 +41,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/src/Tests/RedirectTest.php b/core/modules/views_ui/src/Tests/RedirectTest.php
index f8e0e2a..30d387c 100644
--- a/core/modules/views_ui/src/Tests/RedirectTest.php
+++ b/core/modules/views_ui/src/Tests/RedirectTest.php
@@ -27,7 +27,7 @@ class RedirectTest extends UITestBase {
   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)));
@@ -37,7 +37,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/src/Tests/RowUITest.php b/core/modules/views_ui/src/Tests/RowUITest.php
index ab32782..08326a5 100644
--- a/core/modules/views_ui/src/Tests/RowUITest.php
+++ b/core/modules/views_ui/src/Tests/RowUITest.php
@@ -42,7 +42,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/src/Tests/SettingsTest.php b/core/modules/views_ui/src/Tests/SettingsTest.php
index cfb918b..3660967 100644
--- a/core/modules/views_ui/src/Tests/SettingsTest.php
+++ b/core/modules/views_ui/src/Tests/SettingsTest.php
@@ -42,12 +42,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.
@@ -63,7 +63,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'));
@@ -77,7 +77,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');
 
@@ -95,7 +95,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'));
@@ -107,7 +107,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/src/Tests/StorageTest.php b/core/modules/views_ui/src/Tests/StorageTest.php
index 06db9fe..9204799 100644
--- a/core/modules/views_ui/src/Tests/StorageTest.php
+++ b/core/modules/views_ui/src/Tests/StorageTest.php
@@ -43,9 +43,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/src/Tests/StyleUITest.php b/core/modules/views_ui/src/Tests/StyleUITest.php
index f129c6e..d38431c 100644
--- a/core/modules/views_ui/src/Tests/StyleUITest.php
+++ b/core/modules/views_ui/src/Tests/StyleUITest.php
@@ -42,7 +42,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/src/Tests/TagTest.php b/core/modules/views_ui/src/Tests/TagTest.php
index 65ce66c..673b91f 100644
--- a/core/modules/views_ui/src/Tests/TagTest.php
+++ b/core/modules/views_ui/src/Tests/TagTest.php
@@ -34,9 +34,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.
@@ -57,7 +57,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/src/Tests/UITestBase.php b/core/modules/views_ui/src/Tests/UITestBase.php
index 53fcc05..5d32952 100644
--- a/core/modules/views_ui/src/Tests/UITestBase.php
+++ b/core/modules/views_ui/src/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/src/Tests/ViewsUITourTest.php b/core/modules/views_ui/src/Tests/ViewsUITourTest.php
index 1b82060..86533b3 100644
--- a/core/modules/views_ui/src/Tests/ViewsUITourTest.php
+++ b/core/modules/views_ui/src/Tests/ViewsUITourTest.php
@@ -42,10 +42,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/views_ui/src/Tests/WizardTest.php b/core/modules/views_ui/src/Tests/WizardTest.php
index 515b57a..155dc16 100644
--- a/core/modules/views_ui/src/Tests/WizardTest.php
+++ b/core/modules/views_ui/src/Tests/WizardTest.php
@@ -24,15 +24,15 @@ class WizardTest extends WizardTestBase {
    */
   public function testWizardFieldLength() {
     $view = array();
-    $view['label'] = $this->randomName(256);
-    $view['id'] = strtolower($this->randomName(129));
+    $view['label'] = $this->randomMachineName(256);
+    $view['id'] = strtolower($this->randomMachineName(129));
     $view['page[create]'] = TRUE;
-    $view['page[path]'] = $this->randomName(255);
-    $view['page[title]'] = $this->randomName(256);
+    $view['page[path]'] = $this->randomMachineName(255);
+    $view['page[title]'] = $this->randomMachineName(256);
     $view['page[feed]'] = TRUE;
-    $view['page[feed_properties][path]'] = $this->randomName(255);
+    $view['page[feed_properties][path]'] = $this->randomMachineName(255);
     $view['block[create]'] = TRUE;
-    $view['block[title]'] = $this->randomName(256);
+    $view['block[title]'] = $this->randomMachineName(256);
 
     $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
 
@@ -43,15 +43,15 @@ public function testWizardFieldLength() {
     $this->assertText('Feed path cannot be longer than 254 characters but is currently 255 characters long.');
     $this->assertText('Block title cannot be longer than 255 characters but is currently 256 characters long.');
 
-    $view['label'] = $this->randomName(255);
-    $view['id'] = strtolower($this->randomName(128));
+    $view['label'] = $this->randomMachineName(255);
+    $view['id'] = strtolower($this->randomMachineName(128));
     $view['page[create]'] = TRUE;
-    $view['page[path]'] = $this->randomName(254);
-    $view['page[title]'] = $this->randomName(255);
+    $view['page[path]'] = $this->randomMachineName(254);
+    $view['page[title]'] = $this->randomMachineName(255);
     $view['page[feed]'] = TRUE;
-    $view['page[feed_properties][path]'] = $this->randomName(254);
+    $view['page[feed_properties][path]'] = $this->randomMachineName(254);
     $view['block[create]'] = TRUE;
-    $view['block[title]'] = $this->randomName(255);
+    $view['block[title]'] = $this->randomMachineName(255);
 
     $this->drupalPostForm('admin/structure/views/add', $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/xmlrpc/src/Tests/XmlRpcValidatorTest.php b/core/modules/xmlrpc/src/Tests/XmlRpcValidatorTest.php
index 1af8c06..5c2e35b 100644
--- a/core/modules/xmlrpc/src/Tests/XmlRpcValidatorTest.php
+++ b/core/modules/xmlrpc/src/Tests/XmlRpcValidatorTest.php
@@ -64,10 +64,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;
@@ -78,7 +78,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/FileStorageReadOnlyTest.php b/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageReadOnlyTest.php
index e0497b8..500f6bb 100644
--- a/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageReadOnlyTest.php
+++ b/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageReadOnlyTest.php
@@ -57,7 +57,7 @@ public function setUp() {
    */
   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 {
diff --git a/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php b/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php
index 80dac1b..c4efc8b 100644
--- a/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php
+++ b/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php
@@ -71,7 +71,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 cb8330f..ce22ed6 100644
--- a/core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php
@@ -51,7 +51,7 @@ function setUp() {
       ->will($this->returnValue($this->key));
 
     $settings = array(
-      'hash_salt' => $this->randomName(),
+      'hash_salt' => $this->randomMachineName(),
     );
 
     new Settings($settings);
@@ -64,8 +64,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 5255791..90258c6 100644
--- a/core/tests/Drupal/Tests/Core/Annotation/TranslationTest.php
+++ b/core/tests/Drupal/Tests/Core/Annotation/TranslationTest.php
@@ -64,7 +64,7 @@ public function providerTestGet() {
       ),
       'Foo'
     );
-    $random = $this->randomName();
+    $random = $this->randomMachineName();
     $random_html_entity = '&' . $random;
     $data[] = array(
       array(
@@ -74,7 +74,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 f584719..cc8012d 100644
--- a/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php
+++ b/core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php
@@ -50,7 +50,7 @@ class CacheCollectorTest extends UnitTestCase {
   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);
@@ -61,8 +61,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));
@@ -72,8 +72,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));
 
@@ -87,7 +87,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())
@@ -99,7 +99,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));
   }
@@ -108,8 +108,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),
@@ -128,8 +128,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));
 
@@ -162,8 +162,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);
@@ -194,8 +194,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);
@@ -216,8 +216,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),
@@ -263,8 +263,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);
@@ -299,8 +299,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),
@@ -340,8 +340,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);
@@ -361,8 +361,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);
@@ -387,9 +387,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 e9d448e..30bde29 100644
--- a/core/tests/Drupal/Tests/Core/Cache/NullBackendTest.php
+++ b/core/tests/Drupal/Tests/Core/Cache/NullBackendTest.php
@@ -23,8 +23,8 @@ class NullBackendTest extends UnitTestCase {
   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->assertFalse($null_cache->get($key));
diff --git a/core/tests/Drupal/Tests/Core/Config/CachedStorageTest.php b/core/tests/Drupal/Tests/Core/Config/CachedStorageTest.php
index 619d57d..54c6c9e 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)
@@ -54,7 +54,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);
     $this->cacheFactory->expects($this->once())
diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php
index aae74eb..648aa8e 100644
--- a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php
@@ -94,14 +94,14 @@ class ConfigEntityBaseUnitTest extends UnitTestCase {
    * {@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')
@@ -217,7 +217,7 @@ public function testCalculateDependenciesWithPluginBags($definition, $expected_d
       ->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.
@@ -246,8 +246,8 @@ public function testCalculateDependenciesWithPluginBags($definition, $expected_d
    */
   public function providerCalculateDependenciesWithPluginBags() {
     // 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.
@@ -284,7 +284,7 @@ public function providerCalculateDependenciesWithPluginBags() {
    * @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));
@@ -308,7 +308,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 207315c..3ad97d3 100644
--- a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php
+++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php
@@ -46,8 +46,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(
@@ -67,8 +67,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 63c5ae0..411117b 100644
--- a/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php
@@ -55,7 +55,7 @@ class EntityDisplayModeBaseUnitTest extends UnitTestCase {
    * {@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())
@@ -77,7 +77,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/Display/DisplayVariantTest.php b/core/tests/Drupal/Tests/Core/Display/DisplayVariantTest.php
index add47b1..27f9fe1 100644
--- a/core/tests/Drupal/Tests/Core/Display/DisplayVariantTest.php
+++ b/core/tests/Drupal/Tests/Core/Display/DisplayVariantTest.php
@@ -141,7 +141,7 @@ public function testSubmitConfigurationForm() {
     $this->assertSame('', $display_variant->label());
 
     $form = array();
-    $label = $this->randomName();
+    $label = $this->randomMachineName();
     $form_state['values']['label'] = $label;
     $display_variant->submitConfigurationForm($form, $form_state);
     $this->assertSame($label, $display_variant->label());
diff --git a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
index 9bc1b85..742426b 100644
--- a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
@@ -106,8 +106,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');
     $this->entityType->expects($this->any())
@@ -272,7 +272,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'))
@@ -351,7 +351,7 @@ public function testGetParent() {
    * @covers ::setContext
    */
   public function testSetContext() {
-    $name = $this->randomName();
+    $name = $this->randomMachineName();
     $parent = $this->getMock('\Drupal\Core\TypedData\TypedDataInterface');
     // Our mocked entity->setContext() returns NULL, so assert that.
     $this->assertNull($this->entity->setContext($name, $parent));
@@ -369,7 +369,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)
@@ -391,7 +391,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 a7e0792..8c37338 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityListBuilderTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityListBuilderTest.php
@@ -88,10 +88,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 0a7acf4..d16dab7 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php
@@ -985,8 +985,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 046744d..0709a14 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php
@@ -196,7 +196,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));
@@ -206,7 +206,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 8b63f61..0e6a67f 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php
@@ -92,7 +92,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');
 
@@ -170,8 +170,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__)
@@ -208,7 +208,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)
@@ -314,7 +314,7 @@ public function testLoadWithAmbiguousSubclasses() {
     $second_entity_type = $this->getMockBuilder('\Drupal\Core\Entity\EntityType')
       ->disableOriginalConstructor()
       ->setMethods($methods)
-      ->setMockClassName($this->randomName())
+      ->setMockClassName($this->randomMachineName())
       ->getMock();
     $second_entity_type->setClass('Drupal\entity_test\Entity\EntityTestMulRev');
 
@@ -354,7 +354,7 @@ public function testLoadWithAmbiguousClasses() {
     $second_entity_type = $this->getMockBuilder('\Drupal\Core\Entity\EntityType')
       ->disableOriginalConstructor()
       ->setMethods($methods)
-      ->setMockClassName($this->randomName())
+      ->setMockClassName($this->randomMachineName())
       ->getMock();
     $second_entity_type->setClass('Drupal\entity_test\Entity\EntityTest');
 
@@ -505,7 +505,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 5368574..e206077 100644
--- a/core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php
@@ -41,7 +41,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(
@@ -78,7 +78,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());
   }
@@ -88,7 +88,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());
   }
@@ -98,7 +98,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());
   }
@@ -116,8 +116,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'];
@@ -141,7 +141,7 @@ public function testDefaultFieldSettings() {
    */
   public function testFieldDefaultValue() {
     $definition = FieldDefinition::create($this->fieldType);
-    $value = $this->randomName();
+    $value = $this->randomMachineName();
     $definition->setDefaultValue($value);
     $entity = $this->getMockBuilder('Drupal\Core\Entity\ContentEntityBase')
       ->disableOriginalConstructor()
@@ -205,7 +205,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/FormValidatorTest.php b/core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php
index 0870788..3d73a2d 100644
--- a/core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php
@@ -576,7 +576,7 @@ public function providerTestPerformRequiredValidation() {
         array(
           '#type' => 'textfield',
           '#maxlength' => 7,
-          '#value' => $this->randomName(8),
+          '#value' => $this->randomMachineName(8),
         ),
         String::format('!name cannot be longer than %max characters but is currently %length characters long.', array('!name' => 'Test', '%max' => '7', '%length' => 8)),
         FALSE,
diff --git a/core/tests/Drupal/Tests/Core/Language/LanguageUnitTest.php b/core/tests/Drupal/Tests/Core/Language/LanguageUnitTest.php
index 7abed94..5b55b72 100644
--- a/core/tests/Drupal/Tests/Core/Language/LanguageUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Language/LanguageUnitTest.php
@@ -38,7 +38,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());
   }
@@ -50,7 +50,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());
   }
@@ -86,7 +86,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/Logger/LoggerChannelTest.php b/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php
index 99c8689..269674b 100644
--- a/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php
+++ b/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php
@@ -55,7 +55,7 @@ class LoggerChannelTest extends UnitTestCase {
    */
   public function testLog(callable $expected, Request $request = NULL, AccountInterface $current_user = NULL) {
     $channel = new LoggerChannel('test');
-    $message = $this->randomName();
+    $message = $this->randomMachineName();
     $logger = $this->getMock('Psr\Log\LoggerInterface');
     $logger->expects($this->once())
       ->method('log')
@@ -79,7 +79,7 @@ public function testLog(callable $expected, Request $request = NULL, AccountInte
    * @covers ::sortLoggers
    */
   public function testSortLoggers() {
-    $channel = new LoggerChannel($this->randomName());
+    $channel = new LoggerChannel($this->randomMachineName());
     $index_order = '';
     for ($i = 0; $i < 4; $i++) {
       $logger = $this->getMock('Psr\Log\LoggerInterface');
@@ -93,7 +93,7 @@ public function testSortLoggers() {
       $channel->addLogger($logger, $i);
     }
 
-    $channel->log(rand(0, 7), $this->randomName());
+    $channel->log(rand(0, 7), $this->randomMachineName());
     // Ensure that the logger added in the end fired first.
     $this->assertEquals($index_order, '3210');
   }
diff --git a/core/tests/Drupal/Tests/Core/Menu/MenuActiveTrailTest.php b/core/tests/Drupal/Tests/Core/Menu/MenuActiveTrailTest.php
index aa802fb..02d0479 100644
--- a/core/tests/Drupal/Tests/Core/Menu/MenuActiveTrailTest.php
+++ b/core/tests/Drupal/Tests/Core/Menu/MenuActiveTrailTest.php
@@ -98,24 +98,24 @@ public function provider() {
     $empty_active_trail_cache_key = 'menu_trail.';
 
     // No active link is returned when zero links match the current route.
-    $data[] = array($request, array(), $this->randomName(), NULL, $empty_active_trail, $empty_active_trail_cache_key);
+    $data[] = array($request, array(), $this->randomMachineName(), NULL, $empty_active_trail, $empty_active_trail_cache_key);
 
     // The first (and only) matching link is returned when one link matches the
     // current route.
-    $data[] = array($request, array('baby_llama_link_1' => $link_1), $this->randomName(), $link_1, $link_1_parent_ids, $link_1__active_trail_cache_key);
+    $data[] = array($request, array('baby_llama_link_1' => $link_1), $this->randomMachineName(), $link_1, $link_1_parent_ids, $link_1__active_trail_cache_key);
 
     // The first of multiple matching links is returned when multiple links
     // match the current route, where "first" is determined by sorting by key.
-    $data[] = array($request, array('baby_llama_link_1' => $link_1, 'baby_llama_link_2' => $link_2), $this->randomName(), $link_1, $link_1_parent_ids, $link_1__active_trail_cache_key);
+    $data[] = array($request, array('baby_llama_link_1' => $link_1, 'baby_llama_link_2' => $link_2), $this->randomMachineName(), $link_1, $link_1_parent_ids, $link_1__active_trail_cache_key);
 
     // No active link is returned in case of a 403.
     $request = new Request();
     $request->attributes->set('_exception_statuscode', 403);
-    $data[] = array($request, FALSE, $this->randomName(), NULL, $empty_active_trail, $empty_active_trail_cache_key);
+    $data[] = array($request, FALSE, $this->randomMachineName(), NULL, $empty_active_trail, $empty_active_trail_cache_key);
 
     // No active link is returned when the route name is missing.
     $request = new Request();
-    $data[] = array($request, FALSE, $this->randomName(), NULL, $empty_active_trail, $empty_active_trail_cache_key);
+    $data[] = array($request, FALSE, $this->randomMachineName(), NULL, $empty_active_trail, $empty_active_trail_cache_key);
 
     return $data;
   }
diff --git a/core/tests/Drupal/Tests/Core/Path/AliasManagerTest.php b/core/tests/Drupal/Tests/Core/Path/AliasManagerTest.php
index eeaa60b..86108a5 100644
--- a/core/tests/Drupal/Tests/Core/Path/AliasManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Path/AliasManagerTest.php
@@ -92,7 +92,7 @@ protected function setUp() {
    * @covers ::getPathByAlias()
    */
   public function testGetPathByAliasNoMatch() {
-    $alias = $this->randomName();
+    $alias = $this->randomMachineName();
 
     $language = new Language(array('id' => 'en'));
 
@@ -117,8 +117,8 @@ public function testGetPathByAliasNoMatch() {
    * @covers ::getPathByAlias()
    */
   public function testGetPathByAliasNatch() {
-    $alias = $this->randomName();
-    $path = $this->randomName();
+    $alias = $this->randomMachineName();
+    $path = $this->randomMachineName();
 
     $language = $this->setUpCurrentLanguage();
 
@@ -138,8 +138,8 @@ public function testGetPathByAliasNatch() {
    * @covers ::getPathByAlias()
    */
   public function testGetPathByAliasLangcode() {
-    $alias = $this->randomName();
-    $path = $this->randomName();
+    $alias = $this->randomMachineName();
+    $path = $this->randomMachineName();
 
     $this->languageManager->expects($this->never())
       ->method('getCurrentLanguage');
@@ -161,8 +161,8 @@ public function testGetPathByAliasLangcode() {
    * @covers ::getAliasByPath()
    */
   public function testGetAliasByPathWhitelist() {
-    $path_part1 = $this->randomName();
-    $path_part2 = $this->randomName();
+    $path_part1 = $this->randomMachineName();
+    $path_part2 = $this->randomMachineName();
     $path = $path_part1 . '/' . $path_part2;
 
     $this->setUpCurrentLanguage();
@@ -186,8 +186,8 @@ public function testGetAliasByPathWhitelist() {
    * @covers ::getAliasByPath()
    */
   public function testGetAliasByPathNoMatch() {
-    $path_part1 = $this->randomName();
-    $path_part2 = $this->randomName();
+    $path_part1 = $this->randomMachineName();
+    $path_part2 = $this->randomMachineName();
     $path = $path_part1 . '/' . $path_part2;
 
     $language = $this->setUpCurrentLanguage();
@@ -223,10 +223,10 @@ public function testGetAliasByPathNoMatch() {
    * @covers ::writeCache()
    */
   public function testGetAliasByPathMatch() {
-    $path_part1 = $this->randomName();
-    $path_part2 = $this->randomName();
+    $path_part1 = $this->randomMachineName();
+    $path_part2 = $this->randomMachineName();
     $path = $path_part1 . '/' . $path_part2;
-    $alias = $this->randomName();
+    $alias = $this->randomMachineName();
 
     $language = $this->setUpCurrentLanguage();
 
@@ -261,10 +261,10 @@ public function testGetAliasByPathMatch() {
    * @covers ::writeCache()
    */
   public function testGetAliasByPathCachedMatch() {
-    $path_part1 = $this->randomName();
-    $path_part2 = $this->randomName();
+    $path_part1 = $this->randomMachineName();
+    $path_part2 = $this->randomMachineName();
     $path = $path_part1 . '/' . $path_part2;
-    $alias = $this->randomName();
+    $alias = $this->randomMachineName();
 
     $language = $this->setUpCurrentLanguage();
 
@@ -308,10 +308,10 @@ public function testGetAliasByPathCachedMatch() {
    * @covers ::writeCache()
    */
   public function testGetAliasByPathCachedMissLanguage() {
-    $path_part1 = $this->randomName();
-    $path_part2 = $this->randomName();
+    $path_part1 = $this->randomMachineName();
+    $path_part2 = $this->randomMachineName();
     $path = $path_part1 . '/' . $path_part2;
-    $alias = $this->randomName();
+    $alias = $this->randomMachineName();
 
     $language = $this->setUpCurrentLanguage();
     $cached_language = new Language(array('id' => 'de'));
@@ -361,11 +361,11 @@ public function testGetAliasByPathCachedMissLanguage() {
    * @covers ::writeCache()
    */
   public function testGetAliasByPathCachedMissNoAlias() {
-    $path_part1 = $this->randomName();
-    $path_part2 = $this->randomName();
+    $path_part1 = $this->randomMachineName();
+    $path_part2 = $this->randomMachineName();
     $path = $path_part1 . '/' . $path_part2;
-    $cached_path = $this->randomName();
-    $cached_alias = $this->randomName();
+    $cached_path = $this->randomMachineName();
+    $cached_alias = $this->randomMachineName();
 
     $language = $this->setUpCurrentLanguage();
 
@@ -409,11 +409,11 @@ public function testGetAliasByPathCachedMissNoAlias() {
    * @covers ::writeCache()
    */
   public function testGetAliasByPathUncachedMissNoAlias() {
-    $path_part1 = $this->randomName();
-    $path_part2 = $this->randomName();
+    $path_part1 = $this->randomMachineName();
+    $path_part2 = $this->randomMachineName();
     $path = $path_part1 . '/' . $path_part2;
-    $cached_path = $this->randomName();
-    $cached_alias = $this->randomName();
+    $cached_path = $this->randomMachineName();
+    $cached_alias = $this->randomMachineName();
 
     $language = $this->setUpCurrentLanguage();
 
@@ -462,13 +462,13 @@ public function testGetAliasByPathUncachedMissNoAlias() {
    * @covers ::writeCache()
    */
   public function testGetAliasByPathUncachedMissWithAlias() {
-    $path_part1 = $this->randomName();
-    $path_part2 = $this->randomName();
+    $path_part1 = $this->randomMachineName();
+    $path_part2 = $this->randomMachineName();
     $path = $path_part1 . '/' . $path_part2;
-    $cached_path = $this->randomName();
-    $cached_no_alias_path = $this->randomName();
-    $cached_alias = $this->randomName();
-    $new_alias = $this->randomName();
+    $cached_path = $this->randomMachineName();
+    $cached_no_alias_path = $this->randomMachineName();
+    $cached_alias = $this->randomMachineName();
+    $new_alias = $this->randomMachineName();
 
     $language = $this->setUpCurrentLanguage();
 
diff --git a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginBagTest.php b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginBagTest.php
index 2ac14f6..5e96ec4 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginBagTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginBagTest.php
@@ -22,7 +22,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 99e4d4a..7f7d3ac 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php
@@ -124,7 +124,7 @@ public function testDefaultPluginManagerWithAlter() {
       ->getMock();
 
     // 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));
@@ -139,7 +139,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();
@@ -164,7 +164,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();
@@ -187,7 +187,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 3762e94..b3bc726 100644
--- a/core/tests/Drupal/Tests/Core/PrivateKeyTest.php
+++ b/core/tests/Drupal/Tests/Core/PrivateKeyTest.php
@@ -74,7 +74,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/Site/SettingsTest.php b/core/tests/Drupal/Tests/Core/Site/SettingsTest.php
index 5a442b8..ef115ea 100644
--- a/core/tests/Drupal/Tests/Core/Site/SettingsTest.php
+++ b/core/tests/Drupal/Tests/Core/Site/SettingsTest.php
@@ -37,7 +37,7 @@ public function setUp(){
     $this->config = array(
       'one' => '1',
       'two' => '2',
-      'hash_salt' => $this->randomName(),
+      'hash_salt' => $this->randomMachineName(),
     );
     $this->settings = new Settings($this->config);
   }
diff --git a/core/tests/Drupal/Tests/Core/Template/AttributeTest.php b/core/tests/Drupal/Tests/Core/Template/AttributeTest.php
index aee1dd7..4181f33 100644
--- a/core/tests/Drupal/Tests/Core/Template/AttributeTest.php
+++ b/core/tests/Drupal/Tests/Core/Template/AttributeTest.php
@@ -83,7 +83,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/Core/Utility/TokenTest.php b/core/tests/Drupal/Tests/Core/Utility/TokenTest.php
index f7c3377..ea68aed 100644
--- a/core/tests/Drupal/Tests/Core/Utility/TokenTest.php
+++ b/core/tests/Drupal/Tests/Core/Utility/TokenTest.php
@@ -67,13 +67,13 @@ public function testGetInfo() {
     $token_info = array(
       'types' => array(
         'foo' => array(
-          'name' => $this->randomName(),
+          'name' => $this->randomMachineName(),
         ),
       ),
     );
 
     $language = $this->getMock('\Drupal\Core\Language\Language');
-    $language->id = $this->randomName();
+    $language->id = $this->randomMachineName();
 
     $this->languageManager->expects($this->once())
       ->method('getCurrentLanguage')
diff --git a/core/tests/Drupal/Tests/UnitTestCase.php b/core/tests/Drupal/Tests/UnitTestCase.php
index 35ed4e3..b024e68 100644
--- a/core/tests/Drupal/Tests/UnitTestCase.php
+++ b/core/tests/Drupal/Tests/UnitTestCase.php
@@ -47,7 +47,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);
   }
 
diff --git a/core/vendor/bin/phpunit b/core/vendor/bin/phpunit
deleted file mode 120000
index 2c48930..0000000
--- a/core/vendor/bin/phpunit
+++ /dev/null
@@ -1 +0,0 @@
-../phpunit/phpunit/phpunit
\ No newline at end of file
diff --git a/core/vendor/bin/phpunit b/core/vendor/bin/phpunit
new file mode 100755
index 0000000..44f3c6d
--- /dev/null
+++ b/core/vendor/bin/phpunit
@@ -0,0 +1,55 @@
+#!/usr/bin/env php
+<?php
+/* PHPUnit
+ *
+ * Copyright (c) 2001-2014, Sebastian Bergmann <sebastian@phpunit.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   * Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *
+ *   * Neither the name of Sebastian Bergmann nor the names of his
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+foreach (array(__DIR__ . '/../../autoload.php', __DIR__ . '/vendor/autoload.php') as $file) {
+    if (file_exists($file)) {
+        define('PHPUNIT_COMPOSER_INSTALL', $file);
+        break;
+    }
+}
+
+if (!defined('PHPUNIT_COMPOSER_INSTALL')) {
+    die(
+        'You need to set up the project dependencies using the following commands:' . PHP_EOL .
+        'wget http://getcomposer.org/composer.phar' . PHP_EOL .
+        'php composer.phar install' . PHP_EOL
+    );
+}
+
+require PHPUNIT_COMPOSER_INSTALL;
+
+PHPUnit_TextUI_Command::main();
