function AggregatorTestBase::updateAndRemove

Adds and removes feed items and ensure that the count is zero.

Parameters

\Drupal\aggregator\Plugin\Core\Entity\Feed $feed: Feed object representing the feed.

int $expected_count: Expected number of feed items.

2 calls to AggregatorTestBase::updateAndRemove()
FeedProcessorPluginTest::testRemove in drupal/core/modules/aggregator/lib/Drupal/aggregator/Tests/FeedProcessorPluginTest.php
Test removing functionality.
RemoveFeedItemTest::testRemoveFeedItem in drupal/core/modules/aggregator/lib/Drupal/aggregator/Tests/RemoveFeedItemTest.php
Tests running "remove items" from 'admin/config/services/aggregator' page.

File

drupal/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorTestBase.php, line 201
Definition of Drupal\aggregator\Tests\AggregatorTestBase.

Class

AggregatorTestBase
Defines a base class for testing the Aggregator module.

Namespace

Drupal\aggregator\Tests

Code

function updateAndRemove(Feed $feed, $expected_count) {
  $this
    ->updateFeedItems($feed, $expected_count);
  $count = db_query('SELECT COUNT(*) FROM {aggregator_item} WHERE fid = :fid', array(
    ':fid' => $feed
      ->id(),
  ))
    ->fetchField();
  $this
    ->assertTrue($count);
  $this
    ->removeFeedItems($feed);
  $count = db_query('SELECT COUNT(*) FROM {aggregator_item} WHERE fid = :fid', array(
    ':fid' => $feed
      ->id(),
  ))
    ->fetchField();
  $this
    ->assertTrue($count == 0);
}