function BlockContentFieldFilterTest::assertPageCounts
Same name in other branches
- 9 core/modules/block_content/tests/src/Functional/Views/BlockContentFieldFilterTest.php \Drupal\Tests\block_content\Functional\Views\BlockContentFieldFilterTest::assertPageCounts()
- 8.9.x core/modules/block_content/tests/src/Functional/Views/BlockContentFieldFilterTest.php \Drupal\Tests\block_content\Functional\Views\BlockContentFieldFilterTest::assertPageCounts()
- 11.x 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.
@internal
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 107
Class
- BlockContentFieldFilterTest
- Tests block_content field filters with translations.
Namespace
Drupal\Tests\block_content\Functional\ViewsCode
protected function assertPageCounts(string $path, array $counts, string $message) : void {
// Get the text of the page.
$this->drupalGet($path);
$text = $this->getTextContent();
foreach ($counts as $langcode => $count) {
$this->assertEquals($count, substr_count($text, $this->blockContentInfos[$langcode]), 'Translation ' . $langcode . ' has count ' . $count . ' with ' . $message);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.