You are here

node_recur.test in Node recur 7.2

File

tests/node_recur.test
View source
<?php

/**
 * Functionality tests for node recur
 *
 * @ingroup node_recur
 */
class NodeRecurTestCase extends DrupalWebTestCase {
  protected $privileged_user;
  public function setUp() {
    parent::setUp(array(
      'node_recur',
    ));

    // Create node types to work with
    $this
      ->drupalCreateContentType(array(
      'type' => 'repeating_node',
      'name' => 'repeating node',
    ));
    $this
      ->drupalCreateContentType(array(
      'type' => 'basic_node',
      'name' => 'basic node',
    ));

    // Create and log in our privileged user.
    $this->privileged_user = $this
      ->drupalCreateUser(array(
      'recur all nodes',
      'administer nodes',
      'administer fields',
      'administer content types',
      'create basic_node content',
      'edit any basic_node content',
      'create repeating_node content',
      'edit any repeating_node content',
    ));
    $this
      ->drupalLogin($this->privileged_user);
    $this
      ->drupalGet('node/add');
    $this
      ->assertText(t('repeating node'));
    $this
      ->assertText(t('basic node'));

    // Date field
    $edit = array();
    $edit["fields[_add_new_field][label]"] = 'Date Simple';
    $edit["fields[_add_new_field][field_name]"] = 'date_simple';
    $edit["fields[_add_new_field][type]"] = 'datetime';
    $edit["fields[_add_new_field][widget_type]"] = 'date_text';
    $this
      ->drupalPost('admin/structure/types/manage/repeating_node/fields', $edit, t('Save'));
    $this
      ->drupalPost(NULL, array(), t('Save field settings'));

    // Add UNIX Date Field
    $edit = array();
    $edit["fields[_add_new_field][label]"] = 'Date UNIX';
    $edit["fields[_add_new_field][field_name]"] = 'date_unix';
    $edit["fields[_add_new_field][type]"] = 'datestamp';
    $edit["fields[_add_new_field][widget_type]"] = 'date_text';
    $this
      ->drupalPost('admin/structure/types/manage/repeating_node/fields', $edit, t('Save'));
    $this
      ->drupalPost(NULL, array(), t('Save field settings'));

    // Add ISO date Field
    $edit = array();
    $edit["fields[_add_new_field][label]"] = 'Date ISO';
    $edit["fields[_add_new_field][field_name]"] = 'date_iso';
    $edit["fields[_add_new_field][type]"] = 'date';
    $edit["fields[_add_new_field][widget_type]"] = 'date_text';
    $this
      ->drupalPost('admin/structure/types/manage/repeating_node/fields', $edit, t('Save'));
    $this
      ->drupalPost(NULL, array(), t('Save field settings'));
    $edit = array();
    $edit["fields[_add_new_field][label]"] = 'Date Range';
    $edit["fields[_add_new_field][field_name]"] = 'date_range';
    $edit["fields[_add_new_field][type]"] = 'date';
    $edit["fields[_add_new_field][widget_type]"] = 'date_text';
    $this
      ->drupalPost('admin/structure/types/manage/repeating_node/fields', $edit, t('Save'));
    $this
      ->drupalPost(NULL, array(
      'field[settings][enddate_get]' => 1,
    ), t('Save field settings'));
  }

}

/**
 * Verify admin screens work as expected
 *
 * @ingroup node_recur
 */
class NodeRecurAdminTestCase extends NodeRecurTestCase {
  public function setUp() {
    parent::setUp();
    $this
      ->drupalPost('admin/structure/types/manage/repeating-node', array(
      'node_recur_enabled_node_type' => 1,
      'node_recur_date_field_node_type' => 'field_date_simple',
    ), t('Save content type'));
  }
  public static function getInfo() {
    return array(
      'name' => 'Admin User tests',
      'description' => 'Test recurring forms in content.',
      'group' => 'Node recur',
    );
  }

  /**
   * Tests admin content form has recur options only on content with date fields
   */
  public function testNodeRecurContentAdminForm() {
    $this
      ->drupalGet('admin/structure/types/manage/basic-node');
    $this
      ->assertText(t('There are no date fields available for this node type.'));
  }

  /**
   * Tests admin content form has recur options only on pages with date fields
   */
  public function testNodeRecurContentCreateFormNonRepeat() {
    $edit = array();
    $edit["title"] = 'Basic Node';
    $this
      ->drupalPost('/node/add/basic-node', $edit, t('Save'));
    $this
      ->assertNoText(t('Repeat this basic node'));
  }

}

