diff --git b/tests/external_node_update.test a/tests/external_node_update.test index 1d7f0d0..21f919e 100644 --- b/tests/external_node_update.test +++ a/tests/external_node_update.test @@ -61,7 +61,10 @@ class WorkbenchModerationExternalNodeUpdateTestCase extends WorkbenchModerationT $this->assertPublicationState(FALSE, 'A newly created node is not published.'); // Resave the node and check that the status doesn't change. - $this->assertNodeUnchangedAfterResave(); + $this->resaveNode(); + $this->assertModerationStatus($expected, 'current', 'The moderation status is correct for a newly created node.'); + $this->assertNoPublishedRecord('A newly created node does not have a published entry in the node history table.'); + $this->assertPublicationState(FALSE, 'A newly created node is not published.'); // Publish the node in an external module and check that the moderation // state changes accordingly. @@ -73,7 +76,10 @@ class WorkbenchModerationExternalNodeUpdateTestCase extends WorkbenchModerationT $this->assertPublicationState(TRUE, 'A node which is published externally is actually published.'); // Resave the node and check that the status doesn't change. - $this->assertNodeUnchangedAfterResave(); + $this->resaveNode(); + $this->assertModerationStatus($expected, 'current', 'The moderation state changed to "published" if the node is published externally.'); + $this->assertModerationStatus($expected, 'published', 'A published moderation state record is created when the node is published externally.'); + $this->assertPublicationState(TRUE, 'A node which is published externally is actually published.'); // Unpublish the node in an external module and check that the moderation // state changes accordingly. @@ -85,37 +91,18 @@ class WorkbenchModerationExternalNodeUpdateTestCase extends WorkbenchModerationT $this->assertPublicationState(FALSE, 'A node which is unpublished externally is actually unpublished.'); // Resave the node and check that the status doesn't change. - $this->assertNodeUnchangedAfterResave(); + $this->resaveNode(); + $this->assertModerationStatus($expected, 'current', 'The moderation state changed to "draft" if the node is unpublished externally.'); + $this->assertNoPublishedRecord('The published moderation state record is removed when the node is unpublished externally.'); + $this->assertPublicationState(FALSE, 'A node which is unpublished externally is actually unpublished.'); } /** - * Checks that the tested node doesn't change after it is resaved. - * - * @return - * TRUE if the assertion succeeded, FALSE otherwise. + * Resave the node in an external module. */ - public function assertNodeUnchangedAfterResave() { - // Retrieve the current status of the node. - $current = $this->getModerationRecord('current'); - $published = $this->getModerationRecord('published'); - $status = $this->node->status; - - // Resave the node in an external module. + public function resaveNode() { $this->drupalGet('workbench_moderation_test/' . $this->node->nid); $this->refreshNode(); - - // Check if the status remains unchanged. - $success = TRUE; - $success |= $this->assertModerationStatus($current, 'current', 'The current moderation status doesn\'t change after resaving the node.'); - if ($published) { - $success |= $this->assertModerationStatus($published, 'published', 'The published moderation status doesn\'t change after resaving the node.'); - } - else { - $success |= $this->assertNoPublishedRecord('The node does not get a published entry in the node history table after resaving.'); - } - $success |= $this->assertEqual($status, $this->node->status, 'The publication state remains unchanged after resaving.'); - - return $this->assertTrue($success, 'The node has remained unchanged after resaving.'); } /**