public function FeedTest::testStartCronImport in Feeds 8.3
@covers ::startCronImport @covers ::getQueuedTime
File
- tests/
src/ Kernel/ Entity/ FeedTest.php, line 145
Class
- FeedTest
- @coversDefaultClass \Drupal\feeds\Entity\Feed @group feeds
Namespace
Drupal\Tests\feeds\Kernel\EntityCode
public function testStartCronImport() {
$this
->installSchema('system', [
'key_value_expire',
]);
$feed = $this
->createFeed($this->feedType
->id(), [
'source' => $this
->resourcesPath() . '/rss/googlenewstz.rss2',
]);
// Assert that the item is not queued yet.
$this
->assertEquals(0, $feed
->getQueuedTime());
$queue = \Drupal::service('queue')
->get('feeds_feed_refresh:' . $feed
->bundle());
$this
->assertEquals(0, $queue
->numberOfItems());
$feed
->startCronImport();
$this
->assertGreaterThanOrEqual(\Drupal::time()
->getRequestTime(), $feed
->getQueuedTime());
// Verify that a queue item is created.
$this
->assertEquals(1, $queue
->numberOfItems());
}