You are here

protected function DisplayTest::checkTranslationSetting in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Functional/Plugin/DisplayTest.php \Drupal\Tests\views\Functional\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/tests/src/Functional/Plugin/DisplayTest.php
Test translation rendering settings based on entity translatability.

File

core/modules/views/tests/src/Functional/Plugin/DisplayTest.php, line 443

Class

DisplayTest
Tests the basic display plugin.

Namespace

Drupal\Tests\views\Functional\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);
}