diff --git a/core/modules/openid/lib/Drupal/openid/Tests/OpenIDFunctionalTest.php b/core/modules/openid/lib/Drupal/openid/Tests/OpenIDFunctionalTest.php
index 525e64d..2e6680a 100644
--- a/core/modules/openid/lib/Drupal/openid/Tests/OpenIDFunctionalTest.php
+++ b/core/modules/openid/lib/Drupal/openid/Tests/OpenIDFunctionalTest.php
@@ -362,7 +362,7 @@ function testSignatureValidation() {
     // Sign all mandatory fields and a custom field.
     $keys_to_sign = array('op_endpoint', 'claimed_id', 'identity', 'return_to', 'response_nonce', 'assoc_handle', 'foo');
     $association = new stdClass();
-    $association->mac_key = variable_get('mac_key');
+    $association->mac_key = state()->get('mac_key');
     $response = array(
       'openid.op_endpoint' => url('openid-test/endpoint', array('absolute' => TRUE)),
       'openid.claimed_id' => $identity,
diff --git a/core/modules/openid/tests/openid_test.install b/core/modules/openid/tests/openid_test.install
index 3bd4978..cd74ea2 100644
--- a/core/modules/openid/tests/openid_test.install
+++ b/core/modules/openid/tests/openid_test.install
@@ -13,5 +13,5 @@ function openid_test_install() {
   // Generate a MAC key (Message Authentication Code) used for signing messages.
   // The variable is base64-encoded, because variables cannot contain non-UTF-8
   // data.
-  variable_set('openid_test_mac_key', base64_encode(_openid_get_bytes(20)));
+  state()->set('mac_key', base64_encode(_openid_get_bytes(20)));
 }
diff --git a/core/modules/openid/tests/openid_test.module b/core/modules/openid/tests/openid_test.module
index 89f3ddf..2d99a6e 100644
--- a/core/modules/openid/tests/openid_test.module
+++ b/core/modules/openid/tests/openid_test.module
@@ -339,7 +339,7 @@ function _openid_test_endpoint_authenticate() {
 
   // Sign the message using the MAC key that was exchanged during association.
   $association = new stdClass();
-  $association->mac_key = variable_get('mac_key');
+  $association->mac_key = state()->get('mac_key');
   if (!isset($response['openid.sig'])) {
     $response['openid.sig'] = _openid_signature($association, $response, $keys_to_sign);
   }
