You are here

protected function RowEntityRenderersTest::checkLanguageRenderers in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Tests/Entity/RowEntityRenderersTest.php \Drupal\views\Tests\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/src/Tests/Entity/RowEntityRenderersTest.php
Tests the entity row renderers.
RowEntityRenderersTest::testFieldRenderers in core/modules/views/src/Tests/Entity/RowEntityRenderersTest.php
Tests the field row renderers.

File

core/modules/views/src/Tests/Entity/RowEntityRenderersTest.php, line 128
Contains \Drupal\views\Tests\Entity\RowEntityRenderersTest.

Class

RowEntityRenderersTest
Tests the entity row renderers.

Namespace

Drupal\views\Tests\Entity

Code

protected function checkLanguageRenderers($display, $values) {
  $expected = array(
    $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 = array(
    $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 = array(
    $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 = array(
    $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 = array(
    $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.');
}