You are here

public function UpdateNonExistentTest::testEmptyCleanListAfterClearingStates in Feeds 8.3

Tests if the feeds clean list gets empty after clearing states.

File

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

Class

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

Namespace

Drupal\Tests\feeds\Kernel

Code

public function testEmptyCleanListAfterClearingStates() {

  // 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);

  // Clear states.
  $feed
    ->clearStates();

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