function AggregatorTestBase::updateAndRemove

Add and remove feed items and ensure that the count is zero.

Parameters

$feed: Feed object representing the feed.

$expected_count: Expected number of feed items.

1 call to AggregatorTestBase::updateAndRemove()
RemoveFeedItemTest::testRemoveFeedItem in drupal/core/modules/aggregator/lib/Drupal/aggregator/Tests/RemoveFeedItemTest.php
Test running "remove items" from the 'admin/config/services/aggregator' page.

File

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

Class

AggregatorTestBase
Defines a base class for testing aggregator.module.

Namespace

Drupal\aggregator\Tests

Code

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