1. 8.2.x core/modules/aggregator/src/Tests/AggregatorCronTest.php
  2. 8.0.x core/modules/aggregator/src/Tests/AggregatorCronTest.php
  3. 8.1.x core/modules/aggregator/src/Tests/AggregatorCronTest.php
  4. 8.3.x core/modules/aggregator/src/Tests/AggregatorCronTest.php

Namespace

Drupal\aggregator\Tests

File

core/modules/aggregator/src/Tests/AggregatorCronTest.php
View source
  1. <?php
  2. namespace Drupal\aggregator\Tests;
  3. /**
  4. * Update feeds on cron.
  5. *
  6. * @group aggregator
  7. */
  8. class AggregatorCronTest extends AggregatorTestBase {
  9. /**
  10. * Adds feeds and updates them via cron process.
  11. */
  12. public function testCron() {
  13. // Create feed and test basic updating on cron.
  14. $this->createSampleNodes();
  15. $feed = $this->createFeed();
  16. $this->cronRun();
  17. $this->assertEqual(5, db_query('SELECT COUNT(*) FROM {aggregator_item} WHERE fid = :fid', array(':fid' => $feed->id()))->fetchField());
  18. $this->deleteFeedItems($feed);
  19. $this->assertEqual(0, db_query('SELECT COUNT(*) FROM {aggregator_item} WHERE fid = :fid', array(':fid' => $feed->id()))->fetchField());
  20. $this->cronRun();
  21. $this->assertEqual(5, db_query('SELECT COUNT(*) FROM {aggregator_item} WHERE fid = :fid', array(':fid' => $feed->id()))->fetchField());
  22. // Test feed locking when queued for update.
  23. $this->deleteFeedItems($feed);
  24. db_update('aggregator_feed')
  25. ->condition('fid', $feed->id())
  26. ->fields(array(
  27. 'queued' => REQUEST_TIME,
  28. ))
  29. ->execute();
  30. $this->cronRun();
  31. $this->assertEqual(0, db_query('SELECT COUNT(*) FROM {aggregator_item} WHERE fid = :fid', array(':fid' => $feed->id()))->fetchField());
  32. db_update('aggregator_feed')
  33. ->condition('fid', $feed->id())
  34. ->fields(array(
  35. 'queued' => 0,
  36. ))
  37. ->execute();
  38. $this->cronRun();
  39. $this->assertEqual(5, db_query('SELECT COUNT(*) FROM {aggregator_item} WHERE fid = :fid', array(':fid' => $feed->id()))->fetchField());
  40. }
  41. }

Classes

Namesort descending Description
AggregatorCronTest Update feeds on cron.