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
1 <?php
2
3 namespace Drupal\Tests\aggregator\Functional;
4
5 use Drupal\Tests\Traits\Core\CronRunTrait;
6
7 /**
8  * Update feeds on cron.
9  *
10  * @group aggregator
11  */
12 class AggregatorCronTest extends AggregatorTestBase {
13
14   use CronRunTrait;
15
16   /**
17    * Adds feeds and updates them via cron process.
18    */
19   public function testCron() {
20     // Create feed and test basic updating on cron.
21     $this->createSampleNodes();
22     $feed = $this->createFeed();
23     $count_query = \Drupal::entityQuery('aggregator_item')->condition('fid', $feed->id())->count();
24
25     $this->cronRun();
26     $this->assertEqual(5, $count_query->execute());
27     $this->deleteFeedItems($feed);
28     $this->assertEqual(0, $count_query->execute());
29     $this->cronRun();
30     $this->assertEqual(5, $count_query->execute());
31
32     // Test feed locking when queued for update.
33     $this->deleteFeedItems($feed);
34     $feed->setQueuedTime(REQUEST_TIME)->save();
35     $this->cronRun();
36     $this->assertEqual(0, $count_query->execute());
37     $feed->setQueuedTime(0)->save();
38     $this->cronRun();
39     $this->assertEqual(5, $count_query->execute());
40   }
41
42 }