QueueTest.php in Feeds 8.3
File
tests/src/Functional/QueueTest.php
View source
<?php
namespace Drupal\Tests\feeds\Functional;
class QueueTest extends FeedsBrowserTestBase {
public function testCronImport() {
$feed_type = $this
->createFeedType();
$feed = $this
->createFeed($feed_type
->id(), [
'source' => $this
->resourcesUrl() . '/rss/googlenewstz.rss2',
]);
$feed
->startCronImport();
$this
->cronRun();
$this
->assertNodeCount(6);
}
public function testPushImport() {
$feed_type = $this
->createFeedType();
$feed = $this
->createFeed($feed_type
->id());
$feed
->pushImport(file_get_contents($this
->resourcesPath() . '/rss/googlenewstz.rss2'));
$this
->cronRun();
$this
->assertNodeCount(6);
}
public function testPushImportWithSavedSource() {
$feed_type = $this
->createFeedType();
$feed = $this
->createFeed($feed_type
->id(), [
'source' => $this
->resourcesUrl() . '/rss/drupalplanet.rss2',
]);
$feed
->pushImport(file_get_contents($this
->resourcesPath() . '/rss/googlenewstz.rss2'));
$this
->cronRun();
$this
->assertNodeCount(6);
}
public function testQueueAfterDeletingFeed() {
$feed_type = $this
->createFeedType();
$feed = $this
->createFeed($feed_type
->id(), [
'source' => $this
->resourcesUrl() . '/rss/googlenewstz.rss2',
]);
$feed
->startCronImport();
$this
->cronRun();
$this
->assertNodeCount(6);
$feed
->startCronImport();
$feed
->delete();
$this
->cronRun();
$queue = \Drupal::service('queue')
->get('feeds_feed_refresh:' . $feed_type
->id());
$this
->assertEquals(0, $queue
->numberOfItems());
}
}