/**
 *  ISO Date field tests for  node recur
 *
 * @ingroup node_recur
 */
class NodeRecurDateISOTestCase extends NodeRecurTestCase {
  public static function getInfo() {
    return array(
      'name' => 'Test Date ISO Field',
      'description' => 'Test recurring on ISO date fields',
      'group' => 'Node recur',
    );
  }
  public function setUp() {
    parent::setUp();
    $this
      ->drupalPost('admin/structure/types/manage/repeating_node', array(
      'node_recur_enabled_node_type' => 1,
      'node_recur_date_field_node_type' => 'field_date_iso',
    ), t('Save content type'));
  }
  public function testNodeRecurContentCreateDateIsoRepeat() {
    $edit = array();
    $edit["title"] = 'Node Recur Node';
    $edit["field_date_iso[und][0][value][date]"] = '08/20/2025 - 15:45';
    $edit["field_date_simple[und][0][value][date]"] = '06/01/2025 - 15:45';
    $edit["field_date_unix[und][0][value][date]"] = '07/01/2025 - 15:45';
    $this
      ->drupalPost('node/add/repeating-node', $edit, t('Save'));
    $this
      ->assertText("has been created", 'Node has been created');
    $this
      ->clickLink(t('Repeat this repeating node'));
    $edit = array();
    $edit['field_date_iso[und][0][rrule][FREQ]'] = 'WEEKLY';
    $edit['field_date_iso[und][0][rrule][count_child]'] = 5;
    $this
      ->drupalPost(NULL, $edit, t('Generate'));
    $this
      ->assertText("This action cannot be undone. Please confirm that the dates above are accurate and that the repeating node information is correct. Editing this repeating node afterwards will not edit every repeating node generated here.", 'Warning message');
    $this
      ->assertText("August 27, 2025", 'August 27 2025 found');
    $this
      ->assertText("September 3, 2025", 'September 3 2025 found');
    $this
      ->assertText("September 10, 2025", 'September 10 2025 found');
    $this
      ->assertText("September 17, 2025", 'September 17 2025 found');
    $this
      ->assertText("September 24, 2025", 'September 24 2025 found');
    $this
      ->drupalPost(NULL, array(), t('Submit'));
    $this
      ->assertText('5 items have been generated.');
    $this
      ->drupalGet('node/1');
    $this
      ->assertText("August 20, 2025", 'August 20 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/2');
    $this
      ->assertText("August 27, 2025", 'August 27 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/3');
    $this
      ->assertText("September 3, 2025", 'September 3 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/4');
    $this
      ->assertText("September 10, 2025", 'September 10 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/5');
    $this
      ->assertText("September 17, 2025", 'September 17 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/6');
    $this
      ->assertText("September 24, 2025", 'September 24 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
  }
  public function testNodeRecurContentCreateDateIsoRepeatRequired() {

    // Date field
    $edit = array();
    $edit["instance[required]"] = 1;
    $this
      ->drupalPost('admin/structure/types/manage/repeating_node/fields/field_date_iso', $edit, t('Save settings'));
    $edit = array();
    $edit["title"] = 'Node Recur Node';
    $edit["field_date_iso[und][0][value][date]"] = '08/20/2025 - 15:45';
    $edit["field_date_simple[und][0][value][date]"] = '06/01/2025 - 15:45';
    $edit["field_date_unix[und][0][value][date]"] = '07/01/2025 - 15:45';
    $this
      ->drupalPost('node/add/repeating-node', $edit, t('Save'));
    $this
      ->assertText("has been created", 'Node has been created');
    $this
      ->clickLink(t('Repeat this repeating node'));
    $edit = array();
    $edit['field_date_iso[und][0][rrule][FREQ]'] = 'WEEKLY';
    $edit['field_date_iso[und][0][rrule][count_child]'] = 5;
    $this
      ->drupalPost(NULL, $edit, t('Generate'));
    $this
      ->assertText("This action cannot be undone. Please confirm that the dates above are accurate and that the repeating node information is correct. Editing this repeating node afterwards will not edit every repeating node generated here.", 'Warning message');
    $this
      ->assertText("August 27, 2025", 'August 27 2025 found');
    $this
      ->assertText("September 3, 2025", 'September 3 2025 found');
    $this
      ->assertText("September 10, 2025", 'September 10 2025 found');
    $this
      ->assertText("September 17, 2025", 'September 17 2025 found');
    $this
      ->assertText("September 24, 2025", 'September 24 2025 found');
    $this
      ->drupalPost(NULL, array(), t('Submit'));
    $this
      ->assertText('5 items have been generated.');
    $this
      ->drupalGet('node/1');
    $this
      ->assertText("August 20, 2025", 'August 20 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/2');
    $this
      ->assertText("August 27, 2025", 'August 27 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/3');
    $this
      ->assertText("September 3, 2025", 'September 3 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/4');
    $this
      ->assertText("September 10, 2025", 'September 10 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/5');
    $this
      ->assertText("September 17, 2025", 'September 17 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/6');
    $this
      ->assertText("September 24, 2025", 'September 24 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
  }

}

/**
 *  Unix Date field tests for  node recur
 *
 * @ingroup node_recur
 */
class NodeRecurDateUNIXTestCase extends NodeRecurTestCase {
  public static function getInfo() {
    return array(
      'name' => 'Test Date UNIX Field',
      'description' => 'Test recurring on UNIX date fields',
      'group' => 'Node recur',
    );
  }
  public function setUp() {
    parent::setUp();

    // Set up the conten type with the correct field
    $this
      ->drupalPost('admin/structure/types/manage/repeating_node', array(
      'node_recur_enabled_node_type' => 1,
      'node_recur_date_field_node_type' => 'field_date_unix',
    ), t('Save content type'));
  }
  public function testNodeRecurContentCreateDateUnixRepeat() {
    $edit = array();
    $edit["title"] = 'Node Recur Node';
    $edit["field_date_simple[und][0][value][date]"] = '06/01/2025 - 15:45';
    $edit["field_date_iso[und][0][value][date]"] = '07/01/2025 - 15:45';
    $edit["field_date_unix[und][0][value][date]"] = '08/21/2025 - 15:45';
    $this
      ->drupalPost('node/add/repeating-node', $edit, t('Save'));
    $this
      ->assertText("has been created", 'Node has been created');
    $this
      ->clickLink(t('Repeat this repeating node'));
    $edit = array();
    $edit['field_date_unix[und][0][rrule][FREQ]'] = 'WEEKLY';
    $edit['field_date_unix[und][0][rrule][count_child]'] = 5;
    $this
      ->drupalPost(NULL, $edit, t('Generate'));
    $this
      ->assertText("This action cannot be undone. Please confirm that the dates above are accurate and that the repeating node information is correct. Editing this repeating node afterwards will not edit every repeating node generated here.", 'Warning message');
    $this
      ->assertText("August 28, 2025", 'August 28 2025 found');
    $this
      ->assertText("September 4, 2025", 'September 4 2025 found');
    $this
      ->assertText("September 11, 2025", 'September 11 2025 found');
    $this
      ->assertText("September 18, 2025", 'September 18 2025 found');
    $this
      ->assertText("September 25, 2025", 'September 25 2025 found');
    $this
      ->drupalPost(NULL, array(), t('Submit'));
    $this
      ->assertText('5 items have been generated.');
    $this
      ->drupalGet('node/1');
    $this
      ->assertText("August 21, 2025", 'August 21 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/2');
    $this
      ->assertText("August 28, 2025", 'August 28 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/3');
    $this
      ->assertText("September 4, 2025", 'September 4 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/4');
    $this
      ->assertText("September 11, 2025", 'September 11 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/5');
    $this
      ->assertText("September 18, 2025", 'September 18 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/6');
    $this
      ->assertText("September 25, 2025", 'September 25 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
  }
  public function testNodeRecurContentCreateDateUnixRepeatRequired() {

    // Date field
    $edit = array();
    $edit["instance[required]"] = 1;
    $this
      ->drupalPost('admin/structure/types/manage/repeating_node/fields/field_date_unix', $edit, t('Save settings'));
    $edit = array();
    $edit["title"] = 'Node Recur Node';
    $edit["field_date_simple[und][0][value][date]"] = '06/01/2025 - 15:45';
    $edit["field_date_iso[und][0][value][date]"] = '07/01/2025 - 15:45';
    $edit["field_date_unix[und][0][value][date]"] = '08/21/2025 - 15:45';
    $this
      ->drupalPost('node/add/repeating-node', $edit, t('Save'));
    $this
      ->assertText("has been created", 'Node has been created');
    $this
      ->clickLink(t('Repeat this repeating node'));
    $edit = array();
    $edit['field_date_unix[und][0][rrule][FREQ]'] = 'WEEKLY';
    $edit['field_date_unix[und][0][rrule][count_child]'] = 5;
    $this
      ->drupalPost(NULL, $edit, t('Generate'));
    $this
      ->assertText("This action cannot be undone. Please confirm that the dates above are accurate and that the repeating node information is correct. Editing this repeating node afterwards will not edit every repeating node generated here.", 'Warning message');
    $this
      ->assertText("August 28, 2025", 'August 28 2025 found');
    $this
      ->assertText("September 4, 2025", 'September 4 2025 found');
    $this
      ->assertText("September 11, 2025", 'September 11 2025 found');
    $this
      ->assertText("September 18, 2025", 'September 18 2025 found');
    $this
      ->assertText("September 25, 2025", 'September 25 2025 found');
    $this
      ->drupalPost(NULL, array(), t('Submit'));
    $this
      ->assertText('5 items have been generated.');
    $this
      ->drupalGet('node/1');
    $this
      ->assertText("August 21, 2025", 'August 21 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/2');
    $this
      ->assertText("August 28, 2025", 'August 28 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/3');
    $this
      ->assertText("September 4, 2025", 'September 4 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/4');
    $this
      ->assertText("September 11, 2025", 'September 11 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/5');
    $this
      ->assertText("September 18, 2025", 'September 18 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/6');
    $this
      ->assertText("September 25, 2025", 'September 25 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
  }

}

/**
 *  Date field tests for  node recur
 *
 * @ingroup node_recur
 */
class NodeRecurDateTestCase extends NodeRecurTestCase {
  public static function getInfo() {
    return array(
      'name' => 'Test Date Field',
      'description' => 'Test recurring on "date" type fields',
      'group' => 'Node recur',
    );
  }
  public function setUp() {
    parent::setUp();
    $this
      ->drupalPost('admin/structure/types/manage/repeating_node', array(
      'node_recur_enabled_node_type' => 1,
      'node_recur_date_field_node_type' => 'field_date_simple',
    ), t('Save content type'));
  }
  public function testNodeRecurContentCreateDateRepeat() {
    $edit = array();
    $edit["title"] = 'Node Recur Node';
    $edit["field_date_simple[und][0][value][date]"] = '08/22/2025 - 15:45';
    $edit["field_date_iso[und][0][value][date]"] = '06/01/2025 - 15:45';
    $edit["field_date_unix[und][0][value][date]"] = '07/01/2025 - 15:45';
    $this
      ->drupalPost('node/add/repeating-node', $edit, t('Save'));
    $this
      ->assertText("has been created", 'Node has been created');
    $this
      ->clickLink(t('Repeat this repeating node'));
    $edit = array();
    $edit['field_date_simple[und][0][rrule][FREQ]'] = 'WEEKLY';
    $edit['field_date_simple[und][0][rrule][count_child]'] = 5;
    $this
      ->drupalPost(NULL, $edit, t('Generate'));
    $this
      ->assertText("This action cannot be undone. Please confirm that the dates above are accurate and that the repeating node information is correct. Editing this repeating node afterwards will not edit every repeating node generated here.", 'Warning message');
    $this
      ->assertText("August 29, 2025", 'August 29 2025 found');
    $this
      ->assertText("September 5, 2025", 'September 5 2025 found');
    $this
      ->assertText("September 12, 2025", 'September 12 2025 found');
    $this
      ->assertText("September 19, 2025", 'September 19 2025 found');
    $this
      ->assertText("September 26, 2025", 'September 26 2025 found');
    $this
      ->drupalPost(NULL, array(), t('Submit'));
    $this
      ->assertText('5 items have been generated.');
    $this
      ->drupalGet('node/1');
    $this
      ->assertText("August 22, 2025", 'August 22 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/2');
    $this
      ->assertText("August 29, 2025", 'August 29 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/3');
    $this
      ->assertText("September 5, 2025", 'September 5 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/4');
    $this
      ->assertText("September 12, 2025", 'September 12 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/5');
    $this
      ->assertText("September 19, 2025", 'September 19 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/6');
    $this
      ->assertText("September 26, 2025", 'September 26 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
  }
  public function testNodeRecurContentCreateDateRepeatRequired() {

    // Date field
    $edit = array();
    $edit["instance[required]"] = 1;
    $this
      ->drupalPost('admin/structure/types/manage/repeating_node/fields/field_date_simple', $edit, t('Save settings'));
    $edit = array();
    $edit["title"] = 'Node Recur Node';
    $edit["field_date_simple[und][0][value][date]"] = '08/22/2025 - 15:45';
    $edit["field_date_iso[und][0][value][date]"] = '06/01/2025 - 15:45';
    $edit["field_date_unix[und][0][value][date]"] = '07/01/2025 - 15:45';
    $this
      ->drupalPost('node/add/repeating-node', $edit, t('Save'));
    $this
      ->assertText("has been created", 'Node has been created');
    $this
      ->clickLink(t('Repeat this repeating node'));
    $edit = array();
    $edit['field_date_simple[und][0][rrule][FREQ]'] = 'WEEKLY';
    $edit['field_date_simple[und][0][rrule][count_child]'] = 5;
    $this
      ->drupalPost(NULL, $edit, t('Generate'));
    $this
      ->assertText("This action cannot be undone. Please confirm that the dates above are accurate and that the repeating node information is correct. Editing this repeating node afterwards will not edit every repeating node generated here.", 'Warning message');
    $this
      ->assertText("August 29, 2025", 'August 29 2025 found');
    $this
      ->assertText("September 5, 2025", 'September 5 2025 found');
    $this
      ->assertText("September 12, 2025", 'September 12 2025 found');
    $this
      ->assertText("September 19, 2025", 'September 19 2025 found');
    $this
      ->assertText("September 26, 2025", 'September 26 2025 found');
    $this
      ->drupalPost(NULL, array(), t('Submit'));
    $this
      ->assertText('5 items have been generated.');
    $this
      ->drupalGet('node/1');
    $this
      ->assertText("August 22, 2025", 'August 22 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/2');
    $this
      ->assertText("August 29, 2025", 'August 29 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/3');
    $this
      ->assertText("September 5, 2025", 'September 5 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/4');
    $this
      ->assertText("September 12, 2025", 'September 12 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/5');
    $this
      ->assertText("September 19, 2025", 'September 19 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/6');
    $this
      ->assertText("September 26, 2025", 'September 26 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
  }

}

/**
 *  End Date field tests for  node recur
 *
 * @ingroup node_recur
 */
class NodeRecurEndDateTestCase extends NodeRecurTestCase {
  public static function getInfo() {
    return array(
      'name' => 'Test End Date Field',
      'description' => 'Test recurring on "date" type fields with end dates',
      'group' => 'Node recur',
    );
  }
  public function setUp() {
    parent::setUp();
    $this
      ->drupalPost('admin/structure/types/manage/repeating_node', array(
      'node_recur_enabled_node_type' => 1,
      'node_recur_date_field_node_type' => 'field_date_range',
    ), t('Save content type'));
  }
  public function testNodeRecurContentCreateEndDateRepeat() {
    $edit = array();
    $edit["title"] = 'Node Recur Node';
    $edit["field_date_simple[und][0][value][date]"] = '05/01/2025 - 15:45';
    $edit["field_date_iso[und][0][value][date]"] = '06/01/2025 - 15:45';
    $edit["field_date_unix[und][0][value][date]"] = '07/01/2025 - 15:45';
    $edit["field_date_range[und][0][value][date]"] = '08/20/2025 - 09:00';
    $edit["field_date_range[und][0][value2][date]"] = '08/20/2025 - 15:45';
    $this
      ->drupalPost('node/add/repeating-node', $edit, t('Save'));
    $this
      ->assertText("has been created", 'Node has been created');
    $this
      ->clickLink(t('Repeat this repeating node'));
    $edit = array();
    $edit['field_date_range[und][0][rrule][FREQ]'] = 'WEEKLY';
    $edit['field_date_range[und][0][rrule][count_child]'] = 5;
    $this
      ->drupalPost(NULL, $edit, t('Generate'));
    $this
      ->assertText("This action cannot be undone. Please confirm that the dates above are accurate and that the repeating node information is correct. Editing this repeating node afterwards will not edit every repeating node generated here.", 'Warning message');
    $this
      ->assertText("August 27, 2025 - 09:00 to 15:45", 'August 27 2025 found');
    $this
      ->assertText("September 3, 2025 - 09:00 to 15:45", 'September 3 2025 found');
    $this
      ->assertText("September 10, 2025 - 09:00 to 15:45", 'September 10 2025 found');
    $this
      ->assertText("September 17, 2025 - 09:00 to 15:45", 'September 17 2025 found');
    $this
      ->assertText("September 24, 2025 - 09:00 to 15:45", 'September 24 2025 found');
    $this
      ->drupalPost(NULL, array(), t('Submit'));
    $this
      ->assertText('5 items have been generated.');
    $this
      ->drupalGet('node/1');
    $this
      ->assertText("August 20, 2025 - 09:00 to 15:45", 'August 20 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/2');
    $this
      ->assertText("August 27, 2025 - 09:00 to 15:45", 'August 27 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/3');
    $this
      ->assertText("September 3, 2025 - 09:00 to 15:45", 'September 3 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/4');
    $this
      ->assertText("September 10, 2025 - 09:00 to 15:45", 'September 10 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/5');
    $this
      ->assertText("September 17, 2025 - 09:00 to 15:45", 'September 17 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/6');
    $this
      ->assertText("September 24, 2025 - 09:00 to 15:45", 'September 24 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
  }
  public function testNodeRecurContentCreateEndDateRequiredRepeat() {

    // Date field
    $edit = array();
    $edit["instance[required]"] = 1;
    $this
      ->drupalPost('admin/structure/types/manage/repeating_node/fields/field_date_range', $edit, t('Save settings'));
    $edit = array();
    $edit["title"] = 'Node Recur Node';
    $edit["field_date_simple[und][0][value][date]"] = '05/01/2025 - 15:45';
    $edit["field_date_iso[und][0][value][date]"] = '06/01/2025 - 15:45';
    $edit["field_date_unix[und][0][value][date]"] = '07/01/2025 - 15:45';
    $edit["field_date_range[und][0][value][date]"] = '08/20/2025 - 09:00';
    $edit["field_date_range[und][0][value2][date]"] = '08/20/2025 - 15:45';
    $this
      ->drupalPost('node/add/repeating-node', $edit, t('Save'));
    $this
      ->assertText("has been created", 'Node has been created');
    $this
      ->clickLink(t('Repeat this repeating node'));
    $edit = array();
    $edit['field_date_range[und][0][rrule][FREQ]'] = 'WEEKLY';
    $edit['field_date_range[und][0][rrule][count_child]'] = 5;
    $this
      ->drupalPost(NULL, $edit, t('Generate'));
    $this
      ->assertText("This action cannot be undone. Please confirm that the dates above are accurate and that the repeating node information is correct. Editing this repeating node afterwards will not edit every repeating node generated here.", 'Warning message');
    $this
      ->assertText("August 27, 2025 - 09:00 to 15:45", 'August 27 2025 found');
    $this
      ->assertText("September 3, 2025 - 09:00 to 15:45", 'September 3 2025 found');
    $this
      ->assertText("September 10, 2025 - 09:00 to 15:45", 'September 10 2025 found');
    $this
      ->assertText("September 17, 2025 - 09:00 to 15:45", 'September 17 2025 found');
    $this
      ->assertText("September 24, 2025 - 09:00 to 15:45", 'September 24 2025 found');
    $this
      ->drupalPost(NULL, array(), t('Submit'));
    $this
      ->assertText('5 items have been generated.');
    $this
      ->drupalGet('node/1');
    $this
      ->assertText("August 20, 2025 - 09:00 to 15:45", 'August 20 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/2');
    $this
      ->assertText("August 27, 2025 - 09:00 to 15:45", 'August 27 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/3');
    $this
      ->assertText("September 3, 2025 - 09:00 to 15:45", 'September 3 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/4');
    $this
      ->assertText("September 10, 2025 - 09:00 to 15:45", 'September 10 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/5');
    $this
      ->assertText("September 17, 2025 - 09:00 to 15:45", 'September 17 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/6');
    $this
      ->assertText("September 24, 2025 - 09:00 to 15:45", 'September 24 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
  }

}

/**
 *  Weekend field tests for  node recur
 *
 * @ingroup node_recur
 */
class NodeRecurEndDateWeekendTestCase extends NodeRecurTestCase {
  public static function getInfo() {
    return array(
      'name' => 'Test Date Field Weekend Excludes',
      'description' => 'Test recurring on "date" type fields with Exclude weekend checked/unchecked',
      'group' => 'Node recur',
    );
  }
  public function setUp() {
    parent::setUp();
    $this
      ->drupalPost('admin/structure/types/manage/repeating_node', array(
      'node_recur_enabled_node_type' => 1,
      'node_recur_date_field_node_type' => 'field_date_simple',
    ), t('Save content type'));
  }
  public function testNodeRecurContentCreateDateRepeatExcludeWeekendsTrue() {
    $edit = array();
    $edit["title"] = 'Node Recur Node';
    $edit["field_date_simple[und][0][value][date]"] = '08/20/2025 - 15:45';
    $edit["field_date_iso[und][0][value][date]"] = '06/01/2025 - 15:45';
    $edit["field_date_unix[und][0][value][date]"] = '07/01/2025 - 15:45';
    $this
      ->drupalPost('node/add/repeating-node', $edit, t('Save'));
    $this
      ->assertText("has been created", 'Node has been created');
    $this
      ->clickLink(t('Repeat this repeating node'));
    $edit = array();
    $edit['field_date_simple[und][0][rrule][FREQ]'] = 'DAILY';
    $edit['field_date_simple[und][0][rrule][count_child]'] = 7;
    $this
      ->drupalPost(NULL, $edit, t('Generate'));
    $this
      ->assertText("This action cannot be undone. Please confirm that the dates above are accurate and that the repeating node information is correct. Editing this repeating node afterwards will not edit every repeating node generated here.", 'Warning message');
    $this
      ->assertText("August 21, 2025 - 15:45", 'August 21 2025 found');
    $this
      ->assertText("August 22, 2025 - 15:45", 'August 22 2025 found');
    $this
      ->assertNoText("August 23, 2025 - 15:45", 'August 23 2025 NOT found');
    $this
      ->assertNoText("August 24, 2025 - 15:45", 'August 24 2025 NOT found');
    $this
      ->assertText("August 25, 2025 - 15:45", 'August 25 2025 found');
    $this
      ->assertText("August 26, 2025 - 15:45", 'August 26 2025 found');
    $this
      ->assertText("August 27, 2025 - 15:45", 'August 27 2025 found');
    $this
      ->assertText("August 28, 2025 - 15:45", 'August 28 2025 found');
    $this
      ->assertText("August 29, 2025 - 15:45", 'August 29 2025 found');
    $this
      ->drupalPost(NULL, array(), t('Submit'));
    $this
      ->assertText('7 items have been generated.');
    $this
      ->drupalGet('node/1');
    $this
      ->assertText("August 20, 2025", 'August 20 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/2');
    $this
      ->assertText("August 21, 2025", 'August 21 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/3');
    $this
      ->assertText("August 22, 2025", 'August 22 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/4');
    $this
      ->assertText("August 25, 2025", 'August 25 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/5');
    $this
      ->assertText("August 26, 2025", 'August 26 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/6');
    $this
      ->assertText("August 27, 2025", 'August 27 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/7');
    $this
      ->assertText("August 28, 2025", 'August 28 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/8');
    $this
      ->assertText("August 29, 2025", 'August 29 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
  }
  public function testNodeRecurContentCreateDateRepeatExcludeWeekendsFalse() {
    $edit = array();
    $edit["title"] = 'Node Recur Node';
    $edit["field_date_simple[und][0][value][date]"] = '08/20/2025 - 15:45';
    $edit["field_date_iso[und][0][value][date]"] = '06/01/2025 - 15:45';
    $edit["field_date_unix[und][0][value][date]"] = '07/01/2025 - 15:45';
    $this
      ->drupalPost('node/add/repeating-node', $edit, t('Save'));
    $this
      ->assertText("has been created", 'Node has been created');
    $this
      ->clickLink(t('Repeat this repeating node'));
    $edit = array();
    $edit['field_date_simple[und][0][rrule][FREQ]'] = 'DAILY';
    $edit['field_date_simple[und][0][rrule][count_child]'] = 7;
    $edit['field_date_simple[exclude_weekends]'] = FALSE;
    $this
      ->drupalPost(NULL, $edit, t('Generate'));
    $this
      ->assertText("This action cannot be undone. Please confirm that the dates above are accurate and that the repeating node information is correct. Editing this repeating node afterwards will not edit every repeating node generated here.", 'Warning message');
    $this
      ->assertText("August 21, 2025 - 15:45", 'August 21 2025 found');
    $this
      ->assertText("August 22, 2025 - 15:45", 'August 22 2025 found');
    $this
      ->assertText("August 23, 2025 - 15:45", 'August 23 2025 found');
    $this
      ->assertText("August 24, 2025 - 15:45", 'August 24 2025 found');
    $this
      ->assertText("August 25, 2025 - 15:45", 'August 25 2025 found');
    $this
      ->assertText("August 26, 2025 - 15:45", 'August 26 2025 found');
    $this
      ->assertText("August 27, 2025 - 15:45", 'August 27 2025 found');
    $this
      ->assertNoText("August 28, 2025 - 15:45", 'August 28 2025 NOT found');
    $this
      ->assertNoText("August 29, 2025 - 15:45", 'August 29 2025 NOT found');
    $this
      ->drupalPost(NULL, array(), t('Submit'));
    $this
      ->assertText('7 items have been generated.');
    $this
      ->drupalGet('node/1');
    $this
      ->assertText("August 20, 2025", 'August 20 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/2');
    $this
      ->assertText("August 21, 2025", 'August 21 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/3');
    $this
      ->assertText("August 22, 2025", 'August 22 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/4');
    $this
      ->assertText("August 23, 2025", 'August 23 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/5');
    $this
      ->assertText("August 24, 2025", 'August 24 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/6');
    $this
      ->assertText("August 25, 2025", 'August 25 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/7');
    $this
      ->assertText("August 26, 2025", 'August 26 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
    $this
      ->drupalGet('node/8');
    $this
      ->assertText("August 27, 2025", 'August 27 2025 found');
    $this
      ->assertText('June 1, 2025 - 15:45', 'June 01 2025 found');
    $this
      ->assertText('July 1, 2025 - 15:45', 'July 01 2025 found');
  }

}

/**
 *  Weekend field tests for  node recur
 *
 * @ingroup node_recur
 */
class NodeRecurExtendedDatesTestCase extends NodeRecurTestCase {
  public static function getInfo() {
    return array(
      'name' => 'Test DST and longer create range',
      'description' => 'Test longer date ranges crossing daylight savings time',
      'group' => 'Node recur',
    );
  }
  public function setUp() {
    parent::setUp();
    $this
      ->drupalPost('admin/structure/types/manage/repeating_node', array(
      'node_recur_enabled_node_type' => 1,
      'node_recur_date_field_node_type' => 'field_date_range',
    ), t('Save content type'));
  }
  public function testNodeRecurContentCreateDateRepeatExtended() {
    $edit = array();
    $edit["title"] = 'Node Recur Node';
    $edit["field_date_simple[und][0][value][date]"] = '05/01/2025 - 15:45';
    $edit["field_date_iso[und][0][value][date]"] = '06/01/2025 - 15:45';
    $edit["field_date_unix[und][0][value][date]"] = '07/01/2025 - 15:45';
    $edit["field_date_range[und][0][value][date]"] = '01/20/2025 - 09:45';
    $edit["field_date_range[und][0][value2][date]"] = '01/20/2025 - 15:45';
    $this
      ->drupalPost('node/add/repeating-node', $edit, t('Save'));
    $this
      ->assertText("has been created", 'Node has been created');
    $this
      ->clickLink(t('Repeat this repeating node'));
    $edit = array();
    $edit['field_date_range[und][0][rrule][FREQ]'] = 'MONTHLY';
    $edit['field_date_range[und][0][rrule][range_of_repeat]'] = 'UNTIL';
    $edit['field_date_range[und][0][rrule][until_child][datetime][date]'] = '11/30/2030';
    $edit['field_date_range[und][0][rrule][monthly][BYMONTHDAY_BYMONTH_child][BYMONTHDAY]'] = 10;
    $edit['field_date_range[exclude_weekends]'] = FALSE;
    $this
      ->drupalPost(NULL, $edit, t('Generate'));
    $this
      ->assertText("This action cannot be undone. Please confirm that the dates above are accurate and that the repeating node information is correct. Editing this repeating node afterwards will not edit every repeating node generated here.", 'Warning message');
    $this
      ->assertNoText("January 10, 2025 - 09:45 to 15:45", 'January 10 2025 NOT found');
    $this
      ->assertText("February 10, 2025 - 09:45 to 15:45", 'February 10 2025 found');
    $this
      ->assertText("March 10, 2025 - 09:45 to 15:45", 'March 10 2025 found');
    $this
      ->assertText("April 10, 2025 - 09:45 to 15:45", 'April 10 2025 found');
    $this
      ->assertText("May 10, 2025 - 09:45 to 15:45", 'May 10 2025 found');
    $this
      ->assertText("June 10, 2025 - 09:45 to 15:45", 'June 10 2025 found');
    $this
      ->assertText("July 10, 2025 - 09:45 to 15:45", 'July 10 2025 found');
    $this
      ->assertText("August 10, 2025 - 09:45 to 15:45", 'August 10 2025 found');
    $this
      ->assertText("September 10, 2025 - 09:45 to 15:45", 'September 10 2025 found');
    $this
      ->assertText("October 10, 2025 - 09:45 to 15:45", 'October 10 2025 found');
    $this
      ->assertText("November 10, 2030 - 09:45 to 15:45", 'November 10 2030 found');
    $this
      ->drupalPost(NULL, array(), t('Submit'));
    $this
      ->assertText('items have been generated.');
  }

}

Classes

Namesort descending Description
NodeRecurAdminTestCase Verify admin screens work as expected
NodeRecurDateISOTestCase ISO Date field tests for node recur
NodeRecurDateTestCase Date field tests for node recur
NodeRecurDateUNIXTestCase Unix Date field tests for node recur
NodeRecurEndDateTestCase End Date field tests for node recur
NodeRecurEndDateWeekendTestCase Weekend field tests for node recur
NodeRecurExtendedDatesTestCase Weekend field tests for node recur
NodeRecurTestCase Functionality tests for node recur