3 namespace Drupal\Tests\config_translation\Functional;
5 use Drupal\language\Entity\ConfigurableLanguage;
6 use Drupal\Tests\BrowserTestBase;
9 * Verifies theme configuration translation settings.
11 * @group config_translation
13 class ConfigTranslationUiThemeTest extends BrowserTestBase {
20 public static $modules = ['config_translation', 'config_translation_test'];
23 * Languages to enable.
27 protected $langcodes = ['fr', 'ta'];
30 * Administrator user for tests.
32 * @var \Drupal\user\UserInterface
36 protected function setUp() {
39 $admin_permissions = [
41 'administer languages',
42 'administer site configuration',
43 'translate configuration',
45 // Create and log in user.
46 $this->adminUser = $this->drupalCreateUser($admin_permissions);
49 foreach ($this->langcodes as $langcode) {
50 ConfigurableLanguage::createFromLangcode($langcode)->save();
55 * Tests that theme provided *.config_translation.yml files are found.
57 public function testThemeDiscovery() {
58 // Install the test theme and rebuild routes.
59 $theme = 'config_translation_test_theme';
61 $this->drupalLogin($this->adminUser);
63 $this->drupalGet('admin/appearance');
64 $elements = $this->xpath('//a[normalize-space()=:label and contains(@href, :theme)]', [
65 ':label' => 'Install and set as default',
68 $this->drupalGet($GLOBALS['base_root'] . $elements[0]->getAttribute('href'), ['external' => TRUE]);
70 $translation_base_url = 'admin/config/development/performance/translate';
71 $this->drupalGet($translation_base_url);
72 $this->assertResponse(200);
73 $this->assertLinkByHref("$translation_base_url/fr/add");