ConfigInstallerEnSecondTest.php in Configuration installer 8
File
tests/src/Functional/ConfigInstallerEnSecondTest.php
View source
<?php
namespace Drupal\Tests\config_installer\Functional;
use Drupal\language\Entity\ConfigurableLanguage;
class ConfigInstallerEnSecondTest extends ConfigInstallerTestBase {
protected function setUpSyncForm() {
$this
->drupalPostForm(NULL, [
'files[import_tarball]' => $this
->getTarball(),
], 'Save and continue');
}
public function testInstaller() {
require_once \Drupal::root() . '/core/includes/install.inc';
$this
->assertRaw(t('Congratulations, you installed @drupal fr!', [
'@drupal' => drupal_install_profile_distribution_name(),
]));
$this
->assertEqual('fr', \Drupal::config('system.site')
->get('default_langcode'));
$this
->assertTrue(ConfigurableLanguage::load('en'), "The language 'en' exists");
$this
->assertTrue(\Drupal::service('language_manager')
->isMultilingual());
}
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.fr.po', $this
->getPo('fr'));
parent::setUpLanguage();
}
protected function getPo($langcode) {
return <<<ENDPO
msgid ""
msgstr ""
msgid "Congratulations, you installed @drupal!"
msgstr "Congratulations, you installed @drupal {<span class="php-variable">$langcode</span>}!"
ENDPO;
}
protected function getTarball() {
return $this
->versionTarball('english-second.tar.gz');
}
}