diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiInfoTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiInfoTest.php
index fbebe94..6135bf0 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiInfoTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiInfoTest.php
@@ -32,7 +32,7 @@ function testEntityInfoChanges() {
 
     // Change the label of the test entity type and make sure changes appear
     // after flushing caches.
-    variable_set('entity_cache_test_label', 'New label.');
+    state()->set('entity_cache_test.label', 'New label.');
     $info = entity_get_info('entity_cache_test');
     $this->assertEqual($info['label'], 'Entity Cache Test', 'Original label appears in cached entity info.');
     $this->resetAll();
@@ -52,7 +52,7 @@ function testEntityInfoChanges() {
    */
   function testEntityInfoCacheWatchdog() {
     module_enable(array('entity_cache_test'));
-    $info = variable_get('entity_cache_test');
+    $info = state()->get('entity_cache_test');
     $this->assertEqual($info['label'], 'Entity Cache Test', 'Entity info label is correct.');
     $this->assertEqual($info['controller_class'], 'Drupal\Core\Entity\DatabaseStorageController', 'Entity controller class info is correct.');
   }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationFormTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationFormTest.php
index c7acd4d..d360229 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationFormTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationFormTest.php
@@ -37,7 +37,7 @@ public static function getInfo() {
   function setUp() {
     parent::setUp();
     // Enable translations for the test entity type.
-    variable_set('entity_test_translation', TRUE);
+    state()->set('entity_test.translation', TRUE);
 
     // Create test languages.
     $this->langcodes = array();
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php
index b34873a..370622d 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php
@@ -37,7 +37,7 @@ public static function getInfo() {
   function setUp() {
     parent::setUp();
     // Enable translations for the test entity type.
-    variable_set('entity_test_translation', TRUE);
+    state()->set('entity_test.translation', TRUE);
 
     // Create a translatable test field.
     $this->field_name = drupal_strtolower($this->randomName() . '_field_name');
diff --git a/core/modules/system/tests/modules/entity_cache_test/entity_cache_test.module b/core/modules/system/tests/modules/entity_cache_test/entity_cache_test.module
index 5ae9ecc..ed60fe8 100644
--- a/core/modules/system/tests/modules/entity_cache_test/entity_cache_test.module
+++ b/core/modules/system/tests/modules/entity_cache_test/entity_cache_test.module
@@ -22,6 +22,6 @@ function entity_cache_test_watchdog($log_entry) {
     $info = entity_get_info('entity_cache_test');
     // Store the information in a system variable to analyze it later in the
     // test case.
-    variable_set('entity_cache_test', $info);
+    state()->set('entity_cache_test', $info);
   }
 }
diff --git a/core/modules/system/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.module b/core/modules/system/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.module
index 6db46d7..392a03b 100644
--- a/core/modules/system/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.module
+++ b/core/modules/system/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.module
@@ -9,5 +9,5 @@
  * Implements hook_entity_info_alter().
  */
 function entity_cache_test_dependency_entity_info_alter(&$info) {
-  $info['entity_cache_test']['label'] = variable_get('entity_cache_test_label', 'Entity Cache Test');
+  $info['entity_cache_test']['label'] = state()->get('entity_cache_test.label') ?: 'Entity Cache Test';
 }
diff --git a/core/modules/system/tests/modules/entity_test/entity_test.module b/core/modules/system/tests/modules/entity_test/entity_test.module
index 403c1b9..2bb1dde 100644
--- a/core/modules/system/tests/modules/entity_test/entity_test.module
+++ b/core/modules/system/tests/modules/entity_test/entity_test.module
@@ -13,7 +13,7 @@
  */
 function entity_test_entity_info_alter(&$info) {
   // Optionally specify a translation handler for testing translations.
-  if (variable_get('entity_test_translation')) {
+  if (state()->get('entity_test.translation')) {
     $info['entity_test']['translation']['entity_test'] = TRUE;
   }
   // Optionally unset the access controller to test the fallback.
