FeedDeleteTest.php in Feeds 8.3
File
tests/src/Functional/FeedDeleteTest.php
View source
<?php
namespace Drupal\Tests\feeds\Functional;
class FeedDeleteTest extends FeedsBrowserTestBase {
public function testFeedDelete() {
$feed_type = $this
->createFeedType();
$feed = $this
->createFeed($feed_type
->id(), [
'source' => $this
->resourcesPath() . '/rss/googlenewstz.rss2',
]);
$this
->drupalPostForm('/feed/1/delete', [], 'Delete');
$this
->assertSession()
->pageTextNotContains('The website encountered an unexpected error.');
$this
->assertNull($this
->reloadEntity($feed));
}
public function testFeedDeleteWithImportedItems() {
$feed_type = $this
->createFeedType([
'fetcher' => 'directory',
'fetcher_configuration' => [
'allowed_extensions' => 'atom rss rss1 rss2 opml xml',
],
]);
$feed = $this
->createFeed($feed_type
->id(), [
'source' => $this
->resourcesPath() . '/rss/googlenewstz.rss2',
]);
$feed
->import();
$this
->assertNodeCount(6);
$this
->drupalPostForm('/feed/1/delete', [], 'Delete');
$this
->assertNull($this
->reloadEntity($feed));
$this
->assertSession()
->pageTextNotContains('The website encountered an unexpected error.');
$this
->assertNodeCount(6);
}
public function testOrphanedFeedDelete() {
$feed_type = $this
->createFeedType();
$feed = $this
->createFeed($feed_type
->id(), [
'source' => $this
->resourcesPath() . '/rss/googlenewstz.rss2',
]);
$feed_type
->delete();
$this
->drupalPostForm('/feed/1/delete', [], 'Delete');
$this
->assertSession()
->pageTextNotContains('The website encountered an unexpected error.');
$this
->assertNull($this
->reloadEntity($feed));
}
}