public function InstallerLanguageTest::testInstallerTranslationFiles in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/KernelTests/Core/Installer/InstallerLanguageTest.php \Drupal\KernelTests\Core\Installer\InstallerLanguageTest::testInstallerTranslationFiles()
- 10 core/tests/Drupal/KernelTests/Core/Installer/InstallerLanguageTest.php \Drupal\KernelTests\Core\Installer\InstallerLanguageTest::testInstallerTranslationFiles()
Tests that the installer can find translation files.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Installer/ InstallerLanguageTest.php, line 19
Class
- InstallerLanguageTest
- Tests for installer language support.
Namespace
Drupal\KernelTests\Core\InstallerCode
public function testInstallerTranslationFiles() {
// Different translation files would be found depending on which language
// we are looking for.
$expected_translation_files = [
NULL => [
'drupal-8.0.0-beta2.hu.po',
'drupal-8.0.0.de.po',
'drupal-8.0.x.fr-CA.po',
],
'de' => [
'drupal-8.0.0.de.po',
],
'fr-CA' => [
'drupal-8.0.x.fr-CA.po',
],
'hu' => [
'drupal-8.0.0-beta2.hu.po',
],
'it' => [],
];
// Hardcode the fixtures location as we don't yet know where it is.
// @todo Remove as part of https://www.drupal.org/node/2186491
$file_translation = new FileTranslation('core/tests/fixtures/files/translations', $this->container
->get('file_system'));
foreach ($expected_translation_files as $langcode => $files_expected) {
$files_found = $file_translation
->findTranslationFiles($langcode);
$this
->assertTrue(count($files_found) == count($files_expected), new FormattableMarkup('@count installer languages found.', [
'@count' => count($files_expected),
]));
foreach ($files_found as $file) {
$this
->assertContains($file->filename, $files_expected, new FormattableMarkup('@file found.', [
'@file' => $file->filename,
]));
}
}
}