You are here

public function AggregatorTestBase::getDefaultFeedItemCount in Drupal 8

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

Returns the count of the randomly created feed array.

Return value

int Number of feed items on default feed created by createFeed().

File

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

Class

AggregatorTestBase
Defines a base class for testing the Aggregator module.

Namespace

Drupal\aggregator\Tests

Code

public function getDefaultFeedItemCount() {

  // Our tests are based off of rss.xml, so let's find out how many elements
  // should be related.
  $feed_count = \Drupal::entityQuery('node')
    ->condition('promote', NodeInterface::PROMOTED)
    ->condition('status', NodeInterface::PUBLISHED)
    ->accessCheck(FALSE)
    ->range(0, $this
    ->config('system.rss')
    ->get('items.limit'))
    ->count()
    ->execute();
  return min($feed_count, 10);
}