Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / modules / aggregator / tests / src / Functional / AggregatorCronTest.php
index bb7c90ae32f238f02fe266ee3270e064755eb64d..4a3ca0b07d9016e048a41b7d6de59c3a60bf66e6 100644 (file)
@@ -20,31 +20,23 @@ class AggregatorCronTest extends AggregatorTestBase {
     // Create feed and test basic updating on cron.
     $this->createSampleNodes();
     $feed = $this->createFeed();
+    $count_query = \Drupal::entityQuery('aggregator_item')->condition('fid', $feed->id())->count();
+
     $this->cronRun();
-    $this->assertEqual(5, db_query('SELECT COUNT(*) FROM {aggregator_item} WHERE fid = :fid', [':fid' => $feed->id()])->fetchField());
+    $this->assertEqual(5, $count_query->execute());
     $this->deleteFeedItems($feed);
-    $this->assertEqual(0, db_query('SELECT COUNT(*) FROM {aggregator_item} WHERE fid = :fid', [':fid' => $feed->id()])->fetchField());
+    $this->assertEqual(0, $count_query->execute());
     $this->cronRun();
-    $this->assertEqual(5, db_query('SELECT COUNT(*) FROM {aggregator_item} WHERE fid = :fid', [':fid' => $feed->id()])->fetchField());
+    $this->assertEqual(5, $count_query->execute());
 
     // Test feed locking when queued for update.
     $this->deleteFeedItems($feed);
-    db_update('aggregator_feed')
-      ->condition('fid', $feed->id())
-      ->fields([
-        'queued' => REQUEST_TIME,
-      ])
-      ->execute();
+    $feed->setQueuedTime(REQUEST_TIME)->save();
     $this->cronRun();
-    $this->assertEqual(0, db_query('SELECT COUNT(*) FROM {aggregator_item} WHERE fid = :fid', [':fid' => $feed->id()])->fetchField());
-    db_update('aggregator_feed')
-      ->condition('fid', $feed->id())
-      ->fields([
-        'queued' => 0,
-      ])
-      ->execute();
+    $this->assertEqual(0, $count_query->execute());
+    $feed->setQueuedTime(0)->save();
     $this->cronRun();
-    $this->assertEqual(5, db_query('SELECT COUNT(*) FROM {aggregator_item} WHERE fid = :fid', [':fid' => $feed->id()])->fetchField());
+    $this->assertEqual(5, $count_query->execute());
   }
 
 }