LocaleNonInteractiveInstallTest.php in Drupal 10
File
core/modules/locale/tests/src/Functional/LocaleNonInteractiveInstallTest.php
View source
<?php
namespace Drupal\Tests\locale\Functional;
use Drupal\Tests\BrowserTestBase;
class LocaleNonInteractiveInstallTest extends BrowserTestBase {
protected $defaultTheme = 'stark';
protected function getVersionStringToTest() {
include_once $this->root . '/core/includes/install.core.inc';
$version = _install_get_version_info(\Drupal::VERSION);
return $version['major'] . '.0.0';
}
protected function installParameters() {
$parameters = parent::installParameters();
$parameters['parameters']['langcode'] = 'de';
\Drupal::service('file_system')
->mkdir($this->publicFilesDirectory . '/translations', NULL, TRUE);
$contents = <<<ENDPO
msgid ""
msgstr ""
msgid "Enter the password that accompanies your username."
msgstr "Geben sie das Passwort für ihren Benutzernamen ein."
ENDPO;
$version = $this
->getVersionStringToTest();
file_put_contents($this->publicFilesDirectory . "/translations/drupal-{$version}.de.po", $contents);
return $parameters;
}
public function testInstallerTranslations() {
$this
->drupalGet('user/login');
$this
->assertSession()
->responseContains('Geben sie das Passwort für ihren Benutzernamen ein.');
}
}