function InstallerLanguageTest::testInstallerTranslationCache

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/KernelTests/Core/Installer/InstallerLanguageTest.php \Drupal\KernelTests\Core\Installer\InstallerLanguageTest::testInstallerTranslationCache()
  2. 10 core/tests/Drupal/KernelTests/Core/Installer/InstallerLanguageTest.php \Drupal\KernelTests\Core\Installer\InstallerLanguageTest::testInstallerTranslationCache()
  3. 11.x core/tests/Drupal/KernelTests/Core/Installer/InstallerLanguageTest.php \Drupal\KernelTests\Core\Installer\InstallerLanguageTest::testInstallerTranslationCache()

Tests profile info caching in non-English languages.

File

core/tests/Drupal/KernelTests/Core/Installer/InstallerLanguageTest.php, line 46

Class

InstallerLanguageTest
Tests for installer language support.

Namespace

Drupal\KernelTests\Core\Installer

Code

public function testInstallerTranslationCache() {
    require_once 'core/includes/install.inc';
    // Prime the \Drupal\Core\Extension\ExtensionList::getPathname() static
    // cache with the location of the testing profile as it isn't the currently
    // active profile and we don't yet have any cached way to retrieve its
    // location.
    // @todo Remove as part of https://www.drupal.org/node/2186491
    $profile_list = \Drupal::service('extension.list.profile');
    assert($profile_list instanceof ProfileExtensionList);
    $profile_list->setPathname('testing', 'core/profiles/testing/testing.info.yml');
    $info_en = install_profile_info('testing', 'en');
    $info_nl = install_profile_info('testing', 'nl');
    $this->assertNotContains('locale', $info_en['install'], 'Locale is not set when installing in English.');
    $this->assertContains('locale', $info_nl['install'], 'Locale is set when installing in Dutch.');
}

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