Mercurial > hg > isophonics-drupal-site
comparison core/modules/locale/tests/src/Functional/LocaleNonInteractiveInstallTest.php @ 16:c2387f117808
Routine composer update
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 15:07:59 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
15:e200cb7efeb3 | 16:c2387f117808 |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\Tests\locale\Functional; | |
4 | |
5 use Drupal\Tests\BrowserTestBase; | |
6 | |
7 /** | |
8 * Tests installing in a different language with a non-dev version string. | |
9 * | |
10 * @group locale | |
11 */ | |
12 class LocaleNonInteractiveInstallTest extends BrowserTestBase { | |
13 | |
14 /** | |
15 * Gets the version string to use in the translation file. | |
16 * | |
17 * @return string | |
18 * The version string to test, for example, '8.0.0' or '8.6.x'. | |
19 */ | |
20 protected function getVersionStringToTest() { | |
21 include_once $this->root . '/core/includes/install.core.inc'; | |
22 $version = _install_get_version_info(\Drupal::VERSION); | |
23 return $version['major'] . '.0.0'; | |
24 } | |
25 | |
26 /** | |
27 * {@inheritdoc} | |
28 */ | |
29 protected function installParameters() { | |
30 $parameters = parent::installParameters(); | |
31 // Install Drupal in German. | |
32 $parameters['parameters']['langcode'] = 'de'; | |
33 // Create a po file so we don't attempt to download one from | |
34 // localize.drupal.org and to have a test translation that will not change. | |
35 \Drupal::service('file_system')->mkdir($this->publicFilesDirectory . '/translations', NULL, TRUE); | |
36 $contents = <<<ENDPO | |
37 msgid "" | |
38 msgstr "" | |
39 | |
40 msgid "Enter the password that accompanies your username." | |
41 msgstr "Geben sie das Passwort für ihren Benutzernamen ein." | |
42 | |
43 ENDPO; | |
44 $version = $this->getVersionStringToTest(); | |
45 file_put_contents($this->publicFilesDirectory . "/translations/drupal-{$version}.de.po", $contents); | |
46 return $parameters; | |
47 } | |
48 | |
49 /** | |
50 * Tests that the expected translated text appears on the login screen. | |
51 */ | |
52 public function testInstallerTranslations() { | |
53 $this->drupalGet('user/login'); | |
54 $this->assertSession()->responseContains('Geben sie das Passwort für ihren Benutzernamen ein.'); | |
55 } | |
56 | |
57 } |