function DisplayTest::checkTranslationSetting

Same name in other branches
  1. 8.9.x core/modules/views/tests/src/Functional/Plugin/DisplayTest.php \Drupal\Tests\views\Functional\Plugin\DisplayTest::checkTranslationSetting()
  2. 10 core/modules/views/tests/src/Functional/Plugin/DisplayTest.php \Drupal\Tests\views\Functional\Plugin\DisplayTest::checkTranslationSetting()
  3. 11.x 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
Tests translation rendering settings based on entity translatability.

File

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

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->assertSession()
            ->pageTextNotContains($not_supported_text);
        $this->assertSession()
            ->pageTextContains($supported_text);
    }
    else {
        $this->assertSession()
            ->pageTextContains($not_supported_text);
        $this->assertSession()
            ->pageTextNotContains($supported_text);
    }
    $this->drupalGet('admin/structure/views/nojs/display/files/page_1/rendering_language');
    $this->assertSession()
        ->pageTextContains($not_supported_text);
    $this->assertSession()
        ->pageTextNotContains($supported_text);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.