function ConfigEntityListMultilingualTest::testListUI

Same name in other branches
  1. 9 core/modules/config/tests/src/Functional/ConfigEntityListMultilingualTest.php \Drupal\Tests\config\Functional\ConfigEntityListMultilingualTest::testListUI()
  2. 8.9.x core/modules/config/tests/src/Functional/ConfigEntityListMultilingualTest.php \Drupal\Tests\config\Functional\ConfigEntityListMultilingualTest::testListUI()
  3. 10 core/modules/config/tests/src/Functional/ConfigEntityListMultilingualTest.php \Drupal\Tests\config\Functional\ConfigEntityListMultilingualTest::testListUI()

Tests the listing UI with different language scenarios.

File

core/modules/config/tests/src/Functional/ConfigEntityListMultilingualTest.php, line 44

Class

ConfigEntityListMultilingualTest
Tests the listing of configuration entities in a multilingual scenario.

Namespace

Drupal\Tests\config\Functional

Code

public function testListUI() : void {
    // Log in as an administrative user to access the full menu trail.
    $this->drupalLogin($this->drupalCreateUser([
        'access administration pages',
        'administer site configuration',
    ]));
    // Get the list page.
    $this->drupalGet('admin/structure/config_test');
    $this->assertSession()
        ->linkByHrefExists('admin/structure/config_test/manage/dotted.default');
    // Add a new entity using the action link.
    $this->clickLink('Add test configuration');
    $edit = [
        'label' => 'Antilop',
        'id' => 'antilop',
        'langcode' => 'hu',
    ];
    $this->submitForm($edit, 'Save');
    // Ensure that operations for editing the Hungarian entity appear in English.
    $this->assertSession()
        ->linkByHrefExists('admin/structure/config_test/manage/antilop');
    // Get the list page in Hungarian and assert Hungarian admin links
    // regardless of language of config entities.
    $this->drupalGet('hu/admin/structure/config_test');
    $this->assertSession()
        ->linkByHrefExists('hu/admin/structure/config_test/manage/dotted.default');
    $this->assertSession()
        ->linkByHrefExists('hu/admin/structure/config_test/manage/antilop');
}

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