function DisplayTest::testTranslationSetting

Same name in other branches
  1. 9 core/modules/views/tests/src/Functional/Plugin/DisplayTest.php \Drupal\Tests\views\Functional\Plugin\DisplayTest::testTranslationSetting()
  2. 10 core/modules/views/tests/src/Functional/Plugin/DisplayTest.php \Drupal\Tests\views\Functional\Plugin\DisplayTest::testTranslationSetting()
  3. 11.x core/modules/views/tests/src/Functional/Plugin/DisplayTest.php \Drupal\Tests\views\Functional\Plugin\DisplayTest::testTranslationSetting()

Test translation rendering settings based on entity translatability.

File

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

Class

DisplayTest
Tests the basic display plugin.

Namespace

Drupal\Tests\views\Functional\Plugin

Code

public function testTranslationSetting() {
    \Drupal::service('module_installer')->install([
        'file',
    ]);
    \Drupal::service('router.builder')->rebuild();
    // By default there should be no language settings.
    $this->checkTranslationSetting();
    \Drupal::service('module_installer')->install([
        'language',
    ]);
    // Enabling the language module should not make a difference.
    $this->checkTranslationSetting();
    // Making the site multilingual should let translatable entity types support
    // translation rendering.
    ConfigurableLanguage::createFromLangcode('it')->save();
    $this->checkTranslationSetting(TRUE);
}

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