protected function AgreementMultilingualTest::setUp in Agreement 3.0.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/AgreementMultilingualTest.php \Drupal\Tests\agreement\Functional\AgreementMultilingualTest::setUp()
Overrides AgreementTestBase::setUp
File
- tests/
src/ Functional/ AgreementMultilingualTest.php, line 44
Class
- AgreementMultilingualTest
- Tests translating agreement.
Namespace
Drupal\Tests\agreement\FunctionalCode
protected function setUp() : void {
parent::setUp();
// Add a new language.
ConfigurableLanguage::createFromLangcode('es')
->save();
$this->spanishSpeaker = $this
->createUnprivilegedUser();
$this->spanishSpeaker
->set('preferred_langcode', 'es');
$this->spanishSpeaker
->save();
// Create a user to administer languages.
$this->adminUser = $this
->drupalCreateUser([
'access administration pages',
'access content',
'administer content types',
'administer filters',
'administer languages',
'access user profiles',
'bypass agreement',
'translate configuration',
]);
$this
->drupalLogin($this->adminUser);
// Enable URL and User language detection and selection.
$languageEdit = [
'language_interface[enabled][language-url]' => '1',
'language_interface[enabled][language-user]' => '1',
];
$this
->drupalGet('admin/config/regional/language/detection');
$this
->submitForm($languageEdit, t('Save settings'));
// Asserts that the configuration is translatable.
// @todo Make these better translations.
$configEdit = [
'translation[config_names][agreement.agreement.default][settings][title]' => 'Nuestro acuerdo',
'translation[config_names][agreement.agreement.default][settings][checkbox]' => 'Estoy de acuerdo.',
'translation[config_names][agreement.agreement.default][settings][submit]' => 'Enviar',
'translation[config_names][agreement.agreement.default][settings][success]' => 'Gracias por aceptar nuestro acuerdo.',
'translation[config_names][agreement.agreement.default][settings][revoked]' => 'Ha revocado con éxito su aceptación de nuestro acuerdo.',
'translation[config_names][agreement.agreement.default][settings][failure]' => 'Debes aceptar nuestro acuerdo para continuar.',
'translation[config_names][agreement.agreement.default][agreement]' => 'Este es el texto del acuerdo.',
];
$this
->drupalGet('admin/config/people/agreement/manage/default/translate/es/add');
$this
->submitForm($configEdit, t('Save translation'));
$this
->drupalLogout();
}