Checks that revisions are correctly saved without log messages.
function testNodeRevisionWithoutLogMessage() {
// Create a node with an initial log message.
$log = $this
->randomName(10);
$node = $this
->drupalCreateNode(array(
'log' => $log,
));
// Save over the same revision and explicitly provide an empty log message
// (for example, to mimic the case of a node form submitted with no text in
// the "log message" field), and check that the original log message is
// preserved.
$new_title = $this
->randomName(10) . 'testNodeRevisionWithoutLogMessage1';
$node = clone $node;
$node->title = $new_title;
$node->log = '';
$node
->setNewRevision(FALSE);
$node
->save();
$this
->drupalGet('node/' . $node->nid);
$this
->assertText($new_title, 'New node title appears on the page.');
$node_revision = node_load($node->nid, TRUE);
$this
->assertEqual($node_revision->log, $log, 'After an existing node revision is re-saved without a log message, the original log message is preserved.');
// Create another node with an initial log message.
$node = $this
->drupalCreateNode(array(
'log' => $log,
));
// Save a new node revision without providing a log message, and check that
// this revision has an empty log message.
$new_title = $this
->randomName(10) . 'testNodeRevisionWithoutLogMessage2';
$node = clone $node;
$node->title = $new_title;
$node
->setNewRevision();
$node->log = NULL;
$node
->save();
$this
->drupalGet('node/' . $node->nid);
$this
->assertText($new_title, 'New node title appears on the page.');
$node_revision = node_load($node->nid, TRUE);
$this
->assertTrue(empty($node_revision->log), 'After a new node revision is saved with an empty log message, the log message for the node is empty.');
}