function RowEntityRenderersTest::checkLanguageRenderers
Same name in other branches
- 8.9.x core/modules/views/tests/src/Kernel/Entity/RowEntityRenderersTest.php \Drupal\Tests\views\Kernel\Entity\RowEntityRenderersTest::checkLanguageRenderers()
- 10 core/modules/views/tests/src/Kernel/Entity/RowEntityRenderersTest.php \Drupal\Tests\views\Kernel\Entity\RowEntityRenderersTest::checkLanguageRenderers()
- 11.x core/modules/views/tests/src/Kernel/Entity/RowEntityRenderersTest.php \Drupal\Tests\views\Kernel\Entity\RowEntityRenderersTest::checkLanguageRenderers()
Checks that the language renderer configurations work as expected.
Parameters
string $display: Name of display to test with.
array $values: An array of node information which are each an array of node titles associated with language keys appropriate for the translation of that node.
2 calls to RowEntityRenderersTest::checkLanguageRenderers()
- RowEntityRenderersTest::testEntityRenderers in core/
modules/ views/ tests/ src/ Kernel/ Entity/ RowEntityRenderersTest.php - Tests the entity row renderers.
- RowEntityRenderersTest::testFieldRenderers in core/
modules/ views/ tests/ src/ Kernel/ Entity/ RowEntityRenderersTest.php - Tests the field row renderers.
File
-
core/
modules/ views/ tests/ src/ Kernel/ Entity/ RowEntityRenderersTest.php, line 176
Class
- RowEntityRenderersTest
- Tests the entity row renderers.
Namespace
Drupal\Tests\views\Kernel\EntityCode
protected function checkLanguageRenderers($display, $values) {
$expected = [
$values[0]['en'],
$values[0]['en'],
$values[0]['en'],
$values[1]['en'],
$values[1]['en'],
$values[1]['en'],
$values[2]['en'],
$values[2]['en'],
$values[2]['en'],
];
$this->assertTranslations($display, '***LANGUAGE_language_content***', $expected, 'The current language renderer behaves as expected.');
$expected = [
$values[0]['en'],
$values[0]['en'],
$values[0]['en'],
$values[1]['l0'],
$values[1]['l0'],
$values[1]['l0'],
$values[2]['l1'],
$values[2]['l1'],
$values[2]['l1'],
];
$this->assertTranslations($display, '***LANGUAGE_entity_default***', $expected, 'The default language renderer behaves as expected.');
$expected = [
$values[0]['en'],
$values[0]['l0'],
$values[0]['l1'],
$values[1]['en'],
$values[1]['l0'],
$values[1]['l1'],
$values[2]['en'],
$values[2]['l0'],
$values[2]['l1'],
];
$this->assertTranslations($display, '***LANGUAGE_entity_translation***', $expected, 'The translation language renderer behaves as expected.');
$expected = [
$values[0][$this->langcodes[0]],
$values[0][$this->langcodes[0]],
$values[0][$this->langcodes[0]],
$values[1][$this->langcodes[0]],
$values[1][$this->langcodes[0]],
$values[1][$this->langcodes[0]],
$values[2][$this->langcodes[0]],
$values[2][$this->langcodes[0]],
$values[2][$this->langcodes[0]],
];
$this->assertTranslations($display, '***LANGUAGE_site_default***', $expected, 'The site default language renderer behaves as expected.');
$expected = [
$values[0]['l0'],
$values[0]['l0'],
$values[0]['l0'],
$values[1]['l0'],
$values[1]['l0'],
$values[1]['l0'],
$values[2]['l0'],
$values[2]['l0'],
$values[2]['l0'],
];
$this->assertTranslations($display, 'l0', $expected, 'The language specific renderer behaves as expected.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.