diff --git a/scheduler.test b/scheduler.test
index c12567b..251feb4 100644
--- a/scheduler.test
+++ b/scheduler.test
@@ -133,4 +133,201 @@ class SchedulerTestCase extends DrupalWebTestCase {
     $this->assertTrue($node->status, 'The node with publication date in the past and the "schedule" behavior has now been published by cron.');
   }
 
+  /**
+   * Tests creating and editing nodes with required scheduling enabled.
+   */
+  function testRequiredScheduling() {
+    $this->drupalLogin($this->admin_user);
+
+    // Define test scenarios with expected results.
+    $test_cases = array(
+      // The 1-10 numbering used below matches the test cases described in
+      // http://drupal.org/node/1198788#comment-7816119
+
+      // A. Test scenarios that require scheduled publishing.
+
+      // When creating a new published node it is required to enter a
+      // publication date. The node will be unpublished on form submit.
+      array(
+        'id' => 2,
+        'required' => 'publish',
+        'operation' => 'add',
+        'status' => 1,
+        'expected' => 'required',
+        'message' => 'When scheduled publishing is required and a new published node is created, entering a date in the publish on field is required.',
+      ),
+
+      // When creating a new unpublished node it is required to enter a
+      // publication date.
+      array(
+        'id' => 1,
+        'required' => 'publish',
+        'operation' => 'add',
+        'status' => 0,
+        'expected' => 'required',
+        'message' => 'When scheduled publishing is required and a new unpublished node is created, entering a date in the publish on field is required.',
+      ),
+
+      // When editing a published node it is not needed to enter a publication
+      // date since the node is already published.
+      array(
+        'id' => 3,
+        'required' => 'publish',
+        'operation' => 'edit',
+        'scheduled' => 0,
+        'status' => 1,
+        'expected' => 'not required',
+        'message' => 'When scheduled publishing is required and an existing published, unscheduled node is edited, entering a date in the publish on field is not required.',
+      ),
+
+      // When editing an unpublished node that is scheduled for publication it
+      // is required to enter a publication date.
+      array(
+        'id' => 4,
+        'required' => 'publish',
+        'operation' => 'edit',
+        'scheduled' => 1,
+        'status' => 0,
+        'expected' => 'required',
+        'message' => 'When scheduled publishing is required and an existing unpublished, scheduled node is edited, entering a date in the publish on field is required.',
+      ),
+
+      // When editing an unpublished node that is not scheduled for publication
+      // it is not required to enter a publication date since this means that
+      // the node has already gone through a publication > unpublication cycle.
+      array(
+        'id' => 5,
+        'required' => 'publish',
+        'operation' => 'edit',
+        'scheduled' => 0,
+        'status' => 0,
+        'expected' => 'not required',
+        'message' => 'When scheduled publishing is required and an existing unpublished, unscheduled node is edited, entering a date in the publish on field is not required.',
+      ),
+
+      // B. Test scenarios that require scheduled unpublishing.
+
+      // When creating a new published node it is required to enter an
+      // unpublication date.
+      array(
+        'id' => 7,
+        'required' => 'unpublish',
+        'operation' => 'add',
+        'status' => 1,
+        'expected' => 'required',
+        'message' => 'When scheduled unpublishing is required and a new published node is created, entering a date in the unpublish on field is required.',
+      ),
+
+      // When creating a new unpublished node it is required to enter an
+      // unpublication date since it is to be expected that the node will be
+      // published at some point and should subsequently be unpublished.
+      array(
+        'id' => 6,
+        'required' => 'unpublish',
+        'operation' => 'add',
+        'status' => 0,
+        'expected' => 'required',
+        'message' => 'When scheduled unpublishing is required and a new unpublished node is created, entering a date in the unpublish on field is required.',
+      ),
+
+      // When editing a published node it is required to enter an unpublication
+      // date.
+      array(
+        'id' => 8,
+        'required' => 'unpublish',
+        'operation' => 'edit',
+        'scheduled' => 0,
+        'status' => 1,
+        'expected' => 'required',
+        'message' => 'When scheduled unpublishing is required and an existing published, unscheduled node is edited, entering a date in the unpublish on field is required.',
+      ),
+
+      // When editing an unpublished node that is scheduled for publication it
+      // it is required to enter an unpublication date.
+      array(
+        'id' => 9,
+        'required' => 'unpublish',
+        'operation' => 'edit',
+        'scheduled' => 1,
+        'status' => 0,
+        'expected' => 'required',
+        'message' => 'When scheduled unpublishing is required and an existing unpublished, scheduled node is edited, entering a date in the unpublish on field is required.',
+      ),
+
+      // When editing an unpublished node that is not scheduled for publication
+      // it is not required to enter an unpublication date since this means that
+      // the node has already gone through a publication - unpublication cycle.
+      array(
+        'id' => 10,
+        'required' => 'unpublish',
+        'operation' => 'edit',
+        'scheduled' => 0,
+        'status' => 0,
+        'expected' => 'not required',
+        'message' => 'When scheduled unpublishing is required and an existing unpublished, unscheduled node is edited, entering a date in the unpublish on field is not required.',
+      ),
+    );
+
+    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');
+
+      // 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);
+
+      // If the test case requires editing a node, we need to create one first.
+      // To assist viewing and analysing the generated test result pages create
+      // a string holding the options, for use as the title. Start with the full
+      // $test_case array, remove the message key, then compress it into a
+      // string, and remove 'Array' and ( ) and reduce multiple whitespace.
+      $title_data = $test_case;
+      unset($title_data['message']);
+      $title = print_r($title_data, TRUE);
+      $title = preg_replace('/Array|\(|\)/', ' ', $title);
+      $title = trim(preg_replace('/\s+/', ' ', $title));
+
+      if ($test_case['operation'] == 'edit') {
+        $options = array(
+          'title' => $title,
+          'type' => 'page',
+          'status' => !empty($test_case['status']),
+          'publish_on' => !empty($test_case['scheduled']) ? strtotime('+ 1 day') : 0,
+        );
+        $node = $this->drupalCreateNode($options);
+      }
+
+      // Only fill in the title and status when creating a new node. When we are
+      // editing an existing node these fields are already filled in.
+      $edit = $test_case['operation'] == 'add' ? array(
+        'title' => $title,
+        'status' => $test_case['status'],
+      ) : array();
+
+      // Make sure the publication date fields are empty so we can check if they
+      // throw form validation errors when they are required.
+      $edit += array(
+        'publish_on' => '',
+        'unpublish_on' => '',
+      );
+
+      $path = $test_case['operation'] == 'add' ? 'node/add/page' : 'node/' . $node->nid . '/edit';
+      $this->drupalPost($path, $edit, t('Save'));
+
+      // Check for the expected result.
+      switch ($test_case['expected']) {
+        case 'required':
+          $string = t('!name field is required.', array('!name' => ucfirst($test_case['required']) . ' on'));
+          $this->assertRaw($string, $test_case['id'] . '. ' . $test_case['message']);
+          break;
+
+        case 'not required':
+          $string = '@type %title has been ' . ($test_case['operation'] == 'add' ? 'created' : 'updated') . '.';
+          $args = array('@type' => 'Basic page', '%title' => $title);
+          $this->assertRaw(t($string, $args), $test_case['id'] . '. ' . $test_case['message']);
+          break;
+      }
+    }
+  }
 }
