You are here

class UmamiMultilingualInstallTest in Drupal 10

Same name and namespace in other branches
  1. 8 core/profiles/demo_umami/tests/src/Functional/UmamiMultilingualInstallTest.php \Drupal\Tests\demo_umami\Functional\UmamiMultilingualInstallTest
  2. 9 core/profiles/demo_umami/tests/src/Functional/UmamiMultilingualInstallTest.php \Drupal\Tests\demo_umami\Functional\UmamiMultilingualInstallTest

Tests the multilingual installer installing the Umami profile.

@group Installer

Hierarchy

Expanded class hierarchy of UmamiMultilingualInstallTest

File

core/profiles/demo_umami/tests/src/Functional/UmamiMultilingualInstallTest.php, line 12

Namespace

Drupal\Tests\demo_umami\Functional
View source
class UmamiMultilingualInstallTest extends InstallerTestBase {

  /**
   * {@inheritdoc}
   */
  protected $profile = 'demo_umami';

  /**
   * {@inheritdoc}
   */
  protected $langcode = 'es';

  /**
   * Ensures that Umami can be installed with Spanish as the default language.
   */
  public function testUmami() {
    $this
      ->drupalGet('');

    // cSpell:disable-next-line
    $this
      ->assertSession()
      ->pageTextContains('Quiche mediterráneo profundo');
  }

  /**
   * {@inheritdoc}
   */
  protected function setUpLanguage() {

    // Place custom local translations in the translations directory to avoid
    // getting translations from localize.drupal.org.
    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();
  }

  /**
   * Returns the string for the test .po file.
   *
   * @param string $langcode
   *   The language code.
   *
   * @return string
   *   Contents for the test .po file.
   */
  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;
  }

}

Members