UploadFetcherTest.php in Feeds 8.3
File
tests/src/Functional/Feeds/Fetcher/UploadFetcherTest.php
View source
<?php
namespace Drupal\Tests\feeds\Functional\Feeds\Fetcher;
use Drupal\feeds\Entity\Feed;
use Drupal\Tests\feeds\Functional\FeedsBrowserTestBase;
class UploadFetcherTest extends FeedsBrowserTestBase {
protected $feedType;
protected function setUp() {
parent::setUp();
$this->feedType = $this
->createFeedType([
'fetcher' => 'upload',
'fetcher_configuration' => [
'allowed_extensions' => 'atom rss rss1 rss2 opml xml',
],
]);
}
public function testImportSingleFile() {
$edit = [
'title[0][value]' => $this
->randomMachineName(),
'files[plugin_fetcher_source]' => \Drupal::service('file_system')
->realpath($this
->resourcesPath() . '/rss/googlenewstz.rss2'),
];
$this
->drupalPostForm('feed/add/' . $this->feedType
->id(), $edit, t('Save and import'));
$feed = Feed::load(1);
static::assertEquals(6, $feed
->getItemCount());
$this
->assertNodeCount(6);
}
}