function ConfigTranslationOverviewTest::testListingPageWithOverrides

Same name and namespace in other branches
  1. 8.9.x core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php \Drupal\Tests\config_translation\Functional\ConfigTranslationOverviewTest::testListingPageWithOverrides()
  2. 10 core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php \Drupal\Tests\config_translation\Functional\ConfigTranslationOverviewTest::testListingPageWithOverrides()
  3. 11.x core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php \Drupal\Tests\config_translation\Functional\ConfigTranslationOverviewTest::testListingPageWithOverrides()

Tests that overrides do not affect listing screens.

File

core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php, line 160

Class

ConfigTranslationOverviewTest
Translate settings and entities to various languages.

Namespace

Drupal\Tests\config_translation\Functional

Code

public function testListingPageWithOverrides() {
    $original_label = 'Default';
    $overridden_label = 'Overridden label';
    $config_test_storage = $this->container
        ->get('entity_type.manager')
        ->getStorage('config_test');
    // Set up an override.
    $settings['config']['config_test.dynamic.dotted.default']['label'] = (object) [
        'value' => $overridden_label,
        'required' => TRUE,
    ];
    $this->writeSettings($settings);
    // Test that the overridden label is loaded with the entity.
    $this->assertEquals($overridden_label, $config_test_storage->load('dotted.default')
        ->label());
    // Test that the original label on the listing page is intact.
    $this->drupalGet('admin/config/regional/config-translation/config_test');
    $this->assertSession()
        ->pageTextContains($original_label);
    $this->assertSession()
        ->pageTextNotContains($overridden_label);
}

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