public function AggregatorTestBase::updateAndDelete in Drupal 9
Same name and namespace in other branches
- 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.
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\FunctionalCode
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);
}