function AggregatorTestBase::updateAndDelete

Same name in other branches
  1. 8.9.x core/modules/aggregator/src/Tests/AggregatorTestBase.php \Drupal\aggregator\Tests\AggregatorTestBase::updateAndDelete()
  2. 8.9.x 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.

2 calls to AggregatorTestBase::updateAndDelete()
DeleteFeedItemTest::testDeleteFeedItem in core/modules/aggregator/tests/src/Functional/DeleteFeedItemTest.php
Tests running "delete items" from 'admin/config/services/aggregator' page.
FeedProcessorPluginTest::testDelete in core/modules/aggregator/tests/src/Functional/FeedProcessorPluginTest.php
Tests deleting functionality.

File

core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php, line 236

Class

AggregatorTestBase
Defines a base class for testing the Aggregator module.

Namespace

Drupal\Tests\aggregator\Functional

Code

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

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