diff core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents a9cd425dd02b
children
line wrap: on
line diff
--- a/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php	Thu Feb 28 13:11:55 2019 +0000
+++ b/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php	Thu May 09 15:34:47 2019 +0100
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\node\Functional;
 
+use Drupal\Core\Database\Database;
 use Drupal\node\NodeInterface;
 
 /**
@@ -147,7 +148,7 @@
       [
         '@type' => 'Basic page',
         '%title' => $nodes[1]->getTitle(),
-        '%revision-date' => format_date($nodes[1]->getRevisionCreationTime()),
+        '%revision-date' => $this->container->get('date.formatter')->format($nodes[1]->getRevisionCreationTime()),
       ]),
       'Revision reverted.');
     $node_storage->resetCache([$node->id()]);
@@ -172,11 +173,12 @@
     $this->drupalPostForm("node/" . $node->id() . "/revisions/" . $nodes[1]->getRevisionId() . "/delete", [], t('Delete'));
     $this->assertRaw(t('Revision from %revision-date of @type %title has been deleted.',
       [
-        '%revision-date' => format_date($nodes[1]->getRevisionCreationTime()),
+        '%revision-date' => $this->container->get('date.formatter')->format($nodes[1]->getRevisionCreationTime()),
         '@type' => 'Basic page',
         '%title' => $nodes[1]->getTitle(),
       ]),
       'Revision deleted.');
+    $connection = Database::getConnection();
     $this->assertTrue(db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid and vid = :vid',
       [':nid' => $node->id(), ':vid' => $nodes[1]->getRevisionId()])->fetchField() == 0,
       'Revision not found.');
@@ -184,7 +186,7 @@
     // Set the revision timestamp to an older date to make sure that the
     // confirmation message correctly displays the stored revision date.
     $old_revision_date = REQUEST_TIME - 86400;
-    db_update('node_revision')
+    $connection->update('node_revision')
       ->condition('vid', $nodes[2]->getRevisionId())
       ->fields([
         'revision_timestamp' => $old_revision_date,
@@ -194,7 +196,7 @@
     $this->assertRaw(t('@type %title has been reverted to the revision from %revision-date.', [
       '@type' => 'Basic page',
       '%title' => $nodes[2]->getTitle(),
-      '%revision-date' => format_date($old_revision_date),
+      '%revision-date' => $this->container->get('date.formatter')->format($old_revision_date),
     ]));
 
     // Create 50 more revisions in order to trigger paging on the revisions