You are here

protected function DisplayTest::checkTranslationSetting in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Tests/Plugin/DisplayTest.php \Drupal\views\Tests\Plugin\DisplayTest::checkTranslationSetting()

Asserts a node and a file based view for the translation setting.

The file based view should never expose that setting. The node based view should if the site is multilingual.

Parameters

bool $expected_node_translatability: Whether the node based view should be expected to support translation settings.

1 call to DisplayTest::checkTranslationSetting()
DisplayTest::testTranslationSetting in core/modules/views/src/Tests/Plugin/DisplayTest.php
Test translation rendering settings based on entity translatability.

File

core/modules/views/src/Tests/Plugin/DisplayTest.php, line 385
Contains \Drupal\views\Tests\Plugin\DisplayTest.

Class

DisplayTest
Tests the basic display plugin.

Namespace

Drupal\views\Tests\Plugin

Code

protected function checkTranslationSetting($expected_node_translatability = FALSE) {
  $not_supported_text = 'The view is not based on a translatable entity type or the site is not multilingual.';
  $supported_text = 'All content that supports translations will be displayed in the selected language.';
  $this
    ->drupalGet('admin/structure/views/nojs/display/content/page_1/rendering_language');
  if ($expected_node_translatability) {
    $this
      ->assertNoText($not_supported_text);
    $this
      ->assertText($supported_text);
  }
  else {
    $this
      ->assertText($not_supported_text);
    $this
      ->assertNoText($supported_text);
  }
  $this
    ->drupalGet('admin/structure/views/nojs/display/files/page_1/rendering_language');
  $this
    ->assertText($not_supported_text);
  $this
    ->assertNoText($supported_text);
}