class SchedulerFunctionalTest in Scheduler 7
Tests the scheduler interface.
Hierarchy
- class \DrupalTestCase
- class \DrupalWebTestCase
- class \SchedulerTestBase
- class \SchedulerFunctionalTest
- class \SchedulerTestBase
- class \DrupalWebTestCase
Expanded class hierarchy of SchedulerFunctionalTest
File
- tests/
scheduler.test, line 190 - Scheduler module test case file.
View source
class SchedulerFunctionalTest extends SchedulerTestBase {
/**
* {@inheritdoc}
*/
public static function getInfo() {
return array(
'name' => 'Scheduler functionality',
'description' => 'Tests the Scheduler functions which do not require other modules.',
'group' => 'Scheduler',
);
}
/**
* {@inheritdoc}
*/
public function setUp() {
parent::setUp('scheduler', 'dblog');
parent::commonSettings();
}
/**
* Tests basic scheduling of content.
*
* @param bool $scheduler_cron_only
* TRUE to only run Scheduler cron, FALSE to run default full Drupal cron.
*/
public function testBasicScheduling($scheduler_cron_only = FALSE) {
// Create node values. Set time to one hour in the future.
$edit = array(
'publish_on' => format_date(time() + 3600, 'custom', 'Y-m-d H:i:s'),
'status' => 1,
'promote' => 1,
);
// Test scheduled publishing.
$this
->helpTestScheduler($edit, $scheduler_cron_only);
// Test scheduled unpublishing.
$edit['unpublish_on'] = $edit['publish_on'];
unset($edit['publish_on']);
$this
->helpTestScheduler($edit, $scheduler_cron_only);
}
/**
* Tests scheduler when not all cron tasks are run during cron.
*
* Verify that we can set variable 'scheduler_cache_clear_all' so the page
* cache is still cleared.
*
* @uses testScheduler()
*/
public function testBasicSchedulingWithOnlySchedulerCron() {
// Cache pages for anonymous users.
variable_set('cache', 1);
// Instruct scheduler to clear caches itself, instead of relying on
// system_cron.
variable_set('scheduler_cache_clear_all', 1);
// Instruct the helper method to run only the scheduler cron.
$scheduler_cron_only = TRUE;
$this
->testBasicScheduling($scheduler_cron_only);
}
/**
* Test the different options for past publication dates.
*/
public function testPastDates() {
// Log in.
$this
->drupalLogin($this->adminUser);
// Create an unpublished page node.
$node = $this
->drupalCreateNode(array(
'type' => 'page',
'status' => FALSE,
));
// Test the default behavior: an error message should be shown when the user
// enters a publication date that is in the past.
$edit = array(
'title' => $this
->randomName(),
'publish_on' => format_date(strtotime('-1 day', REQUEST_TIME), 'custom', 'Y-m-d H:i:s'),
);
$this
->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
$this
->assertText("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');
$this
->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
$this
->assertNoText("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
->assertText(sprintf('%s %s has been updated.', 'Basic page', $edit['title']), 'The node is saved successfully when the publication date is in the past and the "publish" behavior is chosen.');
// Reload the changed node and check that it is published.
$node = node_load($node->nid, NULL, TRUE);
$this
->assertTrue($node->status, 'The node has been published immediately when the publication date is in the past and the "publish" behavior is chosen.');
// 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');
$this
->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
$this
->assertNoText("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
->assertText(sprintf('%s %s has been updated.', 'Basic page', check_plain($edit['title'])), 'The node is saved successfully when the publication date is in the past and the "schedule" behavior is chosen.');
$this
->assertText(sprintf('This post is unpublished and will be published %s.', $edit['publish_on']), 'The node is scheduled to be published when the publication date is in the past and the "schedule" behavior is chosen.');
// Reload the node and check that it is unpublished but scheduled correctly.
$node = node_load($node->nid, NULL, TRUE);
$this
->assertFalse($node->status, 'The node has been unpublished when the publication date is in the past and the "schedule" behavior is chosen.');
$this
->assertEqual(format_date($node->publish_on, 'custom', 'Y-m-d H:i:s'), $edit['publish_on'], 'The node is scheduled for the required date');
// Simulate a cron run and check that the node is published.
scheduler_cron();
$node = node_load($node->nid, NULL, TRUE);
$this
->assertTrue($node->status, 'The node with publication date in the past and the "schedule" behavior has now been published by cron.');
}
/**
* Tests the creation of new revisions on scheduling.
*/
public function testRevisioning() {
// Create a scheduled node that is not automatically revisioned.
$created = strtotime('-2 day', REQUEST_TIME);
$settings = array(
'revision' => 0,
'created' => $created,
);
$node = $this
->drupalCreateNode($settings);
// First test scheduled publication with revisioning disabled.
$node = $this
->schedule($node);
$this
->assertRevisionCount($node->nid, 1, 'No new revision was created when a node was published with revisioning disabled.');
// Test scheduled unpublication.
$node = $this
->schedule($node, 'unpublish');
$this
->assertRevisionCount($node->nid, 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);
// Test scheduled publication with revisioning enabled.
$node = $this
->schedule($node);
$this
->assertRevisionCount($node->nid, 2, 'A new revision was created when revisioning is enabled.');
$expected_message = t('Node published by Scheduler on @now. Previous creation date was @date.', array(
'@now' => format_date(REQUEST_TIME, 'short'),
'@date' => format_date($created, 'short'),
));
$this
->assertRevisionLogMessage($node->nid, $expected_message, 'The correct message was found in the node revision log after scheduled publishing.');
// Test scheduled unpublication with revisioning enabled.
$node = $this
->schedule($node, 'unpublish');
$this
->assertRevisionCount($node->nid, 3, 'A new revision was created when a node was unpublished with revisioning enabled.');
$expected_message = t('Node unpublished by Scheduler on @now. Previous change date was @date.', array(
'@now' => format_date(REQUEST_TIME, 'short'),
'@date' => format_date(REQUEST_TIME, 'short'),
));
$this
->assertRevisionLogMessage($node->nid, $expected_message, 'The correct message was found in the node revision log after scheduled unpublishing.');
}
/**
* Tests if options can both be displayed as extra fields and vertical tabs.
*/
public function testExtraFields() {
$this
->drupalLogin($this->adminUser);
// Test if the options are shown as vertical tabs by default.
$this
->drupalGet('node/add/page');
$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);
$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);
$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.');
}
/**
* Tests creating and editing nodes with required scheduling enabled.
*/
public function testRequiredScheduling() {
$this
->drupalLogin($this->adminUser);
// Define test scenarios with expected results.
$test_cases = array(
// A. Test scenarios that require scheduled publishing.
// The 1-10 numbering used below matches the test cases described in
// http://drupal.org/node/1198788#comment-7816119
//
// 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 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 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 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 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 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);
// To assist viewing and analysing the generated test result pages create
// a text string showing all the test case parameters.
$title_data = array();
foreach ($test_case as $key => $value) {
if ($key != 'message') {
$title_data[] = $key . ' = ' . $value;
}
}
$title = implode(', ', $title_data);
// If the test case requires editing a node, we need to create one first.
if ($test_case['operation'] == 'edit') {
$options = array(
'title' => $title,
'type' => 'page',
'status' => $test_case['status'],
'publish_on' => !empty($test_case['scheduled']) ? strtotime('+ 1 day', REQUEST_TIME) : 0,
);
$node = $this
->drupalCreateNode($options);
}
// Make sure the publication date fields are empty so we can check if they
// throw form validation errors when they are required.
$edit = array(
'title' => $title,
'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':
$this
->assertText(sprintf('%s field is required.', ucfirst($test_case['required']) . ' on'), $test_case['id'] . '. ' . $test_case['message']);
break;
case 'not required':
$op = $test_case['operation'] == 'add' ? 'created' : 'updated';
$this
->assertText(sprintf('%s %s has been %s.', 'Basic page', $title, $op), $test_case['id'] . '. ' . $test_case['message']);
break;
}
}
}
/**
* Test that Scheduler does not interfere with non-scheduler-enabled nodes.
*/
public function testNonEnabledType() {
// Create a 'Non-enabled' content type.
$this
->drupalCreateContentType(array(
'type' => 'story',
'name' => t('Story Book'),
));
// Create a user who can add and edit story content, and log in.
$this
->drupalLogin($this
->drupalCreateUser(array(
'access content overview',
'access site reports',
'create story content',
'delete own story content',
'edit own story content',
'schedule publishing of nodes',
'view scheduled content',
'view own unpublished content',
)));
foreach ($this
->dataNonEnabledType() as $data) {
list($id, $description, $publishing_enabled, $unpublishing_enabled) = $data;
// The first test case specifically checks the behavior of the default
// unchanged settings, so only change these settings for later runs.
if ($id > 0) {
variable_set('scheduler_publish_enable_story', $publishing_enabled);
variable_set('scheduler_unpublish_enable_story', $unpublishing_enabled);
}
// Create info string to show what combinations are being tested.
$info = 'Publishing ' . ($publishing_enabled ? 'enabled' : 'not enabled') . ', Unpublishing ' . ($unpublishing_enabled ? 'enabled' : 'not enabled') . ', ' . $description;
// Check that the field(s) are displayed only for the correct settings.
$title = $id . 'a - ' . $info;
$this
->drupalGet('node/add/story');
if ($publishing_enabled) {
$this
->assertFieldByName('publish_on', '', "The Publish-on field is shown: {$title}");
}
else {
$this
->assertNoFieldByName('publish_on', '', "The Publish-on field is not shown: {$title}");
}
if ($unpublishing_enabled) {
$this
->assertFieldByName('unpublish_on', '', "The Unpublish-on field is shown: {$title}");
}
else {
$this
->assertNoFieldByName('unpublish_on', '', "The Unpublish-on field is not shown: {$title}");
}
// When publishing and/or unpublishing are not enabled but the 'required'
// setting remains on, the node must be able to be saved without a date.
variable_set('scheduler_publish_required_story', !$publishing_enabled);
variable_set('scheduler_unpublish_required_story', !$unpublishing_enabled);
$this
->drupalPost('node/add/story', array(
'title' => $title,
), t('Save'));
// Check that the node has saved OK.
$string = sprintf('%s %s has been created.', 'Story Book', check_plain($title));
$this
->assertText($string, "Node added: {$title}");
// Check that the node can be editted and saved again.
$node = $this
->drupalGetNodeByTitle($title);
if ($node) {
$this
->drupalPost('node/' . $node->nid . '/edit', array(), t('Save'));
$string = sprintf('%s %s has been updated.', 'Story Book', check_plain($title));
$this
->assertText($string, "Node updated: {$title}");
}
else {
$this
->fail("No node to edit: {$title}");
}
// Create an unpublished node with a publishing date, which mimics what
// could be done by a third-party module, or a by-product of the node type
// being enabled for publishing then being disabled before publishing.
$title = $id . 'b - ' . $info;
$edit = array(
'title' => $title,
'status' => FALSE,
'type' => 'story',
'publish_on' => strtotime('- 2 min', REQUEST_TIME),
);
$node = $this
->drupalCreateNode($edit);
// Run cron and display the dblog.
$this
->cronRun();
$this
->drupalGet('admin/reports/dblog');
// Reload the node.
$node = node_load($node->nid, NULL, TRUE);
// Check if the node has been published or remains unpublished.
if ($publishing_enabled) {
$this
->assertTrue($node->status, 'The unpublished node has been published: ' . $title);
}
else {
$this
->assertFalse($node->status, 'The unpublished node remains unpublished: ' . $title);
}
// Do the same for unpublishing.
$title = $id . 'c - ' . $info;
$edit = array(
'title' => $title,
'status' => TRUE,
'type' => 'story',
'unpublish_on' => strtotime('- 2 min', REQUEST_TIME),
);
$node = $this
->drupalCreateNode($edit);
// Run cron and display the dblog.
$this
->cronRun();
$this
->drupalGet('admin/reports/dblog');
// Reload the node.
$node = node_load($node->nid, NULL, TRUE);
// Check if the node has been unpublished or remains published.
if ($unpublishing_enabled) {
$this
->assertFalse($node->status, 'The published node has been unpublished: ' . $title);
}
else {
$this
->assertTrue($node->status, 'The published node remains published: ' . $title);
}
// Display the full content list and the scheduled list. Calls to these
// pages are for information and debug only. They could be removed.
$this
->drupalGet('admin/content');
$this
->drupalGet('admin/content/scheduler');
}
}
/**
* Provides data for testNonEnabledType().
*
* @return array
* Each item in the test data array has the follow elements:
* id - (in) a sequential id for use in node titles
* description - (string) describing the scenario being checked
* publishing_enabled - (bool) whether publishing is enabled
* unpublishing_enabled - (bool) whether unpublishing is enabled
*/
public function dataNonEnabledType() {
$data = array(
// By default check that the scheduler date fields are not displayed.
0 => array(
0,
'Default',
FALSE,
FALSE,
),
// Explicitly disable this content type for both settings.
1 => array(
1,
'Disabling both settings',
FALSE,
FALSE,
),
// Turn on scheduled publishing only.
2 => array(
2,
'Enabling publishing only',
TRUE,
FALSE,
),
// Turn on scheduled unpublishing only.
3 => array(
3,
'Enabling unpublishing only',
FALSE,
TRUE,
),
// For completeness turn on bothbscheduled publishing and unpublishing.
4 => array(
4,
'Enabling both publishing and unpublishing',
TRUE,
TRUE,
),
);
// Use unset($data[n]) to remove a temporarily unwanted item, use
// return array($data[n]) to selectively test just one item, or have the
// default return $data to test everything.
return $data;
}
/**
* Tests the validation when editing a node.
*
* The 'required' checks and 'dates in the past' checks are handled in other
* tests. This test checks validation when the two fields interact.
*/
public function testValidationDuringEdit() {
$this
->drupalLogin($this->adminUser);
// Set unpublishing to be required.
variable_set('scheduler_unpublish_required_page', TRUE);
// Create an unpublished page node, then edit the node and check that if a
// publish-on date is entered then an unpublish-on date is also needed.
$node = $this
->drupalCreateNode(array(
'type' => 'page',
'status' => FALSE,
));
$edit = array(
'publish_on' => date('Y-m-d H:i:s', strtotime('+1 day', REQUEST_TIME)),
);
$this
->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
$this
->assertText("If you set a 'publish-on' date then you must also set an 'unpublish-on' date.", 'Validation prevents entering a publish-on date with no unpublish-on date if unpublishing is required.');
// Create an unpublished page node, then edit the node and check that if the
// status is changed to published, then an unpublish-on date is also needed.
$node = $this
->drupalCreateNode(array(
'type' => 'page',
'status' => FALSE,
));
$edit = array(
'status' => TRUE,
);
$this
->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
$this
->assertText("To publish this node you must also set an 'unpublish-on' date.", 'Validation prevents publishing the node directly without an unpublish-on date if unpublishing is required.');
// Create an unpublished page node, edit the node and check that if both
// dates are entered then the unpublish date is later than the publish date.
$node = $this
->drupalCreateNode(array(
'type' => 'page',
'status' => FALSE,
));
$edit = array(
'publish_on' => date('Y-m-d H:i:s', strtotime('+2 day', REQUEST_TIME)),
'unpublish_on' => date('Y-m-d H:i:s', strtotime('+1 day', REQUEST_TIME)),
);
$this
->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
$this
->assertText("The 'unpublish on' date must be later than the 'publish on' date.", 'Validation prevents entering an unpublish-on date which is earlier than the publish-on date.');
}
/**
* Tests the deletion of a scheduled node.
*/
public function testScheduledNodeDelete() {
// Log in.
$this
->drupalLogin($this->adminUser);
// 1. Test if it is possible to delete a node that does not have a
// publication date set, when scheduled publishing is required, and likewise
// for unpublishing.
// @see https://drupal.org/node/1614880
//
// Create a published and an unpublished node, both without scheduling.
$published_node = $this
->drupalCreateNode(array(
'type' => 'page',
'status' => 1,
));
$unpublished_node = $this
->drupalCreateNode(array(
'type' => 'page',
'status' => 0,
));
// Make scheduled publishing and unpublishing required.
variable_set('scheduler_publish_required_page', TRUE);
variable_set('scheduler_unpublish_required_page', TRUE);
// Check that deleting the nodes does not throw form validation errors.
// The text 'error message' is used in a header h2 html tag which is
// normally made hidden from browsers but will be in the page source.
// It is also good when testing for the absense of something to also test
// for the presence of text, hence the second assertion for each check.
$this
->drupalPost('node/' . $published_node->nid . '/edit', array(), t('Delete'));
$this
->assertNoText('Error message', 'No error messages are shown when trying to delete a published node with no scheduling information.');
$this
->assertText('Are you sure you want to delete', 'The deletion warning message is shown immediately when trying to delete a published node with no scheduling information.');
$this
->drupalPost('node/' . $unpublished_node->nid . '/edit', array(), t('Delete'));
$this
->assertNoText('Error message', 'No error messages are shown when trying to delete an unpublished node with no scheduling information.');
$this
->assertText('Are you sure you want to delete', 'The deletion warning message is shown immediately when trying to delete an unpublished node with no scheduling information.');
// 2. Test that nodes can be deleted with no validation errors if the dates
// are in the past.
// @see http://drupal.org/node/2627370
//
// Create nodes with publish_on and unpublish_on dates in the past.
$values = array(
'type' => 'page',
'status' => TRUE,
'unpublish_on' => strtotime('- 2 day', REQUEST_TIME),
);
$published_node_past = $this
->drupalCreateNode($values);
$values = array(
'type' => 'page',
'status' => FALSE,
'publish_on' => strtotime('- 2 day', REQUEST_TIME),
);
$unpublished_node_past = $this
->drupalCreateNode($values);
// Attempt to delete the published node and check for no validation error.
$this
->drupalPost('node/' . $published_node_past->nid . '/edit', array(), t('Delete'));
$this
->assertNoText('Error message', 'No error messages are shown when trying to delete a node with an unpublish date in the past.');
$this
->assertText('Are you sure you want to delete', 'The deletion warning message is shown immediately when trying to delete a node with an unpublish date in the past.');
// Attempt to delete the unpublished node and check for no validation error.
$this
->drupalPost('node/' . $unpublished_node_past->nid . '/edit', array(), t('Delete'));
$this
->assertNoText('Error message', 'No error messages are shown when trying to delete a node with a publish date in the past.');
$this
->assertText('Are you sure you want to delete', 'The deletion warning message is shown immediately when trying to delete a node with a publish date in the past.');
}
/**
* Tests meta-information on scheduled nodes.
*
* When nodes are scheduled for unpublication, an X-Robots-Tag HTTP header is
* sent, alerting crawlers about when an item expires and should be removed
* from search results.
*/
public function testMetaInformation() {
// Log in.
$this
->drupalLogin($this->adminUser);
// Create a published node without scheduling.
$published_node = $this
->drupalCreateNode(array(
'type' => 'page',
'status' => 1,
));
$this
->drupalGet('node/' . $published_node->nid);
// Since we did not set an unpublish date, there should be no X-Robots-Tag
// header on the response.
$this
->assertFalse($this
->drupalGetHeader('X-Robots-Tag'), 'X-Robots-Tag is not present when no unpublish date is set.');
// Set a scheduler unpublish date on the node.
$unpublish_date = strtotime('+1 day', REQUEST_TIME);
$edit = array(
'unpublish_on' => format_date($unpublish_date, 'custom', 'Y-m-d H:i:s'),
);
$this
->drupalPost('node/' . $published_node->nid . '/edit', $edit, t('Save'));
// The node page should now have an X-Robots-Tag header with an
// unavailable_after-directive and RFC850 date- and time-value.
$this
->drupalGet('node/' . $published_node->nid);
$robots_tag = $this
->drupalGetHeader('X-Robots-Tag');
$this
->assertEqual($robots_tag, 'unavailable_after: ' . date(DATE_RFC850, $unpublish_date), 'X-Robots-Tag is present with correct timestamp derived from unpublish_on date.');
}
/**
* Tests that users without permission do not see the scheduler date fields.
*/
public function testPermissions() {
// Create a user who can add the content type but who does not have the
// permission to use the scheduler functionality.
$this->webUser = $this
->drupalCreateUser(array(
'access content',
'create page content',
'edit own page content',
'view own unpublished content',
'administer nodes',
));
$this
->drupalLogin($this->webUser);
// Set the defaults for a new node. Nothing in array means all OFF for
// 'status', 'promote' and 'sticky'.
variable_set('node_options_page', array());
// Check that neither of the fields are displayed when creating a node.
$this
->drupalGet('node/add/page');
$this
->assertNoFieldByName('publish_on', '', 'The Publish-on field is not shown for users who do not have permission to schedule content');
$this
->assertNoFieldByName('unpublish_on', '', 'The Unpublish-on field is not shown for users who do not have permission to schedule content');
// Initially run tests when publishing and unpublishing are not required.
variable_set('scheduler_publish_required_page', FALSE);
variable_set('scheduler_unpublish_required_page', FALSE);
// Check that a new node can be saved and published.
$title = $this
->randomString(15);
$this
->drupalPost('node/add/page', array(
'title' => $title,
'status' => TRUE,
), t('Save'));
// check_plain() is required because the title may have % & or ' in it.
// Could use randomName() to get round this instead but it is good to use
// the full variety of characters available in randomString.
$this
->assertText(sprintf('%s %s has been created.', 'Basic page', check_plain($title)), 'A node can be created and published when the user does not have scheduler permissions, and scheduling is not required.');
$node = $this
->drupalGetNodeByTitle($title);
$this
->assertTrue($node->status, 'The new node is published.');
// Check that a new node can be saved as unpublished.
$title = $this
->randomString(15);
$this
->drupalPost('node/add/page', array(
'title' => $title,
'status' => FALSE,
), t('Save'));
$this
->assertText(sprintf('%s %s has been created.', 'Basic page', check_plain($title)), 'A node can be created and saved as unpublished when the user does not have scheduler permissions, and scheduling is not required.');
$node = $this
->drupalGetNodeByTitle($title);
$this
->assertFalse($node->status, 'The new node is unpublished.');
// Set publishing and unpublishing to required, to make it a stronger test.
variable_set('scheduler_publish_required_page', TRUE);
variable_set('scheduler_unpublish_required_page', TRUE);
// @todo Add tests when scheduled publishing and unpublishing are required.
// Cannot be done until we make a decision on what 'required' means.
// @see https://www.drupal.org/node/2707411
// "Conflict between 'required publishing' and not having permission"
}
/**
* Tests Scheduler token support.
*/
public function testTokenReplacement() {
// Log in.
$this
->drupalLogin($this->adminUser);
// Define timestamps for consistent use when repeated throughout this test.
$publish_on_timestamp = REQUEST_TIME + 3600;
$unpublish_on_timestamp = REQUEST_TIME + 7200;
// Create an unpublished page with scheduled dates.
$settings = array(
'type' => 'page',
'status' => FALSE,
);
$node = $this
->drupalCreateNode($settings);
// Create array of test case data.
$test_cases = array(
array(
'token_format' => '',
'date_format' => 'medium',
'custom' => '',
),
array(
'token_format' => ':long',
'date_format' => 'long',
'custom' => '',
),
array(
'token_format' => ':raw',
'date_format' => 'custom',
'custom' => 'U',
),
array(
'token_format' => ':custom:jS F g:ia e O',
'date_format' => 'custom',
'custom' => 'jS F g:ia e O',
),
);
foreach ($test_cases as $test_data) {
// Define a variable containing the template of tokens to be replaced.
// The template is not held in the node body, as that is confusing when
// viewing the test debug, becuase the tokens will not be replaced unless
// a text format for tokens is added. That is unnecessary for the tests.
$template = 'Publish on: [node:scheduler-publish' . $test_data['token_format'] . ']. Unpublish on: [node:scheduler-unpublish' . $test_data['token_format'] . '].';
// With each of the test cases, test using both numeric and string input.
foreach (array(
'numeric',
'string',
) as $test_data['input_type']) {
if ($test_data['input_type'] == 'numeric') {
// Set the node fields to numeric timestanps, as they will be in the
// final stored node, after hook_node_presave() has been executed.
$node->publish_on = $publish_on_timestamp;
$node->unpublish_on = $unpublish_on_timestamp;
}
else {
// Replicate the scheduler fields as if just input by a user during
// edit, before hook_node_presave() has been executed.
// @see https://www.drupal.org/node/2750467
$node->publish_on = format_date($publish_on_timestamp, 'custom', 'Y-m-d H:i:s');
$node->unpublish_on = format_date($unpublish_on_timestamp, 'custom', 'Y-m-d H:i:s');
}
// Get the output value after tokens have been replaced.
$token_output = token_replace($template, array(
'node' => $node,
));
// Create the expected text.
$publish_on_date = format_date($publish_on_timestamp, $test_data['date_format'], $test_data['custom']);
$unpublish_on_date = format_date($unpublish_on_timestamp, $test_data['date_format'], $test_data['custom']);
$expected_output = 'Publish on: ' . $publish_on_date . '. Unpublish on: ' . $unpublish_on_date . '.';
// Check that the actual text matches the expected value.
$tested_format = $test_data['token_format'] ? '"' . $test_data['token_format'] . '"' : 'default';
$this
->assertEqual($token_output, $expected_output, 'Scheduler tokens replaced correctly for ' . $tested_format . ' format with ' . $test_data['input_type'] . ' input data.');
}
// Remove the scheduled dates and check that token replacment still works.
unset($node->publish_on);
unset($node->unpublish_on);
$token_output = token_replace($template, array(
'node' => $node,
));
$expected_output = 'Publish on: [node:scheduler-publish' . $test_data['token_format'] . ']. Unpublish on: [node:scheduler-unpublish' . $test_data['token_format'] . '].';
$this
->assertEqual($token_output, $expected_output, 'Scheduler tokens replaced correctly for ' . $tested_format . ' format with no scheduled dates.');
}
}
/**
* Tests the 'touch' option to update the created date during publishing.
*/
public function testAlterCreationDate() {
// Ensure nodes with past dates will be scheduled not published immediately.
variable_set('scheduler_publish_past_date_page', 'schedule');
// Create a node with a 'created' date two days in the past.
$created = strtotime('-2 day', REQUEST_TIME);
$settings = array(
'type' => 'page',
'created' => $created,
'status' => FALSE,
);
$node = $this
->drupalCreateNode($settings);
// Check that the node is not published.
$this
->assertFalse($node->status, 'Before cron, the node is not published.');
// Schedule the node for publishing and run cron.
$node = $this
->schedule($node, 'publish');
// Get the created date from the node and check that it has not changed.
$this
->assertTrue($node->status, 'After cron, the node has been published.');
$created_after_cron = $node->created;
$this
->assertEqual($created, $created_after_cron, 'The node creation date is not changed by default.');
// Set option to change the created date to match the publish_on date.
variable_set('scheduler_publish_touch_page', TRUE);
// Schedule the node again and run cron.
$node = $this
->schedule($node, 'publish');
// Check that the created date has changed to match the publish_on date.
$created_after_cron = $node->created;
$this
->assertEqual(strtotime('-1 day', REQUEST_TIME), $created_after_cron, "With 'touch' option set, the node creation date is changed to match the publishing date.");
}
/**
* Test scheduler lightweight cron runs.
*/
public function testLightweightCronRun() {
// Run the lightweight cron anonymously without any cron key.
$this
->drupalGet('scheduler/cron');
$this
->assertResponse(200, 'With no cron key (default) scheduler/cron returns "200 OK"');
// Generate and set a cron key.
$cron_key = substr(md5(rand()), 0, 20);
variable_set('scheduler_lightweight_access_key', $cron_key);
// Run the lightweight cron without any cron key.
$this
->drupalGet('scheduler/cron');
$this
->assertResponse(403, 'After creating a cron key scheduler/cron returns "403 Not Authorized"');
// Run the lightweight cron anonymously with a random (wrong) cron key.
$this
->drupalGet('scheduler/cron/' . substr(md5(rand()), 0, 20));
$this
->assertResponse(403, 'scheduler/cron/{wrong key} returns "403 Not Authorized"');
// Run the lightweight cron anonymously with the valid cron key.
$this
->drupalGet('scheduler/cron/' . $cron_key);
$this
->assertResponse(200, 'scheduler/cron/{correct key} returns "200 OK"');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DrupalTestCase:: |
protected | property | Assertions thrown in that test case. | |
DrupalTestCase:: |
protected | property | The database prefix of this test run. | |
DrupalTestCase:: |
protected | property | The original file directory, before it was changed for testing purposes. | |
DrupalTestCase:: |
public | property | Current results of this test case. | |
DrupalTestCase:: |
protected | property | Flag to indicate whether the test has been set up. | |
DrupalTestCase:: |
protected | property | ||
DrupalTestCase:: |
protected | property | ||
DrupalTestCase:: |
protected | property | This class is skipped when looking for the source of an assertion. | |
DrupalTestCase:: |
protected | property | The test run ID. | |
DrupalTestCase:: |
protected | property | Time limit for the test. | |
DrupalTestCase:: |
public | property | Whether to cache the installation part of the setUp() method. | |
DrupalTestCase:: |
public | property | Whether to cache the modules installation part of the setUp() method. | |
DrupalTestCase:: |
protected | property | URL to the verbose output file directory. | |
DrupalTestCase:: |
protected | function | Internal helper: stores the assert. | |
DrupalTestCase:: |
protected | function | Check to see if two values are equal. | |
DrupalTestCase:: |
protected | function | Check to see if a value is false (an empty string, 0, NULL, or FALSE). | |
DrupalTestCase:: |
protected | function | Check to see if two values are identical. | |
DrupalTestCase:: |
protected | function | Check to see if two values are not equal. | |
DrupalTestCase:: |
protected | function | Check to see if two values are not identical. | |
DrupalTestCase:: |
protected | function | Check to see if a value is not NULL. | |
DrupalTestCase:: |
protected | function | Check to see if a value is NULL. | |
DrupalTestCase:: |
protected | function | Check to see if a value is not false (not an empty string, 0, NULL, or FALSE). | |
DrupalTestCase:: |
public static | function | Delete an assertion record by message ID. | |
DrupalTestCase:: |
protected | function | Fire an error assertion. | 1 |
DrupalTestCase:: |
public | function | Handle errors during test runs. | 1 |
DrupalTestCase:: |
protected | function | Handle exceptions. | |
DrupalTestCase:: |
protected | function | Fire an assertion that is always negative. | |
DrupalTestCase:: |
public static | function | Converts a list of possible parameters into a stack of permutations. | |
DrupalTestCase:: |
protected | function | Cycles through backtrace until the first non-assertion method is found. | |
DrupalTestCase:: |
public static | function | Returns the database connection to the site running Simpletest. | |
DrupalTestCase:: |
public static | function | Store an assertion from outside the testing context. | |
DrupalTestCase:: |
protected | function | Fire an assertion that is always positive. | |
DrupalTestCase:: |
public static | function | Generates a random string containing letters and numbers. | |
DrupalTestCase:: |
public static | function | Generates a random string of ASCII characters of codes 32 to 126. | |
DrupalTestCase:: |
public | function | Run all tests in this class. | |
DrupalTestCase:: |
protected | function | Logs a verbose message in a text file. | |
DrupalWebTestCase:: |
protected | property | Additional cURL options. | |
DrupalWebTestCase:: |
protected | property | The content of the page currently loaded in the internal browser. | |
DrupalWebTestCase:: |
protected | property | The current cookie file used by cURL. | |
DrupalWebTestCase:: |
protected | property | The cookies of the page currently loaded in the internal browser. | |
DrupalWebTestCase:: |
protected | property | The handle of the current cURL connection. | |
DrupalWebTestCase:: |
protected | property | The value of the Drupal.settings JavaScript variable for the page currently loaded in the internal browser. | |
DrupalWebTestCase:: |
protected | property | The parsed version of the page. | |
DrupalWebTestCase:: |
protected | property | Whether the files were copied to the test files directory. | |
DrupalWebTestCase:: |
protected | property | The headers of the page currently loaded in the internal browser. | |
DrupalWebTestCase:: |
protected | property | HTTP authentication credentials (<username>:<password>). | |
DrupalWebTestCase:: |
protected | property | HTTP authentication method | |
DrupalWebTestCase:: |
protected | property | The current user logged in using the internal browser. | |
DrupalWebTestCase:: |
protected | property | The original shutdown handlers array, before it was cleaned for testing purposes. | |
DrupalWebTestCase:: |
protected | property | The original user, before it was changed to a clean uid = 1 for testing purposes. | |
DrupalWebTestCase:: |
protected | property | The content of the page currently loaded in the internal browser (plain text version). | |
DrupalWebTestCase:: |
protected | property | The number of redirects followed during the handling of a request. | |
DrupalWebTestCase:: |
protected | property | The current session ID, if available. | |
DrupalWebTestCase:: |
protected | property | The current session name, if available. | |
DrupalWebTestCase:: |
protected | property | The URL currently loaded in the internal browser. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field exists with the given name or ID. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field exists in the current page with the given ID and value. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field exists in the current page with the given name and value. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field exists in the current page by the given XPath. | |
DrupalWebTestCase:: |
protected | function | Asserts that a checkbox field in the current page is checked. | |
DrupalWebTestCase:: |
protected | function | Pass if a link with the specified label is found, and optional with the specified index. | |
DrupalWebTestCase:: |
protected | function | Pass if a link containing a given href (part) is found. | |
DrupalWebTestCase:: |
protected | function | Asserts that the most recently sent e-mail message has the given value. | |
DrupalWebTestCase:: |
protected | function | Asserts that the most recently sent e-mail message has the pattern in it. | |
DrupalWebTestCase:: |
protected | function | Asserts that the most recently sent e-mail message has the string in it. | |
DrupalWebTestCase:: |
protected | function | Asserts that each HTML ID is used for just a single element. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field does not exist with the given name or ID. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field does not exist with the given ID and value. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field does not exist with the given name and value. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field doesn't exist or its value doesn't match, by XPath. | |
DrupalWebTestCase:: |
protected | function | Asserts that a checkbox field in the current page is not checked. | |
DrupalWebTestCase:: |
protected | function | Pass if a link with the specified label is not found. | |
DrupalWebTestCase:: |
protected | function | Pass if a link containing a given href (part) is not found. | |
DrupalWebTestCase:: |
protected | function | Asserts that a select option in the current page is not checked. | |
DrupalWebTestCase:: |
protected | function | Will trigger a pass if the perl regex pattern is not present in raw content. | |
DrupalWebTestCase:: |
protected | function | Pass if the raw text is NOT found on the loaded page, fail otherwise. Raw text refers to the raw HTML that the page generated. | |
DrupalWebTestCase:: |
protected | function | Asserts the page did not return the specified response code. | |
DrupalWebTestCase:: |
protected | function | Pass if the text is NOT found on the text version of the page. The text version is the equivalent of what a user would see when viewing through a web browser. In other words the HTML has been filtered out of the contents. | |
DrupalWebTestCase:: |
protected | function | Pass if the page title is not the given string. | |
DrupalWebTestCase:: |
protected | function | Pass if the text is found MORE THAN ONCE on the text version of the page. | |
DrupalWebTestCase:: |
protected | function | Asserts that a select option in the current page is checked. | |
DrupalWebTestCase:: |
protected | function | Will trigger a pass if the Perl regex pattern is found in the raw content. | |
DrupalWebTestCase:: |
protected | function | Pass if the raw text IS found on the loaded page, fail otherwise. Raw text refers to the raw HTML that the page generated. | |
DrupalWebTestCase:: |
protected | function | Asserts the page responds with the specified response code. | |
DrupalWebTestCase:: |
protected | function | Pass if the text IS found on the text version of the page. The text version is the equivalent of what a user would see when viewing through a web browser. In other words the HTML has been filtered out of the contents. | |
DrupalWebTestCase:: |
protected | function | Helper for assertText and assertNoText. | |
DrupalWebTestCase:: |
protected | function | Asserts themed output. | |
DrupalWebTestCase:: |
protected | function | Pass if the page title is the given string. | |
DrupalWebTestCase:: |
protected | function | Pass if the text is found ONLY ONCE on the text version of the page. | |
DrupalWebTestCase:: |
protected | function | Helper for assertUniqueText and assertNoUniqueText. | |
DrupalWebTestCase:: |
protected | function | Pass if the internal browser's URL matches the given path. | |
DrupalWebTestCase:: |
protected | function | Builds an XPath query. | |
DrupalWebTestCase:: |
protected | function | Changes the database connection to the prefixed one. | |
DrupalWebTestCase:: |
protected | function | Check for meta refresh tag and if found call drupalGet() recursively. This function looks for the http-equiv attribute to be set to "Refresh" and is case-sensitive. | |
DrupalWebTestCase:: |
protected | function | Check to make sure that the array of permissions are valid. | |
DrupalWebTestCase:: |
protected | function | Follows a link by name. | |
DrupalWebTestCase:: |
protected | function | Helper function: construct an XPath for the given set of attributes and value. | |
DrupalWebTestCase:: |
protected | function | Copy the setup cache from/to another table and files directory. | |
DrupalWebTestCase:: |
protected | function | Runs cron in the Drupal installed by Simpletest. | |
DrupalWebTestCase:: |
protected | function | Close the cURL handler and unset the handler. | |
DrupalWebTestCase:: |
protected | function | Initializes and executes a cURL request. | |
DrupalWebTestCase:: |
protected | function | Reads headers and registers errors received from the tested site. | |
DrupalWebTestCase:: |
protected | function | Initializes the cURL connection. | |
DrupalWebTestCase:: |
protected | function | Compare two files based on size and file name. | |
DrupalWebTestCase:: |
protected | function | Creates a custom content type based on default settings. | |
DrupalWebTestCase:: |
protected | function | Creates a node based on default settings. | |
DrupalWebTestCase:: |
protected | function | Creates a role with specified permissions. | |
DrupalWebTestCase:: |
protected | function | Create a user with a given set of permissions. | |
DrupalWebTestCase:: |
protected | function | Retrieves a Drupal path or an absolute path. | |
DrupalWebTestCase:: |
protected | function | Retrieve a Drupal path or an absolute path and JSON decode the result. | |
DrupalWebTestCase:: |
protected | function | Gets the current raw HTML of requested page. | |
DrupalWebTestCase:: |
protected | function | Gets the value of an HTTP response header. If multiple requests were required to retrieve the page, only the headers from the last request will be checked by default. However, if TRUE is passed as the second argument, all requests will be processed… | |
DrupalWebTestCase:: |
protected | function | Gets the HTTP response headers of the requested page. Normally we are only interested in the headers returned by the last request. However, if a page is redirected or HTTP authentication is in use, multiple requests will be required to retrieve the… | |
DrupalWebTestCase:: |
protected | function | Gets an array containing all e-mails sent during this test case. | |
DrupalWebTestCase:: |
function | Get a node from the database based on its title. | ||
DrupalWebTestCase:: |
protected | function | Gets the value of the Drupal.settings JavaScript variable for the currently loaded page. | |
DrupalWebTestCase:: |
protected | function | Get a list files that can be used in tests. | |
DrupalWebTestCase:: |
protected | function | Generate a token for the currently logged in user. | |
DrupalWebTestCase:: |
protected | function | Retrieves only the headers for a Drupal path or an absolute path. | |
DrupalWebTestCase:: |
protected | function | Log in a user with the internal browser. | |
DrupalWebTestCase:: |
protected | function | ||
DrupalWebTestCase:: |
protected | function | Execute a POST request on a Drupal page. It will be done as usual POST request with SimpleBrowser. | |
DrupalWebTestCase:: |
protected | function | Execute an Ajax submission. | |
DrupalWebTestCase:: |
protected | function | Sets the raw HTML content. This can be useful when a page has been fetched outside of the internal browser and assertions need to be made on the returned page. | |
DrupalWebTestCase:: |
protected | function | Sets the value of the Drupal.settings JavaScript variable for the currently loaded page. | |
DrupalWebTestCase:: |
protected | function | Takes a path and returns an absolute path. | |
DrupalWebTestCase:: |
protected | function | Get all option elements, including nested options, in a select. | |
DrupalWebTestCase:: |
protected | function | Get the selected value from a select field. | |
DrupalWebTestCase:: |
protected | function | Returns the cache key used for the setup caching. | |
DrupalWebTestCase:: |
protected | function | Get the current URL from the cURL handler. | |
DrupalWebTestCase:: |
protected | function | Handle form input related to drupalPost(). Ensure that the specified fields exist and attempt to create POST data in the correct manner for the particular field type. | |
DrupalWebTestCase:: |
protected | function | Copies the cached tables and files for a cached installation setup. | |
DrupalWebTestCase:: |
protected | function | Parse content returned from curlExec using DOM and SimpleXML. | |
DrupalWebTestCase:: |
protected | function | Preload the registry from the testing site. | |
DrupalWebTestCase:: |
protected | function | Generates a database prefix for running tests. | |
DrupalWebTestCase:: |
protected | function | Prepares the current environment for running the test. | |
DrupalWebTestCase:: |
protected | function | Recursively copy one directory to another. | |
DrupalWebTestCase:: |
protected | function | Refresh the in-memory set of variables. Useful after a page request is made that changes a variable in a different thread. | 1 |
DrupalWebTestCase:: |
protected | function | Reset all data structures after having enabled new modules. | |
DrupalWebTestCase:: |
protected | function | Store the installation setup to a cache. | |
DrupalWebTestCase:: |
protected | function | Delete created files and temporary files directory, delete the tables created by setUp(), and reset the database prefix. | 6 |
DrupalWebTestCase:: |
protected | function | Outputs to verbose the most recent $count emails sent. | |
DrupalWebTestCase:: |
protected | function | Perform an xpath search on the contents of the internal browser. The search is relative to the root element (HTML tag normally) of the page. | |
DrupalWebTestCase:: |
function |
Constructor for DrupalWebTestCase. Overrides DrupalTestCase:: |
1 | |
SchedulerFunctionalTest:: |
public | function | Provides data for testNonEnabledType(). | |
SchedulerFunctionalTest:: |
public static | function | ||
SchedulerFunctionalTest:: |
public | function |
Sets up a Drupal site for running functional and integration tests. Overrides DrupalWebTestCase:: |
|
SchedulerFunctionalTest:: |
public | function | Tests the 'touch' option to update the created date during publishing. | |
SchedulerFunctionalTest:: |
public | function | Tests basic scheduling of content. | |
SchedulerFunctionalTest:: |
public | function | Tests scheduler when not all cron tasks are run during cron. | |
SchedulerFunctionalTest:: |
public | function | Tests if options can both be displayed as extra fields and vertical tabs. | |
SchedulerFunctionalTest:: |
public | function | Test scheduler lightweight cron runs. | |
SchedulerFunctionalTest:: |
public | function | Tests meta-information on scheduled nodes. | |
SchedulerFunctionalTest:: |
public | function | Test that Scheduler does not interfere with non-scheduler-enabled nodes. | |
SchedulerFunctionalTest:: |
public | function | Test the different options for past publication dates. | |
SchedulerFunctionalTest:: |
public | function | Tests that users without permission do not see the scheduler date fields. | |
SchedulerFunctionalTest:: |
public | function | Tests creating and editing nodes with required scheduling enabled. | |
SchedulerFunctionalTest:: |
public | function | Tests the creation of new revisions on scheduling. | |
SchedulerFunctionalTest:: |
public | function | Tests the deletion of a scheduled node. | |
SchedulerFunctionalTest:: |
public | function | Tests Scheduler token support. | |
SchedulerFunctionalTest:: |
public | function | Tests the validation when editing a node. | |
SchedulerTestBase:: |
protected | property | A user with administration rights. | |
SchedulerTestBase:: |
protected | property |
The profile to install as a basis for testing. Overrides DrupalWebTestCase:: |
|
SchedulerTestBase:: |
public | function | Check if the number of revisions for a node matches a given value. | |
SchedulerTestBase:: |
public | function | Check if the latest revision log message of a node matches a given string. | |
SchedulerTestBase:: |
public | function | Common settings and options. | |
SchedulerTestBase:: |
public | function | Helper function for testScheduler(). Schedules content and asserts status. | |
SchedulerTestBase:: |
public | function | Simulates the scheduled (un)publication of a node. |