You are here

public function UpdateNonExistentTest::testEmptyCleanListAfterDeletingFeed in Feeds 8.3

Tests if the feeds clean list gets empty after deleting feed.

There could exist records on the clean list if an import ends abruptly, for example.

File

tests/src/Kernel/UpdateNonExistentTest.php, line 208

Class

UpdateNonExistentTest
Tests the feature of updating items that are no longer available in the feed.

Namespace

Drupal\Tests\feeds\Kernel

Code

public function testEmptyCleanListAfterDeletingFeed() {

  // Create a feed.
  $feed = $this
    ->createFeed($this->feedType
    ->id(), [
    'source' => $this
      ->resourcesPath() . '/rss/googlenewstz.rss2',
  ]);

  // Add two records to the feeds_clean_list table for this feed.
  $clean_state = $feed
    ->getState(StateInterface::CLEAN);
  $clean_state
    ->setList([
    123,
    456,
  ]);
  $this
    ->assertCleanListCount(2, $feed);

  // Delete the feed.
  $feed
    ->delete();

  // Assert that the clean list is now empty for this feed.
  $this
    ->assertCleanListEmpty($feed);
}