public function FeedDeleteTest::testFeedDeleteWithImportedItems in Feeds 8.3
Tests deleting a feed that has imported items.
File
- tests/
src/ Functional/ FeedDeleteTest.php, line 37
Class
- FeedDeleteTest
- Tests deleting a feed using the UI.
Namespace
Drupal\Tests\feeds\FunctionalCode
public function testFeedDeleteWithImportedItems() {
// Create a feed type.
$feed_type = $this
->createFeedType([
'fetcher' => 'directory',
'fetcher_configuration' => [
'allowed_extensions' => 'atom rss rss1 rss2 opml xml',
],
]);
// Add a feed.
$feed = $this
->createFeed($feed_type
->id(), [
'source' => $this
->resourcesPath() . '/rss/googlenewstz.rss2',
]);
// Import data.
$feed
->import();
$this
->assertNodeCount(6);
// Now try to delete this feed.
$this
->drupalPostForm('/feed/1/delete', [], 'Delete');
// Ensure that the feed now no longer exists.
$this
->assertNull($this
->reloadEntity($feed));
// Ensure that no errors are shown.
$this
->assertSession()
->pageTextNotContains('The website encountered an unexpected error.');
// And ensure that the imported content still exists.
$this
->assertNodeCount(6);
}