diff --git a/tests/workbench_moderation.test b/tests/workbench_moderation.test index 7f17aca..ba0f362 100644 --- a/tests/workbench_moderation.test +++ b/tests/workbench_moderation.test @@ -2,7 +2,7 @@ /** * @file - * Tests for node.module. + * Tests for workbench_moderation.module. */ class WorkbenchModerationTestCase extends DrupalWebTestCase { @@ -272,13 +272,14 @@ class WorkbenchModerationUnpublishTestCase extends WorkbenchModerationTestCase { $this->assertFalse($unpublished_node->status, t('The node is not published.')); $this->assertFalse(isset($unpublished_node->workbench_moderation['published']), t('Workbench moderation has no published revision.')); } - } +/** + * Tests behavior when title is changed after initial publication of the node. + * this matters when aliases exist using the title as a token. + */ class WorkbenchRedirectAfterTitleChangeTestCase extends WorkbenchModerationTestCase { -// tests behavior when title is changed after initial publication of the node. -// this matters when aliases exist using the title as a token. - + public static function getInfo() { return array( 'name' => 'Alias after title change', @@ -293,48 +294,36 @@ class WorkbenchRedirectAfterTitleChangeTestCase extends WorkbenchModerationTestC function setUp($modules = array()) { // Make sure Workbench and Pathauto are both enabled. - $modules = array_merge($modules, array('workbench', 'pathauto')); parent::setUp($modules); $this->drupalLogin($this->moderator_user); } + /** + * Tests whether a node with a changed alias correctly redirects upon re-publishing. + **/ function testAliasRedirect() { - // Tests whether a node with a changed alias correctly redirects upon re-publishing. - - // Create a new node and make sure it is unpublished. - $body_name = 'body[' . LANGUAGE_NONE . '][0]'; + + // Create a new draft node. $edit = array( 'title' => $this->randomName(), - "{$body_name}[value]" => $this->randomString(128), - "{$body_name}[format]" => filter_default_format(), ); $this->drupalPost("node/add/{$this->content_type}", $edit, t('Save')); - - // Moderate node to needs review. - $moderate = array('state' => 'needs_review'); - $this->drupalPost(NULL, $moderate, t('Apply')); - + // Moderate node to published. $moderate = array('state' => workbench_moderation_state_published()); $this->drupalPost(NULL, $moderate, t('Apply')); - + // Edit node and change title. $node = $this->drupalGetNodeByTitle($edit['title']); $edit = array('title' => $this->randomName(10) . '_revision1'); - $this->drupalPost("node/{$node->nid}/edit", $edit, t('Save')); - - // Moderate node to needs review. - $moderate = array('state' => 'needs_review'); - $this->drupalPost(NULL, $moderate, t('Apply')); - + $this->drupalPost("node/{$node->nid}/edit", $edit, t('Save')); + // Moderate node to published. $moderate = array('state' => workbench_moderation_state_published()); $this->drupalPost(NULL, $moderate, t('Apply')); - + // Check response code is 200. $this->assertResponse(200); - } - }