diff --git a/core/modules/node/src/Tests/NodeRevisionsUiTest.php b/core/modules/node/src/Tests/NodeRevisionsUiTest.php index daa4165..b60c81b 100644 --- a/core/modules/node/src/Tests/NodeRevisionsUiTest.php +++ b/core/modules/node/src/Tests/NodeRevisionsUiTest.php @@ -36,20 +36,16 @@ protected function setUp() { parent::setUp(); // Create users. - $this->webUser1 = $this->drupalCreateUser( - array( - 'administer nodes', - 'edit any page content' - ) - ); - $this->webUser2 = $this->drupalCreateUser( - array( - 'administer nodes', - 'edit any page content', - 'view page revisions', - 'access user profiles', - ) - ); + $this->webUser1 = $this->drupalCreateUser([ + 'administer nodes', + 'edit any page content' + ]); + $this->webUser2 = $this->drupalCreateUser([ + 'administer nodes', + 'edit any page content', + 'view page revisions', + 'access user profiles', + ]); } /** @@ -57,7 +53,6 @@ protected function setUp() { */ function testNodeFormSaveWithoutRevision() { $this->drupalLogin($this->webUser1); - $node_storage = $this->container->get('entity.manager')->getStorage('node'); // Set page revision setting 'create new revision'. This will mean new @@ -117,28 +112,37 @@ function testNodeRevisionDoubleEscapeFix() { // Create revision with a random title and body and update variables. $node->title = $this->randomMachineName(); - $node->body = array( + $node->body = [ 'value' => $this->randomMachineName(32), 'format' => filter_default_format(), - ); + ]; $node->setNewRevision(); $node->revision_log->value = 'Revision message with markup.'; $node->save(); - $node = Node::load($node->id()); // Make sure we get revision information. + // Make sure we get revision information. + $node = Node::load($node->id()); $nodes[] = clone $node; $this->drupalGet('node/' . $node->id() . '/revisions'); - $old_revision_message = t('!date by !username', array( - '!date' => \Drupal::l(format_date($nodes[0]->revision_timestamp->value, 'short'), new Url('entity.node.revision', array('node' => $nodes[0]->id(), 'node_revision' => $nodes[0]->getRevisionId()))), + // Assert the old revision message. + $date = format_date($nodes[0]->revision_timestamp->value, 'short'); + $url = new Url('entity.node.revision', ['node' => $nodes[0]->id(), 'node_revision' => $nodes[0]->getRevisionId()]); + $old_revision_message = $this->t('!date by !username', [ + '!date' => \Drupal::l($date, $url), '!username' => $web_user, - )) . (($nodes[0]->revision_log->value != '') ? '

' . $nodes[0]->revision_log->value . '

' : ''); + ]); + $old_revision_message .= $nodes[0]->revision_log->value == '' ? '' : '

' . $nodes[0]->revision_log->value . '

'; $this->assertRaw(SafeMarkup::set($old_revision_message)); - $current_revision_message = t('!date by !username', array( - '!date' => $nodes[1]->link(format_date($nodes[1]->revision_timestamp->value, 'short')), + // Assert the current revision message. + $date = format_date($nodes[1]->revision_timestamp->value, 'short'); + $url = new Url('entity.node.revision', ['node' => $nodes[1]->id(), 'node_revision' => $nodes[1]->getRevisionId()]); + $current_revision_message = $this->t('!date by !username', [ + '!date' => \Drupal::l($date, $url), '!username' => $web_user, - )) . (($nodes[1]->revision_log->value != '') ? '

' . $nodes[1]->revision_log->value . '

' : ''); + ]); + $current_revision_message .= $nodes[1]->revision_log->value == '' ? '' : '

' . $nodes[1]->revision_log->value . '

'; $this->assertRaw(SafeMarkup::set($current_revision_message)); }