You are here

public function AggregatorTestBase::updateAndDelete in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/aggregator/src/Tests/AggregatorTestBase.php \Drupal\aggregator\Tests\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/src/Tests/DeleteFeedItemTest.php
Tests running "delete items" from 'admin/config/services/aggregator' page.
FeedProcessorPluginTest::testDelete in core/modules/aggregator/src/Tests/FeedProcessorPluginTest.php
Test deleting functionality.

File

core/modules/aggregator/src/Tests/AggregatorTestBase.php, line 211
Contains \Drupal\aggregator\Tests\AggregatorTestBase.

Class

AggregatorTestBase
Defines a base class for testing the Aggregator module.

Namespace

Drupal\aggregator\Tests

Code

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