diff --git a/core/modules/action/lib/Drupal/action/Tests/BulkFormTest.php b/core/modules/action/lib/Drupal/action/Tests/BulkFormTest.php
index 8a2cb91..8a86279 100644
--- a/core/modules/action/lib/Drupal/action/Tests/BulkFormTest.php
+++ b/core/modules/action/lib/Drupal/action/Tests/BulkFormTest.php
@@ -37,7 +37,14 @@ public static function getInfo() {
   public function testBulkForm() {
     $nodes = array();
     for ($i = 0; $i < 10; $i++) {
-      $nodes[] = $this->drupalCreateNode(array('sticky' => FALSE));
+      // Ensure nodes are sorted in the same order they are inserted in the
+      // array.
+      $timestamp = REQUEST_TIME - $i;
+      $nodes[] = $this->drupalCreateNode(array(
+        'sticky' => FALSE,
+        'created' => $timestamp,
+        'changed' => $timestamp,
+      ));
     }
 
     $this->drupalGet('test_bulk_form');
diff --git a/core/modules/node/node.admin.inc b/core/modules/node/node.admin.inc
index 052cf72..cf30004 100644
--- a/core/modules/node/node.admin.inc
+++ b/core/modules/node/node.admin.inc
@@ -490,7 +490,7 @@ function node_admin_nodes() {
   }
   $header['operations'] = array('data' => t('Operations'));
 
-  $query = entity_query('node')
+  $query = Drupal::entityQuery('node')
     ->pager(50)
     ->tableSort($header)
     // Provide a default sort.
@@ -501,7 +501,7 @@ function node_admin_nodes() {
     // If the user is able to view their own unpublished nodes, allow them
     // to see these in addition to published nodes. Check that they actually
     // have some unpublished nodes to view before adding the condition.
-    if (user_access('view own unpublished content') && $own_unpublished = entity_query('node')->condition('uid', $GLOBALS['user']->uid)->condition('status', 0)->execute()) {
+    if (user_access('view own unpublished content') && $own_unpublished = Drupal::entityQuery('node')->condition('uid', $GLOBALS['user']->uid)->condition('status', 0)->execute()) {
       $query->condition(
         $query->orConditionGroup()
           ->condition('status', 1)
