Commit 55c34581 authored by catch's avatar catch

Issue #2248991 by marco, tstoeckler, xjm: Rename the 'log' field to...

Issue #2248991 by marco, tstoeckler, xjm: Rename the 'log' field to 'revision_log' in Node and CustomBlock.
parent ac9286a4
...@@ -256,9 +256,11 @@ public function getTableMapping() { ...@@ -256,9 +256,11 @@ public function getTableMapping() {
// log. // log.
// @todo Provide automatic definitions for revision metadata fields in // @todo Provide automatic definitions for revision metadata fields in
// https://drupal.org/node/2248983. // https://drupal.org/node/2248983.
// @todo Rename 'log' to 'revision_log' in $revision_metadata_fields = array_intersect(array(
// https://drupal.org/node/2248991. 'revision_timestamp',
$revision_metadata_fields = array_intersect(array('revision_timestamp', 'revision_uid', 'log'), $all_fields); 'revision_uid',
'revision_log',
), $all_fields);
$revisionable = $this->entityType->isRevisionable(); $revisionable = $this->entityType->isRevisionable();
// @todo Remove the data table check once all entity types are using // @todo Remove the data table check once all entity types are using
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
// or if the checkbox doesn't exist, but the revision log does. For users // or if the checkbox doesn't exist, but the revision log does. For users
// without the "Administer content" permission the checkbox won't appear, // without the "Administer content" permission the checkbox won't appear,
// but the revision log will if the content type is set to auto-revision. // but the revision log will if the content type is set to auto-revision.
if (revisionCheckbox.is(':checked') || (!revisionCheckbox.length && $context.find('.form-item-log textarea').length)) { if (revisionCheckbox.is(':checked') || (!revisionCheckbox.length && $context.find('.form-item-revision-log textarea').length)) {
return Drupal.t('New revision'); return Drupal.t('New revision');
} }
......
...@@ -150,12 +150,12 @@ public function form(array $form, array &$form_state) { ...@@ -150,12 +150,12 @@ public function form(array $form, array &$form_state) {
if (!$block->isNewRevision()) { if (!$block->isNewRevision()) {
$form['revision_information']['revision']['#states'] = array( $form['revision_information']['revision']['#states'] = array(
'checked' => array( 'checked' => array(
'textarea[name="log"]' => array('empty' => FALSE), 'textarea[name="revision_log"]' => array('empty' => FALSE),
), ),
); );
} }
$form['revision_information']['log'] = array( $form['revision_information']['revision_log'] = array(
'#type' => 'textarea', '#type' => 'textarea',
'#title' => $this->t('Revision log message'), '#title' => $this->t('Revision log message'),
'#rows' => 4, '#rows' => 4,
......
...@@ -37,13 +37,13 @@ public function setInfo($info); ...@@ -37,13 +37,13 @@ public function setInfo($info);
/** /**
* Sets the block revision log message. * Sets the block revision log message.
* *
* @param string $log * @param string $revision_log
* The revision log message. * The revision log message.
* *
* @return \Drupal\custom_block\CustomBlockInterface * @return \Drupal\custom_block\CustomBlockInterface
* The class instance that this method is called on. * The class instance that this method is called on.
*/ */
public function setRevisionLog($log); public function setRevisionLog($revision_log);
/** /**
* Sets the theme value. * Sets the theme value.
......
...@@ -115,23 +115,11 @@ public function getInstances() { ...@@ -115,23 +115,11 @@ public function getInstances() {
public function preSaveRevision(EntityStorageInterface $storage, \stdClass $record) { public function preSaveRevision(EntityStorageInterface $storage, \stdClass $record) {
parent::preSaveRevision($storage, $record); parent::preSaveRevision($storage, $record);
if ($this->isNewRevision()) { if (!$this->isNewRevision() && isset($this->original) && (!isset($record->revision_log) || $record->revision_log === '')) {
// When inserting either a new custom block or a new custom_block
// revision, $entity->log must be set because {block_custom_revision}.log
// is a text column and therefore cannot have a default value. However,
// it might not be set at this point (for example, if the user submitting
// the form does not have permission to create revisions), so we ensure
// that it is at least an empty string in that case.
// @todo: Make the {block_custom_revision}.log column nullable so that we
// can remove this check.
if (!isset($record->log)) {
$record->log = '';
}
}
elseif (isset($this->original) && (!isset($record->log) || $record->log === '')) {
// If we are updating an existing custom_block without adding a new // If we are updating an existing custom_block without adding a new
// revision and the user did not supply a log, keep the existing one. // revision and the user did not supply a revision log, keep the existing
$record->log = $this->original->getRevisionLog(); // one.
$record->revision_log = $this->original->getRevisionLog();
} }
} }
...@@ -186,9 +174,9 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { ...@@ -186,9 +174,9 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
->setDescription(t('The block type.')) ->setDescription(t('The block type.'))
->setSetting('target_type', 'custom_block_type'); ->setSetting('target_type', 'custom_block_type');
$fields['log'] = FieldDefinition::create('string_long') $fields['revision_log'] = FieldDefinition::create('string_long')
->setLabel(t('Revision log message')) ->setLabel(t('Revision log message'))
->setDescription(t('The revision log message.')) ->setDescription(t('The log entry explaining the changes in this revision.'))
->setRevisionable(TRUE); ->setRevisionable(TRUE);
$fields['changed'] = FieldDefinition::create('changed') $fields['changed'] = FieldDefinition::create('changed')
...@@ -210,7 +198,7 @@ public function getChangedTime() { ...@@ -210,7 +198,7 @@ public function getChangedTime() {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getRevisionLog() { public function getRevisionLog() {
return $this->get('log')->value; return $this->get('revision_log')->value;
} }
/** /**
...@@ -224,8 +212,8 @@ public function setInfo($info) { ...@@ -224,8 +212,8 @@ public function setInfo($info) {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setRevisionLog($log) { public function setRevisionLog($revision_log) {
$this->set('log', $log); $this->set('revision_log', $revision_log);
return $this; return $this;
} }
......
...@@ -22,7 +22,7 @@ class CustomBlockRevisionsTest extends CustomBlockTestBase { ...@@ -22,7 +22,7 @@ class CustomBlockRevisionsTest extends CustomBlockTestBase {
* Stores log messages used during the test. * Stores log messages used during the test.
* @var array * @var array
*/ */
protected $logs; protected $revisionLogs;
/** /**
* Declares test information. * Declares test information.
...@@ -62,7 +62,7 @@ protected function setUp() { ...@@ -62,7 +62,7 @@ protected function setUp() {
} }
$this->blocks = $blocks; $this->blocks = $blocks;
$this->logs = $logs; $this->revisionLogs = $logs;
} }
/** /**
...@@ -70,12 +70,12 @@ protected function setUp() { ...@@ -70,12 +70,12 @@ protected function setUp() {
*/ */
public function testRevisions() { public function testRevisions() {
$blocks = $this->blocks; $blocks = $this->blocks;
$logs = $this->logs; $logs = $this->revisionLogs;
foreach ($blocks as $delta => $revision_id) { foreach ($blocks as $delta => $revision_id) {
// Confirm the correct revision text appears. // Confirm the correct revision text appears.
$loaded = entity_revision_load('custom_block', $revision_id); $loaded = entity_revision_load('custom_block', $revision_id);
// Verify log is the same. // Verify revision log is the same.
$this->assertEqual($loaded->getRevisionLog(), $logs[$delta], format_string('Correct log message found for revision !revision', array( $this->assertEqual($loaded->getRevisionLog(), $logs[$delta], format_string('Correct log message found for revision !revision', array(
'!revision' => $loaded->getRevisionId(), '!revision' => $loaded->getRevisionId(),
))); )));
......
...@@ -114,7 +114,7 @@ public function submitForm(array &$form, array &$form_state) { ...@@ -114,7 +114,7 @@ public function submitForm(array &$form, array &$form_state) {
// Update the title if changed. // Update the title if changed.
if ($row['title']['#default_value'] != $values['title']) { if ($row['title']['#default_value'] != $values['title']) {
$node = $this->nodeStorage->load($values['nid']); $node = $this->nodeStorage->load($values['nid']);
$node->log = $this->t('Title changed from %original to %current.', array('%original' => $node->label(), '%current' => $values['title'])); $node->revision_log = $this->t('Title changed from %original to %current.', array('%original' => $node->label(), '%current' => $values['title']));
$node->title = $values['title']; $node->title = $values['title'];
$node->book['link_title'] = $values['title']; $node->book['link_title'] = $values['title'];
$node->setNewRevision(); $node->setNewRevision();
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
// or if the checkbox doesn't exist, but the revision log does. For users // or if the checkbox doesn't exist, but the revision log does. For users
// without the "Administer content" permission the checkbox won't appear, // without the "Administer content" permission the checkbox won't appear,
// but the revision log will if the content type is set to auto-revision. // but the revision log will if the content type is set to auto-revision.
if (revisionCheckbox.is(':checked') || (!revisionCheckbox.length && $context.find('.form-item-log textarea').length)) { if (revisionCheckbox.is(':checked') || (!revisionCheckbox.length && $context.find('.form-item-revision-log textarea').length)) {
return Drupal.t('New revision'); return Drupal.t('New revision');
} }
......
...@@ -483,7 +483,7 @@ function node_views_data() { ...@@ -483,7 +483,7 @@ function node_views_data() {
); );
} }
$data['node_revision']['log'] = array( $data['node_revision']['revision_log'] = array(
'title' => t('Log message'), 'title' => t('Log message'),
'help' => t('The log message entered when the revision was created.'), 'help' => t('The log message entered when the revision was created.'),
'field' => array( 'field' => array(
......
...@@ -185,7 +185,7 @@ public function revisionOverview(NodeInterface $node) { ...@@ -185,7 +185,7 @@ public function revisionOverview(NodeInterface $node) {
'#account' => $revision_author, '#account' => $revision_author,
); );
$row[] = array('data' => $this->t('!date by !username', array('!date' => $this->l($this->date->format($revision->revision_timestamp->value, 'short'), 'node.view', array('node' => $node->id())), '!username' => drupal_render($username))) $row[] = array('data' => $this->t('!date by !username', array('!date' => $this->l($this->date->format($revision->revision_timestamp->value, 'short'), 'node.view', array('node' => $node->id())), '!username' => drupal_render($username)))
. (($revision->log->value != '') ? '<p class="revision-log">' . Xss::filter($revision->log->value) . '</p>' : ''), . (($revision->revision_log->value != '') ? '<p class="revision-log">' . Xss::filter($revision->revision_log->value) . '</p>' : ''),
'class' => array('revision-current')); 'class' => array('revision-current'));
$row[] = array('data' => String::placeholder($this->t('current revision')), 'class' => array('revision-current')); $row[] = array('data' => String::placeholder($this->t('current revision')), 'class' => array('revision-current'));
} }
...@@ -195,7 +195,7 @@ public function revisionOverview(NodeInterface $node) { ...@@ -195,7 +195,7 @@ public function revisionOverview(NodeInterface $node) {
'#account' => $revision_author, '#account' => $revision_author,
); );
$row[] = $this->t('!date by !username', array('!date' => $this->l($this->date->format($revision->revision_timestamp->value, 'short'), 'node.revision_show', array('node' => $node->id(), 'node_revision' => $vid)), '!username' => drupal_render($username))) $row[] = $this->t('!date by !username', array('!date' => $this->l($this->date->format($revision->revision_timestamp->value, 'short'), 'node.revision_show', array('node' => $node->id(), 'node_revision' => $vid)), '!username' => drupal_render($username)))
. (($revision->log->value != '') ? '<p class="revision-log">' . Xss::filter($revision->log->value) . '</p>' : ''); . (($revision->revision_log->value != '') ? '<p class="revision-log">' . Xss::filter($revision->revision_log->value) . '</p>' : '');
if ($revert_permission) { if ($revert_permission) {
$links['revert'] = array( $links['revert'] = array(
......
...@@ -85,25 +85,12 @@ public function preSave(EntityStorageInterface $storage) { ...@@ -85,25 +85,12 @@ public function preSave(EntityStorageInterface $storage) {
public function preSaveRevision(EntityStorageInterface $storage, \stdClass $record) { public function preSaveRevision(EntityStorageInterface $storage, \stdClass $record) {
parent::preSaveRevision($storage, $record); parent::preSaveRevision($storage, $record);
if ($this->newRevision) { if (!$this->isNewRevision() && isset($this->original) && (!isset($record->revision_log) || $record->revision_log === '')) {
// When inserting either a new node or a new node revision, $node->log
// must be set because {node_field_revision}.log is a text column and
// therefore cannot have a default value. However, it might not be set at
// this point (for example, if the user submitting a node form does not
// have permission to create revisions), so we ensure that it is at least
// an empty string in that case.
// @todo Make the {node_field_revision}.log column nullable so that we
// can remove this check.
if (!isset($record->log)) {
$record->log = '';
}
}
elseif (isset($this->original) && (!isset($record->log) || $record->log === '')) {
// If we are updating an existing node without adding a new revision, we // If we are updating an existing node without adding a new revision, we
// need to make sure $entity->log is reset whenever it is empty. // need to make sure $entity->revision_log is reset whenever it is empty.
// Therefore, this code allows us to avoid clobbering an existing log // Therefore, this code allows us to avoid clobbering an existing log
// entry with an empty one. // entry with an empty one.
$record->log = $this->original->log->value; $record->revision_log = $this->original->revision_log->value;
} }
} }
...@@ -433,8 +420,8 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { ...@@ -433,8 +420,8 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
->setQueryable(FALSE) ->setQueryable(FALSE)
->setRevisionable(TRUE); ->setRevisionable(TRUE);
$fields['log'] = FieldDefinition::create('string_long') $fields['revision_log'] = FieldDefinition::create('string_long')
->setLabel(t('Log')) ->setLabel(t('Revision log message'))
->setDescription(t('The log entry explaining the changes in this revision.')) ->setDescription(t('The log entry explaining the changes in this revision.'))
->setRevisionable(TRUE) ->setRevisionable(TRUE)
->setTranslatable(TRUE); ->setTranslatable(TRUE);
......
...@@ -108,7 +108,7 @@ public function submitForm(array &$form, array &$form_state) { ...@@ -108,7 +108,7 @@ public function submitForm(array &$form, array &$form_state) {
// original one for the confirmation message. // original one for the confirmation message.
$original_revision_timestamp = $this->revision->getRevisionCreationTime(); $original_revision_timestamp = $this->revision->getRevisionCreationTime();
$this->revision->log = t('Copy of the revision from %date.', array('%date' => format_date($original_revision_timestamp))); $this->revision->revision_log = t('Copy of the revision from %date.', array('%date' => format_date($original_revision_timestamp)));
$this->revision->save(); $this->revision->save();
......
...@@ -38,8 +38,8 @@ protected function prepareEntity() { ...@@ -38,8 +38,8 @@ protected function prepareEntity() {
if (!$node->isNew()) { if (!$node->isNew()) {
$node->date = format_date($node->getCreatedTime(), 'custom', 'Y-m-d H:i:s O'); $node->date = format_date($node->getCreatedTime(), 'custom', 'Y-m-d H:i:s O');
// Remove the log message from the original node entity. // Remove the revision log message from the original node entity.
$node->log = NULL; $node->revision_log = NULL;
} }
} }
...@@ -91,8 +91,8 @@ public function form(array $form, array &$form_state) { ...@@ -91,8 +91,8 @@ public function form(array $form, array &$form_state) {
'#weight' => 99, '#weight' => 99,
); );
// Add a log field if the "Create new revision" option is checked, or if // Add a revision log field if the "Create new revision" option is checked,
// the current user has the ability to check that option. // or if the current user has the ability to check that option.
$form['revision_information'] = array( $form['revision_information'] = array(
'#type' => 'details', '#type' => 'details',
'#group' => 'advanced', '#group' => 'advanced',
...@@ -117,11 +117,11 @@ public function form(array $form, array &$form_state) { ...@@ -117,11 +117,11 @@ public function form(array $form, array &$form_state) {
'#group' => 'revision_information', '#group' => 'revision_information',
); );
$form['log'] = array( $form['revision_log'] = array(
'#type' => 'textarea', '#type' => 'textarea',
'#title' => t('Revision log message'), '#title' => t('Revision log message'),
'#rows' => 4, '#rows' => 4,
'#default_value' => !empty($node->log->value) ? $node->log->value : '', '#default_value' => !empty($node->revision_log->value) ? $node->revision_log->value : '',
'#description' => t('Briefly describe the changes you have made.'), '#description' => t('Briefly describe the changes you have made.'),
'#states' => array( '#states' => array(
'visible' => array( 'visible' => array(
......
...@@ -50,7 +50,7 @@ function setUp() { ...@@ -50,7 +50,7 @@ function setUp() {
// Create a revision for the same nid and settings with a random log. // Create a revision for the same nid and settings with a random log.
$revision = clone $nodes[$type]; $revision = clone $nodes[$type];
$revision->setNewRevision(); $revision->setNewRevision();
$revision->log = $this->randomName(32); $revision->revision_log = $this->randomName(32);
$revision->save(); $revision->save();
$this->node_revisions[$type][] = $revision; $this->node_revisions[$type][] = $revision;
} }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
*/ */
class NodeRevisionsAllTestCase extends NodeTestBase { class NodeRevisionsAllTestCase extends NodeTestBase {
protected $nodes; protected $nodes;
protected $logs; protected $revisionLogs;
protected $profile = "standard"; protected $profile = "standard";
public static function getInfo() { public static function getInfo() {
...@@ -55,7 +55,7 @@ function setUp() { ...@@ -55,7 +55,7 @@ function setUp() {
// Create three revisions. // Create three revisions.
$revision_count = 3; $revision_count = 3;
for ($i = 0; $i < $revision_count; $i++) { for ($i = 0; $i < $revision_count; $i++) {
$logs[] = $node->log = $this->randomName(32); $logs[] = $node->revision_log = $this->randomName(32);
// Create revision with a random title and body and update variables. // Create revision with a random title and body and update variables.
$node->title = $this->randomName(); $node->title = $this->randomName();
...@@ -71,7 +71,7 @@ function setUp() { ...@@ -71,7 +71,7 @@ function setUp() {
} }
$this->nodes = $nodes; $this->nodes = $nodes;
$this->logs = $logs; $this->revisionLogs = $logs;
} }
/** /**
...@@ -79,7 +79,7 @@ function setUp() { ...@@ -79,7 +79,7 @@ function setUp() {
*/ */
function testRevisions() { function testRevisions() {
$nodes = $this->nodes; $nodes = $this->nodes;
$logs = $this->logs; $logs = $this->revisionLogs;
// Get last node for simple checks. // Get last node for simple checks.
$node = $nodes[3]; $node = $nodes[3];
...@@ -100,10 +100,11 @@ function testRevisions() { ...@@ -100,10 +100,11 @@ function testRevisions() {
$this->drupalGet("node/" . $node->id() . "/revisions/" . $node->getRevisionId() . "/view"); $this->drupalGet("node/" . $node->id() . "/revisions/" . $node->getRevisionId() . "/view");
$this->assertText($node->body->value, 'Correct text displays for version.'); $this->assertText($node->body->value, 'Correct text displays for version.');
// Confirm the correct log message appears on "revisions overview" page. // Confirm the correct revision log message appears on the "revisions
// overview" page.
$this->drupalGet("node/" . $node->id() . "/revisions"); $this->drupalGet("node/" . $node->id() . "/revisions");
foreach ($logs as $log) { foreach ($logs as $revision_log) {
$this->assertText($log, 'Log message found.'); $this->assertText($revision_log, 'Revision log message found.');
} }
// Confirm that this is the current revision. // Confirm that this is the current revision.
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
*/ */
class NodeRevisionsTest extends NodeTestBase { class NodeRevisionsTest extends NodeTestBase {
protected $nodes; protected $nodes;
protected $logs; protected $revisionLogs;
public static function getInfo() { public static function getInfo() {
return array( return array(
...@@ -55,7 +55,7 @@ function setUp() { ...@@ -55,7 +55,7 @@ function setUp() {
// Create three revisions. // Create three revisions.
$revision_count = 3; $revision_count = 3;
for ($i = 0; $i < $revision_count; $i++) { for ($i = 0; $i < $revision_count; $i++) {
$logs[] = $node->log = $this->randomName(32); $logs[] = $node->revision_log = $this->randomName(32);
// Create revision with a random title and body and update variables. // Create revision with a random title and body and update variables.
$node->title = $this->randomName(); $node->title = $this->randomName();
...@@ -71,7 +71,7 @@ function setUp() { ...@@ -71,7 +71,7 @@ function setUp() {
} }
$this->nodes = $nodes; $this->nodes = $nodes;
$this->logs = $logs; $this->revisionLogs = $logs;
} }
/** /**
...@@ -79,7 +79,7 @@ function setUp() { ...@@ -79,7 +79,7 @@ function setUp() {
*/ */
function testRevisions() { function testRevisions() {
$nodes = $this->nodes; $nodes = $this->nodes;
$logs = $this->logs; $logs = $this->revisionLogs;
// Get last node for simple checks. // Get last node for simple checks.
$node = $nodes[3]; $node = $nodes[3];
...@@ -90,8 +90,8 @@ function testRevisions() { ...@@ -90,8 +90,8 @@ function testRevisions() {
// Confirm the correct log message appears on "revisions overview" page. // Confirm the correct log message appears on "revisions overview" page.
$this->drupalGet("node/" . $node->id() . "/revisions"); $this->drupalGet("node/" . $node->id() . "/revisions");
foreach ($logs as $log) { foreach ($logs as $revision_log) {
$this->assertText($log, 'Log message found.'); $this->assertText($revision_log, 'Revision log message found.');
} }
// Confirm that this is the default revision. // Confirm that this is the default revision.
...@@ -165,8 +165,8 @@ function testRevisions() { ...@@ -165,8 +165,8 @@ function testRevisions() {
*/ */
function testNodeRevisionWithoutLogMessage() { function testNodeRevisionWithoutLogMessage() {
// Create a node with an initial log message. // Create a node with an initial log message.
$log = $this->randomName(10); $revision_log = $this->randomName(10);
$node = $this->drupalCreateNode(array('log' => $log)); $node = $this->drupalCreateNode(array('revision_log' => $revision_log));
// Save over the same revision and explicitly provide an empty log message // 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 // (for example, to mimic the case of a node form submitted with no text in
...@@ -176,17 +176,17 @@ function testNodeRevisionWithoutLogMessage() { ...@@ -176,17 +176,17 @@ function testNodeRevisionWithoutLogMessage() {
$node = clone $node; $node = clone $node;
$node->title = $new_title; $node->title = $new_title;
$node->log = ''; $node->revision_log = '';
$node->setNewRevision(FALSE); $node->setNewRevision(FALSE);
$node->save(); $node->save();
$this->drupalGet('node/' . $node->id()); $this->drupalGet('node/' . $node->id());
$this->assertText($new_title, 'New node title appears on the page.'); $this->assertText($new_title, 'New node title appears on the page.');
$node_revision = node_load($node->id(), TRUE); $node_revision = node_load($node->id(), TRUE);
$this->assertEqual($node_revision->log->value, $log, 'After an existing node revision is re-saved without a log message, the original log message is preserved.'); $this->assertEqual($node_revision->revision_log->value, $revision_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. // Create another node with an initial revision log message.
$node = $this->drupalCreateNode(array('log' => $log)); $node = $this->drupalCreateNode(array('revision_log' => $revision_log));
// Save a new node revision without providing a log message, and check that // Save a new node revision without providing a log message, and check that
// this revision has an empty log message. // this revision has an empty log message.
...@@ -195,12 +195,12 @@ function testNodeRevisionWithoutLogMessage() { ...@@ -195,12 +195,12 @@ function testNodeRevisionWithoutLogMessage() {
$node = clone $node; $node = clone $node;
$node->title = $new_title; $node->title = $new_title;
$node->setNewRevision(); $node->setNewRevision();
$node->log = NULL; $node->revision_log = NULL;
$node->save(); $node->save();
$this->drupalGet('node/' . $node->id()); $this->drupalGet('node/' . $node->id());
$this->assertText($new_title, 'New node title appears on the page.'); $this->assertText($new_title, 'New node title appears on the page.');
$node_revision = node_load($node->id(), TRUE); $node_revision = node_load($node->id(), TRUE);
$this->assertTrue(empty($node_revision->log->value), 'After a new node revision is saved with an empty log message, the log message for the node is empty.'); $this->assertTrue(empty($node_revision->revision_log->value), 'After a new node revision is saved with an empty log message, the log message for the node is empty.');
} }
} }
...@@ -192,7 +192,7 @@ function testPagePreviewWithRevisions() { ...@@ -192,7 +192,7 @@ function testPagePreviewWithRevisions() {
$edit[$title_key] = $this->randomName(8); $edit[$title_key] = $this->randomName(8);
$edit[$body_key] = $this->randomName(16); $edit[$body_key] = $this->randomName(16);
$edit[$term_key] = $this->term->id(); $edit[$term_key] = $this->term->id();
$edit['log'] = $this->randomName(32); $edit['revision_log'] = $this->randomName(32);
$this->drupalPostForm('node/add/page', $edit, t('Preview')); $this->drupalPostForm('node/add/page', $edit, t('Preview'));
// Check that the preview is displaying the title, body and term. // Check that the preview is displaying the title, body and term.
...@@ -206,8 +206,8 @@ function testPagePreviewWithRevisions() { ...@@ -206,8 +206,8 @@ function testPagePreviewWithRevisions() {
$this->assertFieldByName($body_key, $edit[$body_key], 'Body field displayed.'); $this->assertFieldByName($body_key, $edit[$body_key], 'Body field displayed.');
$this->assertFieldByName($term_key, $edit[$term_key], 'Term field displayed.'); $this->assertFieldByName($term_key, $edit[$term_key], 'Term field displayed.');