You are here

protected function BlockContentFieldFilterTest::assertPageCounts in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/block_content/tests/src/Functional/Views/BlockContentFieldFilterTest.php \Drupal\Tests\block_content\Functional\Views\BlockContentFieldFilterTest::assertPageCounts()
  2. 10 core/modules/block_content/tests/src/Functional/Views/BlockContentFieldFilterTest.php \Drupal\Tests\block_content\Functional\Views\BlockContentFieldFilterTest::assertPageCounts()

Asserts that the given block_content translation counts are correct.

Parameters

string $path: Path of the page to test.

array $counts: Array whose keys are languages, and values are the number of times that translation should be shown on the given page.

string $message: Message suffix to display.

1 call to BlockContentFieldFilterTest::assertPageCounts()
BlockContentFieldFilterTest::testFilters in core/modules/block_content/tests/src/Functional/Views/BlockContentFieldFilterTest.php
Tests body and info filters.

File

core/modules/block_content/tests/src/Functional/Views/BlockContentFieldFilterTest.php, line 103

Class

BlockContentFieldFilterTest
Tests block_content field filters with translations.

Namespace

Drupal\Tests\block_content\Functional\Views

Code

protected function assertPageCounts($path, $counts, $message) {

  // Get the text of the page.
  $this
    ->drupalGet($path);
  $text = $this
    ->getTextContent();
  foreach ($counts as $langcode => $count) {
    $this
      ->assertEqual(substr_count($text, $this->blockContentInfos[$langcode]), $count, 'Translation ' . $langcode . ' has count ' . $count . ' with ' . $message);
  }
}