function ConfigTranslationUiThemeTest::testThemeDiscovery

Same name in other branches
  1. 9 core/modules/config_translation/tests/src/Functional/ConfigTranslationUiThemeTest.php \Drupal\Tests\config_translation\Functional\ConfigTranslationUiThemeTest::testThemeDiscovery()
  2. 10 core/modules/config_translation/tests/src/Functional/ConfigTranslationUiThemeTest.php \Drupal\Tests\config_translation\Functional\ConfigTranslationUiThemeTest::testThemeDiscovery()
  3. 11.x core/modules/config_translation/tests/src/Functional/ConfigTranslationUiThemeTest.php \Drupal\Tests\config_translation\Functional\ConfigTranslationUiThemeTest::testThemeDiscovery()

Tests that theme provided *.config_translation.yml files are found.

File

core/modules/config_translation/tests/src/Functional/ConfigTranslationUiThemeTest.php, line 62

Class

ConfigTranslationUiThemeTest
Verifies theme configuration translation settings.

Namespace

Drupal\Tests\config_translation\Functional

Code

public function testThemeDiscovery() {
    // Install the test theme and rebuild routes.
    $theme = 'config_translation_test_theme';
    $this->drupalLogin($this->adminUser);
    $this->drupalGet('admin/appearance');
    $elements = $this->xpath('//a[normalize-space()=:label and contains(@href, :theme)]', [
        ':label' => 'Install and set as default',
        ':theme' => $theme,
    ]);
    $this->drupalGet($GLOBALS['base_root'] . $elements[0]->getAttribute('href'), [
        'external' => TRUE,
    ]);
    $translation_base_url = 'admin/config/development/performance/translate';
    $this->drupalGet($translation_base_url);
    $this->assertSession()
        ->statusCodeEquals(200);
    $this->assertLinkByHref("{$translation_base_url}/fr/add");
}

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