function AggregatorTestBase::updateAndDelete

Same name in this branch
  1. 8.9.x core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php \Drupal\Tests\aggregator\Functional\AggregatorTestBase::updateAndDelete()
Same name and namespace in other branches
  1. 9 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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.