You are here

public function AggregatorTestBase::updateAndDelete in Drupal 8

Same name in this branch
  1. 8 core/modules/aggregator/src/Tests/AggregatorTestBase.php \Drupal\aggregator\Tests\AggregatorTestBase::updateAndDelete()
  2. 8 core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php \Drupal\Tests\aggregator\Functional\AggregatorTestBase::updateAndDelete()

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

Parameters

\Drupal\aggregator\FeedInterface $feed: Feed object representing the feed.

int $expected_count: Expected number of feed items.

File

core/modules/aggregator/src/Tests/AggregatorTestBase.php, line 233

Class

AggregatorTestBase
Defines a base class for testing the Aggregator module.

Namespace

Drupal\aggregator\Tests

Code

public function updateAndDelete(FeedInterface $feed, $expected_count) {
  $count_query = \Drupal::entityQuery('aggregator_item')
    ->condition('fid', $feed
    ->id())
    ->count();
  $this
    ->updateFeedItems($feed, $expected_count);
  $count = $count_query
    ->execute();
  $this
    ->assertTrue($count);
  $this
    ->deleteFeedItems($feed);
  $count = $count_query
    ->execute();
  $this
    ->assertTrue($count == 0);
}