diff --git a/scheduler.cron.inc b/scheduler.cron.inc
index 570bbdb..bcf4a08 100644
--- a/scheduler.cron.inc
+++ b/scheduler.cron.inc
@@ -99,6 +99,7 @@ function _scheduler_publish() {
  *   TRUE is any node has been unpublished, FALSE otherwise.
  */
 function _scheduler_unpublish() {
+  $config = \Drupal::config('scheduler.settings');
   $result = FALSE;
 
   // If the time is greater than the time to unpublish a node, unpublish it.
@@ -139,7 +140,7 @@ function _scheduler_unpublish() {
     $unpublish_on = $node->unpublish_on;
     $node->set('changed', $unpublish_on);
 
-    $create_unpublishing_revision = variable_get('scheduler_unpublish_revision_' . $node->getType(), 0) == 1;
+    $create_unpublishing_revision = $config->get('scheduler_unpublish_revision_' . $node->getType()) == 1;
     if ($create_unpublishing_revision) {
       $node->setNewRevision();
       // Use a core date format to guarantee a time is included.
diff --git a/scheduler.module b/scheduler.module
index 03fb2a4..0d1ff48 100644
--- a/scheduler.module
+++ b/scheduler.module
@@ -330,19 +330,21 @@ function scheduler_node_view(array &$build, EntityInterface $node, EntityViewDis
  * @todo hook_node_validate() and hook_node_submit() have been removed (#2420295)
  */
 function scheduler_node_validate($node, array $form, FormStateInterface $form_state) {
+  $config = \Drupal::config('scheduler.settings');
+
   // Adjust the entered times for timezone consideration. Note, we must check
   // to see if the value is numeric. If it is, assume we have already done the
   // strtotime conversion. This prevents us running strtotime on a value we have
   // already converted. This is needed because Drupal 6 removed 'submit' and
   // added 'presave' and all this happens at different times.
-  $date_format = \Drupal::config('scheduler.settings')->get('date_format');
+  $date_format = $config->get('date_format');
 
   if (!empty($node->publish_on->value) && !is_numeric($node->publish_on->value)) {
     $publishtime = $node->publish_on->value;
     if ($publishtime === FALSE) {
       $form_state->setErrorByName('publish_on', t("The 'publish on' value does not match the expected format of %time", array('%time' => format_date(REQUEST_TIME, 'custom', $date_format))));
     }
-    elseif ($publishtime && variable_get('scheduler_publish_past_date_' . $node->getType(), 'error') == 'error' && $publishtime < REQUEST_TIME) {
+    elseif ($publishtime && $config->get('scheduler_publish_past_date_' . $node->getType()) == 'error' && $publishtime < REQUEST_TIME) {
       $form_state->setErrorByName('publish_on', t("The 'publish on' date must be in the future"));
     }
   }
@@ -363,7 +365,7 @@ function scheduler_node_validate($node, array $form, FormStateInterface $form_st
 
   // The unpublish-on 'required' form attribute may not be set in some cases,
   // but a value must be entered if also setting a publish-on date.
-  if (variable_get('scheduler_unpublish_required_' . $node->getType()) && !empty($node->publish_on->value) && empty($node->unpublish_on->value)) {
+  if ($config->get('scheduler_unpublish_required_' . $node->getType()) && !empty($node->publish_on->value) && empty($node->unpublish_on->value)) {
     $form_state->setErrorByName('unpublish_on', t("If you set a 'publish-on' date then you must also set an 'unpublish-on' date."));
   }
 }
@@ -533,12 +535,13 @@ function scheduler_views_api() {
  * Implements hook_field_extra_fields().
  */
 function scheduler_field_extra_fields() {
+  $config = \Drupal::config('scheduler.settings');
   $fields = array();
 
   foreach (node_type_get_types() as $type) {
-    $publishing_enabled = variable_get('scheduler_publish_enable_' . $type->type, 0);
-    $unpublishing_enabled = variable_get('scheduler_unpublish_enable_' . $type->type, 0);
-    $use_vertical_tabs = variable_get('scheduler_use_vertical_tabs_' . $type->type, 1);
+    $publishing_enabled = $config->get('scheduler_publish_enable_' . $type->type) == NULL ? 0 : $config->get('scheduler_publish_enable_' . $type->type);
+    $unpublishing_enabled = $config->get('scheduler_unpublish_enable_' . $type->type) == NULL ? 0 : $config->get('scheduler_unpublish_enable_' . $type->type);
+    $use_vertical_tabs = $config->get('scheduler_use_vertical_tabs_' . $type->type) == NULL ? 0 : $config->get('scheduler_use_vertical_tabs_' . $type->type);
 
     if (($publishing_enabled || $unpublishing_enabled) && !$use_vertical_tabs) {
       $fields['node'][$type->type]['form']['scheduler_settings'] = array(
@@ -577,10 +580,12 @@ function scheduler_preprocess_node(&$variables) {
  * Feeds module.
  */
 function scheduler_feeds_processor_targets_alter(&$targets, $entity_type, $bundle_name) {
+  $config = \Drupal::config('scheduler.settings');
+
   // Scheduler module only works on nodes.
   if ($entity_type == 'node') {
-    $publishing_enabled = variable_get('scheduler_publish_enable_' . $bundle_name, 0);
-    $unpublishing_enabled = variable_get('scheduler_unpublish_enable_' . $bundle_name, 0);
+    $publishing_enabled = $config->get('scheduler_publish_enable_' . $bundle_name) == NULL ? 0 : $config->get('scheduler_publish_enable_' . $bundle_name);
+    $unpublishing_enabled = $config->get('scheduler_unpublish_enable_' . $bundle_name) == NULL ? 0 : $config->get('scheduler_unpublish_enable_' . $bundle_name);
 
     if ($publishing_enabled) {
       $targets['publish_on'] = array(
@@ -646,18 +651,19 @@ function scheduler_ctools_plugin_directory($owner, $plugin_type) {
  * Implements hook_i18n_sync_options().
  */
 function scheduler_i18n_sync_options($entity_type, $bundle_name) {
+  $config = \Drupal::config('scheduler.settings');
   // Keep the scheduler dates synchronised between separate nodes which have
   // been defined as translations of each other.
   if ($entity_type == 'node') {
     $options = array();
     // $bundle_name holds the content_type.
-    if (variable_get('scheduler_publish_enable_' . $bundle_name, 0)) {
+    if ($config->get('scheduler_publish_enable_' . $bundle_name) == NULL ? 0 : $config->get('scheduler_publish_enable_' . $bundle_name)) {
       $options['publish_on'] = array(
         'title' => t('Publish on'),
         'description' => t('Scheduler Publish date and time'),
       );
     }
-    if (variable_get('scheduler_unpublish_enable_' . $bundle_name, 0)) {
+    if ($config->get('scheduler_unpublish_enable_' . $bundle_name) == NULL ? 0 : $config->get('scheduler_unpublish_enable_' . $bundle_name)) {
       $options['unpublish_on'] = array(
         'title' => t('Unpublish on'),
         'description' => t('Scheduler Unpublish date and time'),
diff --git a/scheduler.rules.inc b/scheduler.rules.inc
index 1ee8675..e542902 100644
--- a/scheduler.rules.inc
+++ b/scheduler.rules.inc
@@ -127,11 +127,13 @@ function scheduler_rules_action_info() {
  *   The date for publishing, a unix timestamp integer.
  */
 function scheduler_set_publish_date_action(Node $node, $date) {
+  $config = \Drupal::config('scheduler.settings');
+
   // When this action is invoked and it operates on the node being editted then
   // hook_node_presave() and hook_node_update() will be executed anyway. But if
   // this action is being used to schedule a different node then we need to call
   // the functions directly here.
-  if (variable_get('scheduler_publish_enable_' . $node->getType(), 0)) {
+  if ($config->get('scheduler_publish_enable_' . $node->getType()) == NULL ? 0 : $config->get('scheduler_publish_enable_' . $node->getType())) {
     $node->publish_on->value = $date;
     scheduler_node_presave($node);
     scheduler_node_update($node);
@@ -152,7 +154,8 @@ function scheduler_set_publish_date_action(Node $node, $date) {
  *   The date for unpublishing, a unix timestamp integer.
  */
 function scheduler_set_unpublish_date_action(Node $node, $date) {
-  if (variable_get('scheduler_unpublish_enable_' . $node->getType(), 0)) {
+  $config = \Drupal::config('scheduler.settings');
+  if ($config->get('scheduler_unpublish_enable_' . $node->getType()) == NULL ? 0 : $config->get('scheduler_unpublish_enable_' . $node->getType())) {
     $node->unpublish_on->value = $date;
     scheduler_node_presave($node);
     scheduler_node_update($node);
@@ -173,7 +176,8 @@ function scheduler_set_unpublish_date_action(Node $node, $date) {
  *   The node object from which to remove the publish_on date.
  */
 function scheduler_remove_publish_date_action(Node $node) {
-  if (variable_get('scheduler_publish_enable_' . $node->getType(), 0)) {
+  $config = \Drupal::config('scheduler.settings');
+  if ($config->get('scheduler_publish_enable_' . $node->getType()) == NULL ? 0 : $config->get('scheduler_publish_enable_' . $node->getType())) {
     $node->publish_on->value = 0;
     scheduler_node_presave($node);
     scheduler_node_update($node);
@@ -194,7 +198,8 @@ function scheduler_remove_publish_date_action(Node $node) {
  *   The node object from which to remove the unpublish_on date.
  */
 function scheduler_remove_unpublish_date_action(Node $node) {
-  if (variable_get('scheduler_unpublish_enable_' . $node->getType(), 0)) {
+  $config = \Drupal::config('scheduler.settings');
+  if ($config->get('scheduler_unpublish_enable_' . $node->getType()) == NULL ? 0 : $config->get('scheduler_unpublish_enable_' . $node->getType())) {
     $node->unpublish_on->value = 0;
     scheduler_node_presave($node);
     scheduler_node_update($node);
@@ -252,7 +257,8 @@ function scheduler_rules_condition_info() {
  *   TRUE if scheduled publishing is enabled for the node type, FALSE if not.
  */
 function scheduler_condition_publishing_is_enabled(Node $node) {
-  return (variable_get('scheduler_publish_enable_' . $node->getType(), 0) == 1);
+  $config = \Drupal::config('scheduler.settings');
+  return ($config->get('scheduler_publish_enable_' . $node->getType()) == NULL ? 0 : 1);
 }
 
 /**
@@ -264,7 +270,8 @@ function scheduler_condition_publishing_is_enabled(Node $node) {
  *   TRUE if scheduled unpublishing is enabled for the node type, FALSE if not.
  */
 function scheduler_condition_unpublishing_is_enabled(Node $node) {
-  return (variable_get('scheduler_unpublish_enable_' . $node->getType(), 0) == 1);
+  $config = \Drupal::config('scheduler.settings');
+  return ($config->get('scheduler_unpublish_enable_' . $node->getType()) == NULL ? 0 : 1);
 }
 
 /**
diff --git a/scheduler.test b/scheduler.test
index 87f601b..690ad88 100644
--- a/scheduler.test
+++ b/scheduler.test
@@ -176,6 +176,7 @@ class SchedulerFunctionalTest extends SchedulerTestBase {
    */
   public function setUp() {
     parent::setUp('scheduler');
+    $config = \Drupal::config('scheduler.settings');
 
     // Create a 'Basic Page' content type.
     $this->drupalCreateContentType(array('type' => 'page', 'name' => t('Basic page')));
@@ -193,8 +194,8 @@ class SchedulerFunctionalTest extends SchedulerTestBase {
     ));
 
     // Add scheduler functionality to the page node type.
-    variable_set('scheduler_publish_enable_page', 1);
-    variable_set('scheduler_unpublish_enable_page', 1);
+    $config->set('scheduler_publish_enable_page', 1);
+    $config->set('scheduler_unpublish_enable_page', 1);
   }
 
   /**
@@ -218,6 +219,7 @@ class SchedulerFunctionalTest extends SchedulerTestBase {
    * Test the different options for past publication dates.
    */
   public function testSchedulerPastDates() {
+    $config = \Drupal::config('scheduler.settings');
     $node_storage = $this->container->get('entity.manager')->getStorage('node');
 
     // Log in.
@@ -236,7 +238,7 @@ class SchedulerFunctionalTest extends SchedulerTestBase {
     $this->assertRaw(t("The 'publish on' date must be in the future"), 'An error message is shown when the publication date is in the past and the "error" behavior is chosen.');
 
     // Test the 'publish' behavior: the node should be published immediately.
-    variable_set('scheduler_publish_past_date_page', 'publish');
+    $config->set('scheduler_publish_past_date_page', 'publish');
     $this->drupalPost('node/' . $node->id() . '/edit', $edit, t('Save'));
     $this->assertNoRaw(t("The 'publish on' date must be in the future"), 'No error message is shown when the publication date is in the past and the "publish" behavior is chosen.');
     $this->assertRaw(t('@type %title has been updated.', array('@type' => t('Basic page'), '%title' => SafeMarkup::checkPlain($edit['title']))), 'The node is saved successfully when the publication date is in the past and the "publish" behavior is chosen.');
@@ -248,7 +250,7 @@ class SchedulerFunctionalTest extends SchedulerTestBase {
 
     // Test the 'schedule' behavior: the node should be unpublished and become
     // published on the next cron run.
-    variable_set('scheduler_publish_past_date_page', 'schedule');
+    $config->set('scheduler_publish_past_date_page', 'schedule');
     $this->drupalPost('node/' . $node->id() . '/edit', $edit, t('Save'));
     $this->assertNoRaw(t("The 'publish on' date must be in the future"), 'No error message is shown when the publication date is in the past and the "schedule" behavior is chosen.');
     $this->assertRaw(t('@type %title has been updated.', array('@type' => t('Basic page'), '%title' => SafeMarkup::checkPlain($edit['title']))), 'The node is saved successfully when the publication date is in the past and the "schedule" behavior is chosen.');
@@ -271,6 +273,7 @@ class SchedulerFunctionalTest extends SchedulerTestBase {
    * Tests the creation of new revisions on scheduling.
    */
   public function testRevisioning() {
+    $config = \Drupal::config('scheduler.settings');
     // Create a scheduled node that is not automatically revisioned.
     $created = strtotime('-2 day');
     $settings = array(
@@ -288,8 +291,8 @@ class SchedulerFunctionalTest extends SchedulerTestBase {
     $this->assertRevisionCount($node->id(), 1, 'No new revision was created when a node was unpublished with revisioning disabled.');
 
     // Enable revisioning.
-    variable_set('scheduler_publish_revision_page', 1);
-    variable_set('scheduler_unpublish_revision_page', 1);
+    $config->set('scheduler_publish_revision_page', 1);
+    $config->set('scheduler_unpublish_revision_page', 1);
 
     // Test scheduled publication with revisioning enabled.
     $node = $this->schedule($node);
@@ -314,6 +317,7 @@ class SchedulerFunctionalTest extends SchedulerTestBase {
    * Tests if options can both be displayed as extra fields and vertical tabs.
    */
   public function testExtraFields() {
+    $config = \Drupal::config('scheduler.settings');
     $this->drupalLogin($this->adminUser);
 
     // Test if the options are shown as vertical tabs by default.
@@ -321,13 +325,13 @@ class SchedulerFunctionalTest extends SchedulerTestBase {
     $this->assertTrue($this->xpath('//div[contains(@class, "vertical-tabs-panes")]/fieldset[@id = "edit-scheduler-settings"]'), 'By default the scheduler options are shown as a vertical tab.');
 
     // Test if the options are shown as extra fields when configured to do so.
-    variable_set('scheduler_use_vertical_tabs_page', 0);
+    $config->set('scheduler_use_vertical_tabs_page', 0);
     $this->drupalGet('node/add/page');
     $this->assertFalse($this->xpath('//div[contains(@class, "vertical-tabs-panes")]/fieldset[@id = "edit-scheduler-settings"]'), 'The scheduler options are not shown as a vertical tab when they are configured to show as an extra field.');
     $this->assertTrue($this->xpath('//fieldset[@id = "edit-scheduler-settings" and contains(@class, "collapsed")]'), 'The scheduler options are shown as a collapsed fieldset when they are configured to show as an extra field.');
 
     // Test the option to expand the fieldset.
-    variable_set('scheduler_expand_fieldset_page', 1);
+    $config->set('scheduler_expand_fieldset_page', 1);
     $this->drupalGet('node/add/page');
     $this->assertFalse($this->xpath('//div[contains(@class, "vertical-tabs-panes")]/fieldset[@id = "edit-scheduler-settings"]'), 'The scheduler options are not shown as a vertical tab when they are configured to show as an expanded fieldset.');
     $this->assertTrue($this->xpath('//fieldset[@id = "edit-scheduler-settings" and not(contains(@class, "collapsed"))]'), 'The scheduler options are shown as an expanded fieldset.');
@@ -337,6 +341,7 @@ class SchedulerFunctionalTest extends SchedulerTestBase {
    * Tests creating and editing nodes with required scheduling enabled.
    */
   public function testRequiredScheduling() {
+    $config = \Drupal::config('scheduler.settings');
     $this->drupalLogin($this->adminUser);
 
     // Define test scenarios with expected results.
@@ -468,12 +473,12 @@ class SchedulerFunctionalTest extends SchedulerTestBase {
 
     foreach ($test_cases as $test_case) {
       // Enable required (un)publishing as stipulated by the test case.
-      variable_set('scheduler_publish_required_page', $test_case['required'] == 'publish');
-      variable_set('scheduler_unpublish_required_page', $test_case['required'] == 'unpublish');
+      $config->set('scheduler_publish_required_page', $test_case['required'] == 'publish');
+      $config->set('scheduler_unpublish_required_page', $test_case['required'] == 'unpublish');
 
       // Set the default node status, used when creating a new node.
       $node_options_page = !empty($test_case['status']) ? array('status') : array();
-      variable_set('node_options_page', $node_options_page);
+      $config->set('node_options_page', $node_options_page);
 
       // To assist viewing and analysing the generated test result pages create
       // a text string showing all the test case parameters.
@@ -528,6 +533,7 @@ class SchedulerFunctionalTest extends SchedulerTestBase {
    * Tests the validation when editing a node.
    */
   public function testValidationDuringEdit() {
+    $config = \Drupal::config('scheduler.settings');
     $this->drupalLogin($this->adminUser);
 
     // Create an unpublished page node.
@@ -539,7 +545,7 @@ class SchedulerFunctionalTest extends SchedulerTestBase {
     $node = $this->drupalCreateNode($settings);
 
     // Set unpublishing to be required.
-    variable_set('scheduler_unpublish_required_page', TRUE);
+    $config->set('scheduler_unpublish_required_page', TRUE);
 
     // Edit the node and check the validation.
     $edit = array(
@@ -558,6 +564,7 @@ class SchedulerFunctionalTest extends SchedulerTestBase {
    * @see https://drupal.org/node/1614880
    */
   public function testScheduledNodeDelete() {
+    $config = \Drupal::config('scheduler.settings');
     // Log in.
     $this->drupalLogin($this->adminUser);
 
@@ -566,8 +573,8 @@ class SchedulerFunctionalTest extends SchedulerTestBase {
     $published_node = $this->drupalCreateNode(array('type' => 'page', 'status' => 1));
 
     // Make scheduled publishing and unpublishing required.
-    variable_set('scheduler_publish_required_page', TRUE);
-    variable_set('scheduler_unpublish_required_page', TRUE);
+    $config->set('scheduler_publish_required_page', TRUE);
+    $config->set('scheduler_unpublish_required_page', TRUE);
 
     // Check that deleting the nodes does not throw form validation errors.
     $this->drupalPost('node/' . $published_node->id() . '/edit', array(), t('Delete'));
@@ -599,6 +606,7 @@ class SchedulerDateCombinedFunctionalTest extends SchedulerTestBase {
    * {@inheritdoc}
    */
   public function setUp() {
+    $config = \Drupal::config('scheduler.settings');
     parent::setUp('date', 'scheduler');
 
     // Create a 'Basic Page' content type.
@@ -617,8 +625,8 @@ class SchedulerDateCombinedFunctionalTest extends SchedulerTestBase {
     ));
 
     // Add scheduler functionality to the page node type.
-    variable_set('scheduler_publish_enable_page', 1);
-    variable_set('scheduler_unpublish_enable_page', 1);
+    $config->set('scheduler_publish_enable_page', 1);
+    $config->set('scheduler_unpublish_enable_page', 1);
   }
 
   /**
diff --git a/src/Form/SchedulerAdminForm.php b/src/Form/SchedulerAdminForm.php
index ce93c31..d14c40c 100644
--- a/src/Form/SchedulerAdminForm.php
+++ b/src/Form/SchedulerAdminForm.php
@@ -35,12 +35,13 @@ class SchedulerAdminForm extends ConfigFormBase {
    * {@inheritdoc}
    */
   public function buildForm(array $form, FormStateInterface $form_state) {
-    $now = t('Example: %date', ['%date' => format_date(REQUEST_TIME, 'custom', \Drupal::config('scheduler.settings')->get('date_format'))]);
+    $config = $this->config('scheduler.settings');
+    $now = t('Example: %date', ['%date' => format_date(REQUEST_TIME, 'custom', $config->get('date_format'))]);
     $url = Url::fromUri('http://php.net/manual/en/function.date.php');
     $form['date_format'] = [
       '#type' => 'textfield',
       '#title' => t('Date format'),
-      '#default_value' => \Drupal::config('scheduler.settings')->get('date_format'),
+      '#default_value' => $config->get('date_format'),
       '#size' => 20,
       '#maxlength' => 20,
       '#required' => TRUE,
@@ -61,13 +62,13 @@ class SchedulerAdminForm extends ConfigFormBase {
     $form['date_only_fieldset']['allow_date_only'] = [
       '#type' => 'checkbox',
       '#title' => t('Allow users to enter only a date and provide a default time.'),
-      '#default_value' => \Drupal::config('scheduler.settings')->get('allow_date_only'),
+      '#default_value' => $config->get('allow_date_only'),
       '#description' => t('When only a date is entered the time will default to a specified value, but the user can change this if required.'),
     ];
     $form['date_only_fieldset']['default_time'] = [
       '#type' => 'textfield',
       '#title' => t('Default time'),
-      '#default_value' => \Drupal::config('scheduler.settings')->get('default_time'),
+      '#default_value' => $config->get('default_time'),
       '#size' => 20,
       '#maxlength' => 20,
       '#description' => t('This is the time that will be used if the user does not enter a value. Format: HH:MM:SS.'),
@@ -78,9 +79,6 @@ class SchedulerAdminForm extends ConfigFormBase {
       ],
     ];
 
-    // Add a submit handler function.
-    $form['#submit'][] = 'admin_submit';
-
     return parent::buildForm($form, $form_state);
   }
 
@@ -133,20 +131,19 @@ class SchedulerAdminForm extends ConfigFormBase {
   public function submitForm(array &$form, FormStateInterface $form_state) {
     $config = $this->config('scheduler.settings');
 
-    foreach (Element::children($form) as $variable) {
-      $config->set($variable, $form_state->getValue($form[$variable]['#parents']));
-    }
-    $config->save();
-
     // Extract the date part and time part of the full format, for use with the
     // default time functionality. Assume the date and time time parts begin and
     // end with a letter, but any punctuation between these will be retained.
     $format = $form_state->getValue(['date_format']);
     $time_only_format = $this->getTimeOnlyFormat($format);
-    variable_set('time_only_format', $time_only_format);
-
     $date_only_format = $this->getDateOnlyFormat($format);
-    variable_set('date_only_format', $date_only_format);
+
+    $config
+      ->set('time_only_format', $time_only_format)
+      ->set('date_only_format', $date_only_format)
+      ->set('allow_date_only', $form_state->getValue(['allow_date_only']))
+      ->set('default_time', $form_state->getValue(['default_time']))
+      ->save();
 
     if (empty($time_only_format)) {
       drupal_set_message(t('The date part of the Scheduler format is %date_part. There is no time part', ['%date_part' => $date_only_format]));
diff --git a/tests/scheduler_api.test b/tests/scheduler_api.test
index 970da85..3546e1c 100644
--- a/tests/scheduler_api.test
+++ b/tests/scheduler_api.test
@@ -41,10 +41,13 @@ class SchedulerApiTestCase extends WebTestBase {
    */
   protected function setUp() {
     parent::setUp('scheduler', 'scheduler_test');
+    $config = $this->config('scheduler.settings');
 
     // Add scheduler functionality to the 'scheduler_test' node type.
-    variable_set('scheduler_publish_enable_scheduler_test', 1);
-    variable_set('scheduler_unpublish_enable_scheduler_test', 1);
+    $config
+      ->set('scheduler_publish_enable_scheduler_test', 1)
+      ->set('scheduler_unpublish_enable_scheduler_test', 1)
+      ->save();
   }
 
   /**
@@ -59,6 +62,7 @@ class SchedulerApiTestCase extends WebTestBase {
    *   the correct messages are displayed.
    */
   public function testAllowedPublishing() {
+    $config = $this->config('scheduler.settings');
     // Create a node that is not approved for publication. Then simulate a cron
     // run, and check that the node is not published.
     $node = $this->createUnapprovedNode();
@@ -73,7 +77,7 @@ class SchedulerApiTestCase extends WebTestBase {
 
     // Turn on immediate publication of nodes with publication dates in the past
     // and repeat the tests. It is not needed to simulate cron runs now.
-    variable_set('scheduler_publish_past_date_scheduler_test', 'publish');
+    $config->set('scheduler_publish_past_date_scheduler_test', 'publish');
     $node = $this->createUnapprovedNode();
     $this->assertNodeNotPublished($node->id(), 'An unapproved node is not published immediately after saving.');
     $this->approveNode($node->id());
