You are here

protected function FeedsCommonTrait::assertNodeCount in Feeds 8.3

Asserts that the given number of nodes exist.

Parameters

int $expected_node_count: The expected number of nodes in the node table.

string $message: (optional) The message to assert.

75 calls to FeedsCommonTrait::assertNodeCount()
ConfigEntityReferenceTest::testImportById in tests/src/Kernel/Feeds/Target/ConfigEntityReferenceTest.php
Tests importing config entity references by ID.
ConfigEntityReferenceTest::testImportByLabel in tests/src/Kernel/Feeds/Target/ConfigEntityReferenceTest.php
Tests importing config entity references by label.
ConfigEntityReferenceTest::testImportByUuid in tests/src/Kernel/Feeds/Target/ConfigEntityReferenceTest.php
Tests importing config entity references by UUID.
CronTest::testImportSourceWithMultipleCronRuns in tests/src/Functional/CronTest.php
Tests importing a source that needs multiple cron runs to complete.
CsvParserFeedFormTest::testDelimiterSetting in tests/src/Functional/Feeds/Parser/Form/CsvParserFeedFormTest.php
Tests importing a feed using various delimiters.

... See full list

File

tests/src/Traits/FeedsCommonTrait.php, line 131

Class

FeedsCommonTrait
Provides methods useful for Kernel and Functional Feeds tests.

Namespace

Drupal\Tests\feeds\Traits

Code

protected function assertNodeCount($expected_node_count, $message = '') {
  if (!$message) {
    $message = '@expected nodes have been created (actual: @count).';
  }
  $node_count = $this->container
    ->get('database')
    ->select('node')
    ->fields('node', [])
    ->countQuery()
    ->execute()
    ->fetchField();
  static::assertEquals($expected_node_count, $node_count, strtr($message, [
    '@expected' => $expected_node_count,
    '@count' => $node_count,
  ]));
}