UmamiMultilingualInstallTest.php in Drupal 10
File
core/profiles/demo_umami/tests/src/Functional/UmamiMultilingualInstallTest.php
View source
<?php
namespace Drupal\Tests\demo_umami\Functional;
use Drupal\FunctionalTests\Installer\InstallerTestBase;
class UmamiMultilingualInstallTest extends InstallerTestBase {
protected $profile = 'demo_umami';
protected $langcode = 'es';
public function testUmami() {
$this
->drupalGet('');
$this
->assertSession()
->pageTextContains('Quiche mediterráneo profundo');
}
protected function setUpLanguage() {
mkdir(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE);
file_put_contents(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.es.po', $this
->getPo('es'));
parent::setUpLanguage();
}
protected function getPo($langcode) {
return <<<ENDPO
msgid ""
msgstr ""
msgid "Save and continue"
msgstr "Save and continue {<span class="php-variable">$langcode</span>}"
msgid "Anonymous"
msgstr "Anonymous {<span class="php-variable">$langcode</span>}"
msgid "Language"
msgstr "Language {<span class="php-variable">$langcode</span>}"
#: Testing site name configuration during the installer.
msgid "Drupal"
msgstr "Drupal"
ENDPO;
}
}