public function PublishContentWebTestBase::setNodeStatus in Publish Content 7
Set the status of a node.
Parameters
node|int $node: A loaded node object or node nid
int $status: The status to set, 1 for published, 0 for unpublished.
10 calls to PublishContentWebTestBase::setNodeStatus()
- PublishContentWebTestBase::assertCannotPublishFromLinksPage in tests/
publishcontent.test - Assert the current user cannot publish a node from the listing test page.
- PublishContentWebTestBase::assertCannotUnpublishFromLinksPage in tests/
publishcontent.test - Assert the current user cannot unpublish a node from the listing test page.
- PublishContentWebTestBase::assertCanPublishFromLinksPage in tests/
publishcontent.test - Assert the current user can publish a node from the listing test page.
- PublishContentWebTestBase::assertCanUnpublishFromLinksPage in tests/
publishcontent.test - Assert the current user can unpublish a node from the listing test page.
- PublishContentWebTestBase::assertCurrentUserCannotPublish in tests/
publishcontent.test - Check the current user session forbids publish of a given node.
File
- tests/
publishcontent.test, line 73 - Unit tests for Publish Content module.
Class
- PublishContentWebTestBase
- We test to ensure we are not messing up with the default Drupal access for view node i.e. a owner of a node can view it even if unpublished.
Code
public function setNodeStatus($node, $status, $msg = '') {
$node = is_object($node) ? $node : node_load($node);
if ($node->status != $status) {
$node->status = $status;
node_save($node);
}
}