upgrades core to 8.4.2
This commit is contained in:
@@ -8,8 +8,8 @@ configure: config_translation.mapper_list
|
||||
dependencies:
|
||||
- locale
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
id: d6_system_maintenance_translation
|
||||
label: Maintenance page configuration
|
||||
migration_tags:
|
||||
- Drupal 6
|
||||
source:
|
||||
plugin: variable_translation
|
||||
variables:
|
||||
- site_offline_message
|
||||
source_module: i18n
|
||||
process:
|
||||
langcode: language
|
||||
message: site_offline_message
|
||||
destination:
|
||||
plugin: config
|
||||
config_name: system.maintenance
|
||||
translations: true
|
||||
@@ -0,0 +1,40 @@
|
||||
id: d6_system_site_translation
|
||||
label: Site configuration
|
||||
migration_tags:
|
||||
- Drupal 6
|
||||
source:
|
||||
plugin: variable_translation
|
||||
constants:
|
||||
slash: '/'
|
||||
variables:
|
||||
- site_name
|
||||
- site_mail
|
||||
- site_slogan
|
||||
- site_frontpage
|
||||
- site_403
|
||||
- site_404
|
||||
source_module: i18n
|
||||
process:
|
||||
langcode: language
|
||||
name: site_name
|
||||
mail: site_mail
|
||||
slogan: site_slogan
|
||||
'page/front':
|
||||
plugin: concat
|
||||
source:
|
||||
- constants/slash
|
||||
- site_frontpage
|
||||
'page/403':
|
||||
plugin: concat
|
||||
source:
|
||||
- constants/slash
|
||||
- site_403
|
||||
'page/404':
|
||||
plugin: concat
|
||||
source:
|
||||
- constants/slash
|
||||
- site_404
|
||||
destination:
|
||||
plugin: config
|
||||
config_name: system.site
|
||||
translations: true
|
||||
@@ -0,0 +1,70 @@
|
||||
id: d6_user_mail_translation
|
||||
label: User mail configuration
|
||||
migration_tags:
|
||||
- Drupal 6
|
||||
source:
|
||||
plugin: variable_translation
|
||||
variables:
|
||||
- user_mail_status_activated_subject
|
||||
- user_mail_status_activated_body
|
||||
- user_mail_password_reset_subject
|
||||
- user_mail_password_reset_body
|
||||
- user_mail_status_deleted_subject
|
||||
- user_mail_status_deleted_body
|
||||
- user_mail_register_admin_created_subject
|
||||
- user_mail_register_admin_created_body
|
||||
- user_mail_register_no_approval_required_subject
|
||||
- user_mail_register_no_approval_required_body
|
||||
- user_mail_register_pending_approval_subject
|
||||
- user_mail_register_pending_approval_body
|
||||
- user_mail_status_blocked_subject
|
||||
- user_mail_status_blocked_body
|
||||
source_module: i18n
|
||||
process:
|
||||
langcode: language
|
||||
'status_activated/subject':
|
||||
plugin: convert_tokens
|
||||
source: user_mail_status_activated_subject
|
||||
'status_activated/body':
|
||||
plugin: convert_tokens
|
||||
source: user_mail_status_activated_body
|
||||
'password_reset/subject':
|
||||
plugin: convert_tokens
|
||||
source: user_mail_password_reset_subject
|
||||
'password_reset/body':
|
||||
plugin: convert_tokens
|
||||
source: user_mail_password_reset_body
|
||||
'cancel_confirm/subject':
|
||||
plugin: convert_tokens
|
||||
source: user_mail_status_deleted_subject
|
||||
'cancel_confirm/body':
|
||||
plugin: convert_tokens
|
||||
source: user_mail_status_deleted_body
|
||||
'register_admin_created/subject':
|
||||
plugin: convert_tokens
|
||||
source: user_mail_register_admin_created_subject
|
||||
'register_admin_created/body':
|
||||
plugin: convert_tokens
|
||||
source: user_mail_register_admin_created_body
|
||||
'register_no_approval_required/subject':
|
||||
plugin: convert_tokens
|
||||
source: user_mail_register_no_approval_required_subject
|
||||
'register_no_approval_required/body':
|
||||
plugin: convert_tokens
|
||||
source: user_mail_register_no_approval_required_body
|
||||
'register_pending_approval/subject':
|
||||
plugin: convert_tokens
|
||||
source: user_mail_register_pending_approval_subject
|
||||
'register_pending_approval/body':
|
||||
plugin: convert_tokens
|
||||
source: user_mail_register_pending_approval_body
|
||||
'status_blocked/subject':
|
||||
plugin: convert_tokens
|
||||
source: user_mail_status_blocked_subject
|
||||
'status_blocked/body':
|
||||
plugin: convert_tokens
|
||||
source: user_mail_status_blocked_body
|
||||
destination:
|
||||
plugin: config
|
||||
config_name: user.mail
|
||||
translations: true
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
id: d6_user_profile_field_instance_translation
|
||||
label: User profile field instance configuration
|
||||
migration_tags:
|
||||
- Drupal 6
|
||||
source:
|
||||
plugin: d6_profile_field_translation
|
||||
constants:
|
||||
entity_type: user
|
||||
bundle: user
|
||||
process:
|
||||
langcode: language
|
||||
entity_type: 'constants/entity_type'
|
||||
bundle: 'constants/bundle'
|
||||
field_name: name
|
||||
property:
|
||||
plugin: static_map
|
||||
source: property
|
||||
map:
|
||||
title: label
|
||||
options: options
|
||||
explanation: description
|
||||
translation: translation
|
||||
destination:
|
||||
plugin: entity:field_config
|
||||
translations: true
|
||||
migration_dependencies:
|
||||
required:
|
||||
- user_profile_field
|
||||
- user_profile_field_instance
|
||||
@@ -0,0 +1,31 @@
|
||||
id: d6_user_settings_translation
|
||||
label: User configuration
|
||||
migration_tags:
|
||||
- Drupal 6
|
||||
source:
|
||||
plugin: variable_translation
|
||||
variables:
|
||||
- user_mail_status_blocked_notify
|
||||
- user_mail_status_activated_notify
|
||||
- user_email_verification
|
||||
- user_register
|
||||
- anonymous
|
||||
source_module: i18n
|
||||
process:
|
||||
langcode: language
|
||||
'notify/status_blocked': user_mail_status_blocked_notify
|
||||
'notify/status_activated': user_mail_status_activated_notify
|
||||
verify_mail: user_email_verification
|
||||
register:
|
||||
plugin: static_map
|
||||
source: user_register
|
||||
default_value: visitors_admin_approval
|
||||
map:
|
||||
2: visitors_admin_approval
|
||||
1: visitors
|
||||
0: admin_only
|
||||
anonymous: anonymous
|
||||
destination:
|
||||
plugin: config
|
||||
config_name: user.settings
|
||||
translations: true
|
||||
@@ -15,7 +15,7 @@ class Textarea extends FormElementBase {
|
||||
public function getTranslationElement(LanguageInterface $translation_language, $source_config, $translation_config) {
|
||||
// Estimate a comfortable size of the input textarea.
|
||||
$rows_words = ceil(str_word_count($translation_config) / 5);
|
||||
$rows_newlines = substr_count($translation_config, "\n" ) + 1;
|
||||
$rows_newlines = substr_count($translation_config, "\n") + 1;
|
||||
$rows = max($rows_words, $rows_newlines);
|
||||
|
||||
return [
|
||||
|
||||
@@ -2,52 +2,20 @@
|
||||
|
||||
namespace Drupal\config_translation\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
@trigger_error('The ' . __NAMESPACE__ . '\I18nProfileField is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, use ' . __NAMESPACE__ . '\ProfileFieldTranslation', E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* i18n strings profile field source from database.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "d6_i18n_profile_field",
|
||||
* source_provider = "i18n"
|
||||
* source_module = "i18nprofile"
|
||||
* )
|
||||
*
|
||||
* @deprecated in Drupal 8.4.x and will be removed in Drupal 9.0.x. Use
|
||||
* \Drupal\config_translation\Plugin\migrate\source\d6\ProfileFieldTranslation
|
||||
* instead.
|
||||
*
|
||||
* @see https://www.drupal.org/node/2898649
|
||||
*/
|
||||
class I18nProfileField extends DrupalSqlBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
$query = $this->select('profile_fields', 'pf')
|
||||
->fields('pf', ['fid', 'name'])
|
||||
->fields('i18n', ['property'])
|
||||
->fields('lt', ['lid', 'translation', 'language']);
|
||||
$query->leftJoin('i18n_strings', 'i18n', 'i18n.objectid = pf.name');
|
||||
$query->leftJoin('locales_target', 'lt', 'lt.lid = i18n.lid');
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
return [
|
||||
'fid' => $this->t('Profile field ID.'),
|
||||
'lid' => $this->t('Locales target language ID.'),
|
||||
'language' => $this->t('Language for this field.'),
|
||||
'translation' => $this->t('Translation of either the title or explanation.'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['fid']['type'] = 'integer';
|
||||
$ids['language']['type'] = 'string';
|
||||
$ids['lid']['type'] = 'integer';
|
||||
$ids['lid']['alias'] = 'lt';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
}
|
||||
class I18nProfileField extends ProfileFieldTranslation {}
|
||||
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\config_translation\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
||||
/**
|
||||
* Gets i18n strings profile field source from database.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "d6_profile_field_translation",
|
||||
* source_module = "i18nprofile"
|
||||
* )
|
||||
*/
|
||||
class ProfileFieldTranslation extends DrupalSqlBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
$query = $this->select('profile_fields', 'pf')
|
||||
->fields('pf', ['fid', 'name'])
|
||||
->fields('i18n', ['property'])
|
||||
->fields('lt', ['lid', 'translation', 'language']);
|
||||
$query->leftJoin('i18n_strings', 'i18n', 'i18n.objectid = pf.name');
|
||||
$query->leftJoin('locales_target', 'lt', 'lt.lid = i18n.lid');
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
return [
|
||||
'fid' => $this->t('Profile field ID.'),
|
||||
'lid' => $this->t('Locales target language ID.'),
|
||||
'language' => $this->t('Language for this field.'),
|
||||
'translation' => $this->t('Translation of either the title or explanation.'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['fid']['type'] = 'integer';
|
||||
$ids['language']['type'] = 'string';
|
||||
$ids['lid']['type'] = 'integer';
|
||||
$ids['lid']['alias'] = 'lt';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
}
|
||||
+3
-3
@@ -8,8 +8,8 @@ dependencies:
|
||||
- config_translation
|
||||
- config_test
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\config_translation\Functional;
|
||||
|
||||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
use Drupal\filter\Entity\FilterFormat;
|
||||
use Drupal\language\Entity\ConfigurableLanguage;
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
|
||||
/**
|
||||
* Translate settings and entities to various languages.
|
||||
*
|
||||
* @group config_translation
|
||||
*/
|
||||
class ConfigTranslationCacheTest extends BrowserTestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = [
|
||||
'block',
|
||||
'config_translation',
|
||||
'config_translation_test',
|
||||
'contact',
|
||||
'contact_test',
|
||||
'contextual',
|
||||
'entity_test',
|
||||
'field_test',
|
||||
'field_ui',
|
||||
'filter',
|
||||
'filter_test',
|
||||
'node',
|
||||
'views',
|
||||
'views_ui',
|
||||
];
|
||||
|
||||
/**
|
||||
* Languages to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $langcodes = ['fr', 'ta'];
|
||||
|
||||
/**
|
||||
* Administrator user for tests.
|
||||
*
|
||||
* @var \Drupal\user\UserInterface
|
||||
*/
|
||||
protected $adminUser;
|
||||
|
||||
/**
|
||||
* Translator user for tests.
|
||||
*
|
||||
* @var \Drupal\user\UserInterface
|
||||
*/
|
||||
protected $translatorUser;
|
||||
|
||||
/**
|
||||
* String translation storage object.
|
||||
*
|
||||
* @var \Drupal\locale\StringStorageInterface
|
||||
*/
|
||||
protected $localeStorage;
|
||||
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$translator_permissions = [
|
||||
'translate configuration',
|
||||
];
|
||||
|
||||
/** @var \Drupal\filter\FilterFormatInterface $filter_test_format */
|
||||
$filter_test_format = FilterFormat::load('filter_test');
|
||||
/** @var \Drupal\filter\FilterFormatInterface $filtered_html_format */
|
||||
$filtered_html_format = FilterFormat::load('filtered_html');
|
||||
/** @var \Drupal\filter\FilterFormatInterface $full_html_format */
|
||||
$full_html_format = FilterFormat::load('full_html');
|
||||
|
||||
$admin_permissions = array_merge($translator_permissions, [
|
||||
'administer languages',
|
||||
'administer site configuration',
|
||||
'link to any page',
|
||||
'administer contact forms',
|
||||
'administer filters',
|
||||
$filtered_html_format->getPermissionName(),
|
||||
$full_html_format->getPermissionName(),
|
||||
$filter_test_format->getPermissionName(),
|
||||
'access site-wide contact form',
|
||||
'access contextual links',
|
||||
'administer account settings',
|
||||
'administer themes',
|
||||
'bypass node access',
|
||||
'administer content types',
|
||||
'translate interface',
|
||||
'administer entity_test fields',
|
||||
]);
|
||||
// Create and login user.
|
||||
$this->translatorUser = $this->drupalCreateUser($translator_permissions);
|
||||
$this->adminUser = $this->drupalCreateUser($admin_permissions);
|
||||
|
||||
// Add languages.
|
||||
foreach ($this->langcodes as $langcode) {
|
||||
ConfigurableLanguage::createFromLangcode($langcode)->save();
|
||||
}
|
||||
$this->drupalPlaceBlock('local_tasks_block');
|
||||
$this->drupalPlaceBlock('page_title_block');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the translation of field and field storage configuration.
|
||||
*/
|
||||
public function testFieldConfigTranslation() {
|
||||
// Add a test field which has a translatable field setting and a
|
||||
// translatable field storage setting.
|
||||
$field_name = strtolower($this->randomMachineName());
|
||||
$field_storage = FieldStorageConfig::create([
|
||||
'field_name' => $field_name,
|
||||
'entity_type' => 'entity_test',
|
||||
'type' => 'test_field',
|
||||
]);
|
||||
|
||||
$translatable_storage_setting = $this->randomString();
|
||||
$field_storage->setSetting('translatable_storage_setting', $translatable_storage_setting);
|
||||
$field_storage->save();
|
||||
|
||||
$bundle = strtolower($this->randomMachineName());
|
||||
entity_test_create_bundle($bundle);
|
||||
$field = FieldConfig::create([
|
||||
'field_name' => $field_name,
|
||||
'entity_type' => 'entity_test',
|
||||
'bundle' => $bundle,
|
||||
]);
|
||||
|
||||
$translatable_field_setting = $this->randomString();
|
||||
$field->setSetting('translatable_field_setting', $translatable_field_setting);
|
||||
$field->save();
|
||||
|
||||
$this->drupalLogin($this->translatorUser);
|
||||
|
||||
$this->drupalGet("/entity_test/structure/$bundle/fields/entity_test.$bundle.$field_name/translate");
|
||||
$this->clickLink('Add');
|
||||
|
||||
$this->assertText('Translatable field setting');
|
||||
$this->assertEscaped($translatable_field_setting);
|
||||
$this->assertText('Translatable storage setting');
|
||||
$this->assertEscaped($translatable_storage_setting);
|
||||
|
||||
// Add translation for label.
|
||||
$field_label_fr = $this->randomString();
|
||||
$edit = [
|
||||
"translation[config_names][field.field.entity_test.$bundle.$field_name][label]" => $field_label_fr,
|
||||
];
|
||||
$this->drupalPostForm(NULL, $edit, 'Save translation');
|
||||
$this->drupalLogout();
|
||||
|
||||
// Check if the translated label appears.
|
||||
$this->drupalLogin($this->adminUser);
|
||||
$this->drupalGet("/fr/entity_test/structure/$bundle/fields");
|
||||
$this->assertEscaped($field_label_fr);
|
||||
|
||||
// Clear cache on French version and check for translated label.
|
||||
$this->drupalPostForm('/fr/admin/config/development/performance', [], 'Clear all caches');
|
||||
$this->drupalGet("/fr/entity_test/structure/$bundle/fields");
|
||||
// Check if the translation is still there.
|
||||
$this->assertEscaped($field_label_fr);
|
||||
|
||||
// Clear cache on default version and check for translated label.
|
||||
$this->drupalPostForm('/admin/config/development/performance', [], 'Clear all caches');
|
||||
$this->drupalGet("/fr/entity_test/structure/$bundle/fields");
|
||||
// Check if the translation is still there.
|
||||
$this->assertEscaped($field_label_fr);
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
+41
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\config_translation\FunctionalJavascript;
|
||||
|
||||
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
|
||||
|
||||
/**
|
||||
* Translate settings and entities to various languages.
|
||||
*
|
||||
* @group config_translation
|
||||
*/
|
||||
class ConfigTranslationUiTest extends JavascriptTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = [
|
||||
'config_translation',
|
||||
'contextual',
|
||||
'node',
|
||||
'views',
|
||||
'views_ui',
|
||||
];
|
||||
|
||||
/**
|
||||
* Tests that contextual link related to views.
|
||||
*/
|
||||
public function testViewContextualLink() {
|
||||
$user = $this->drupalCreateUser([
|
||||
'translate configuration',
|
||||
'access contextual links',
|
||||
]);
|
||||
$this->drupalLogin($user);
|
||||
|
||||
$this->drupalGet('node');
|
||||
$contextualLinks = $this->assertSession()->waitForElement('css', '.contextual-links');
|
||||
$link = $contextualLinks->findLink('Translate view');
|
||||
$this->assertNotNull($link, 'Translate view contextual link added.');
|
||||
}
|
||||
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\config_translation\Kernel\Migrate\d6;
|
||||
|
||||
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade i18n maintenance variables to system.*.yml.
|
||||
*
|
||||
* @group migrate_drupal_6
|
||||
* @group legacy
|
||||
*/
|
||||
class MigrateSystemMaintenanceTranslationTest extends MigrateDrupal6TestBase {
|
||||
|
||||
public static $modules = ['language', 'config_translation'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->executeMigration('d6_system_maintenance_translation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of system (maintenance) variables to system.maintenance.yml.
|
||||
*/
|
||||
public function testSystemMaintenance() {
|
||||
$config = \Drupal::service('language_manager')->getLanguageConfigOverride('fr', 'system.maintenance');
|
||||
$this->assertIdentical('fr - Drupal is currently under maintenance. We should be back shortly. Thank you for your patience.', $config->get('message'));
|
||||
}
|
||||
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\config_translation\Kernel\Migrate\d6;
|
||||
|
||||
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade i18n_strings site variables to system.*.yml.
|
||||
*
|
||||
* @group migrate_drupal_6
|
||||
* @group legacy
|
||||
*/
|
||||
class MigrateSystemSiteTranslationTest extends MigrateDrupal6TestBase {
|
||||
|
||||
public static $modules = ['language', 'config_translation'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->executeMigration('d6_system_site_translation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of system (site) variables to system.site.yml.
|
||||
*/
|
||||
public function testSystemSite() {
|
||||
$config_translation = \Drupal::service('language_manager')->getLanguageConfigOverride('fr', 'system.site');
|
||||
$this->assertIdentical('fr site name', $config_translation->get('name'));
|
||||
$this->assertIdentical('fr_site_mail@example.com', $config_translation->get('mail'));
|
||||
$this->assertIdentical('fr Migrate rocks', $config_translation->get('slogan'));
|
||||
$this->assertIdentical('/fr-user', $config_translation->get('page.403'));
|
||||
$this->assertIdentical('/fr-page-not-found', $config_translation->get('page.404'));
|
||||
$this->assertIdentical('/node', $config_translation->get('page.front'));
|
||||
$this->assertIdentical(NULL, $config_translation->get('admin_compact_mode'));
|
||||
|
||||
$config_translation = \Drupal::service('language_manager')->getLanguageConfigOverride('zu', 'system.site');
|
||||
$this->assertIdentical('zu - site_name', $config_translation->get('name'));
|
||||
$this->assertIdentical('site_mail@example.com', $config_translation->get('mail'));
|
||||
$this->assertIdentical('Migrate rocks', $config_translation->get('slogan'));
|
||||
$this->assertIdentical('/zu-user', $config_translation->get('page.403'));
|
||||
$this->assertIdentical('/zu-page-not-found', $config_translation->get('page.404'));
|
||||
$this->assertIdentical('/node', $config_translation->get('page.front'));
|
||||
$this->assertIdentical(NULL, $config_translation->get('admin_compact_mode'));
|
||||
}
|
||||
|
||||
}
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\config_translation\Kernel\Migrate\d6;
|
||||
|
||||
use Drupal\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade i18n variables to user.*.yml.
|
||||
*
|
||||
* @group migrate_drupal_6
|
||||
* @group legacy
|
||||
*/
|
||||
class MigrateUserConfigsTranslationTest extends MigrateDrupal6TestBase {
|
||||
|
||||
use SchemaCheckTestTrait;
|
||||
|
||||
public static $modules = ['language', 'locale', 'config_translation'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installSchema('locale',
|
||||
['locales_source', 'locales_target', 'locales_location']);
|
||||
$this->executeMigrations(['d6_user_mail_translation', 'd6_user_settings_translation']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of i18n user variables to user.mail.yml.
|
||||
*/
|
||||
public function testUserMail() {
|
||||
$config = \Drupal::service('language_manager')->getLanguageConfigOverride('fr', 'user.mail');
|
||||
$this->assertIdentical('fr - Account details for [user:name] at [site:name] (approved)', $config->get('status_activated.subject'));
|
||||
$this->assertIdentical("fr - [user:name],\r\n\r\nYour account at [site:name] has been activated.\r\n\r\nYou may now log in by clicking on this link or copying and pasting it in your browser:\r\n\r\n[user:one-time-login-url]\r\n\r\nThis is a one-time login, so it can be used only once.\r\n\r\nAfter logging in, you will be redirected to [user:edit-url] so you can change your password.\r\n\r\nOnce you have set your own password, you will be able to log in to [site:login-url] in the future using:\r\n\r\nusername: [user:name]\r\n", $config->get('status_activated.body'));
|
||||
$this->assertIdentical('fr - Replacement login information for [user:name] at [site:name]', $config->get('password_reset.subject'));
|
||||
$this->assertIdentical("fr - [user:name],\r\n\r\nA request to reset the password for your account has been made at [site:name].\r\n\r\nYou may now log in to [site:url-brief] by clicking on this link or copying and pasting it in your browser:\r\n\r\n[user:one-time-login-url]\r\n\r\nThis is a one-time login, so it can be used only once. It expires after one day and nothing will happen if it's not used.\r\n\r\nAfter logging in, you will be redirected to [user:edit-url] so you can change your password.", $config->get('password_reset.body'));
|
||||
$this->assertIdentical('fr - Account details for [user:name] at [site:name] (deleted)', $config->get('cancel_confirm.subject'));
|
||||
$this->assertIdentical("fr - [user:name],\r\n\r\nYour account on [site:name] has been deleted.", $config->get('cancel_confirm.body'));
|
||||
$this->assertIdentical('fr - An administrator created an account for you at [site:name]', $config->get('register_admin_created.subject'));
|
||||
$this->assertIdentical("fr - [user:name],\r\n\r\nA site administrator at [site:name] has created an account for you. You may now log in to [site:login-url] using the following username and password:\r\n\r\nusername: [user:name]\r\npassword: \r\n\r\nYou may also log in by clicking on this link or copying and pasting it in your browser:\r\n\r\n[user:one-time-login-url]\r\n\r\nThis is a one-time login, so it can be used only once.\r\n\r\nAfter logging in, you will be redirected to [user:edit-url] so you can change your password.\r\n\r\n\r\n-- [site:name] team", $config->get('register_admin_created.body'));
|
||||
$this->assertIdentical('fr - Account details for [user:name] at [site:name]', $config->get('register_no_approval_required.subject'));
|
||||
$this->assertIdentical("fr - [user:name],\r\n\r\nThank you for registering at [site:name]. You may now log in to [site:login-url] using the following username and password:\r\n\r\nusername: [user:name]\r\npassword: \r\n\r\nYou may also log in by clicking on this link or copying and pasting it in your browser:\r\n\r\n[user:one-time-login-url]\r\n\r\nThis is a one-time login, so it can be used only once.\r\n\r\nAfter logging in, you will be redirected to [user:edit-url] so you can change your password.\r\n\r\n\r\n-- [site:name] team", $config->get('register_no_approval_required.body'));
|
||||
$this->assertIdentical('fr - Account details for [user:name] at [site:name] (pending admin approval)', $config->get('register_pending_approval.subject'));
|
||||
$this->assertIdentical("fr - [user:name],\r\n\r\nThank you for registering at [site:name]. Your application for an account is currently pending approval. Once it has been approved, you will receive another email containing information about how to log in, set your password, and other details.\r\n\r\n\r\n-- [site:name] team", $config->get('register_pending_approval.body'));
|
||||
$this->assertIdentical('fr - Account details for [user:name] at [site:name] (blocked)', $config->get('status_blocked.subject'));
|
||||
$this->assertIdentical("fr - [user:name],\r\n\r\nYour account on [site:name] has been blocked.", $config->get('status_blocked.body'));
|
||||
$this->assertConfigSchema(\Drupal::service('config.typed'), 'user.mail', $config->get());
|
||||
|
||||
$config = \Drupal::service('language_manager')->getLanguageConfigOverride('zu', 'user.mail');
|
||||
$this->assertIdentical('zu - An administrator created an account for you at [site:name]', $config->get('register_admin_created.subject'));
|
||||
$this->assertIdentical("zu - [user:name],\r\n\r\nA site administrator at [site:name] has created an account for you. You may now log in to [site:login-url] using the following username and password:\r\n\r\nusername: [user:name]\r\npassword: \r\n\r\nYou may also log in by clicking on this link or copying and pasting it in your browser:\r\n\r\n[user:one-time-login-url]\r\n\r\nThis is a one-time login, so it can be used only once.\r\n\r\nAfter logging in, you will be redirected to [user:edit-url] so you can change your password.\r\n\r\n\r\n-- [site:name] team", $config->get('register_admin_created.body'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of i18n user variables to user.settings.yml.
|
||||
*/
|
||||
public function testUserSettings() {
|
||||
$config = \Drupal::service('language_manager')->getLanguageConfigOverride('fr', 'user.settings');
|
||||
$this->assertIdentical(1, $config->get('notify.status_blocked'));
|
||||
$this->assertIdentical(0, $config->get('notify.status_activated'));
|
||||
$this->assertIdentical(0, $config->get('verify_mail'));
|
||||
$this->assertIdentical('admin_only', $config->get('register'));
|
||||
$this->assertIdentical('fr Guest', $config->get('anonymous'));
|
||||
|
||||
$config = \Drupal::service('language_manager')->getLanguageConfigOverride('zu', 'user.settings');
|
||||
$this->assertIdentical(1, $config->get('notify.status_blocked'));
|
||||
$this->assertIdentical(0, $config->get('notify.status_activated'));
|
||||
$this->assertIdentical(0, $config->get('verify_mail'));
|
||||
$this->assertIdentical('admin_only', $config->get('register'));
|
||||
$this->assertIdentical('Guest', $config->get('anonymous'));
|
||||
}
|
||||
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\config_translation\Kernel\Migrate\d6;
|
||||
|
||||
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Tests the user profile field instance migration.
|
||||
*
|
||||
* @group migrate_drupal_6
|
||||
* @group legacy
|
||||
*/
|
||||
class MigrateUserProfileFieldInstanceTranslationTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['config_translation', 'locale', 'language', 'field'];
|
||||
|
||||
/**
|
||||
* Tests migration of translated user profile fields.
|
||||
*/
|
||||
public function testUserProfileFields() {
|
||||
$this->executeMigrations([
|
||||
'user_profile_field',
|
||||
'user_profile_field_instance',
|
||||
'd6_user_profile_field_instance_translation',
|
||||
]);
|
||||
$language_manager = $this->container->get('language_manager');
|
||||
|
||||
$config_translation = $language_manager->getLanguageConfigOverride('fr', 'field.field.user.user.profile_love_migrations');
|
||||
$this->assertSame("J'aime les migrations", $config_translation->get('label'));
|
||||
$this->assertSame("Si vous cochez cette case, vous aimez les migrations.", $config_translation->get('description'));
|
||||
|
||||
$config_translation = $language_manager->getLanguageConfigOverride('fr', 'field.field.user.user.profile_color');
|
||||
$this->assertSame('fr - Favorite color', $config_translation->get('label'));
|
||||
$this->assertSame('Inscrivez votre couleur préférée', $config_translation->get('description'));
|
||||
|
||||
$config_translation = $language_manager->getLanguageConfigOverride('fr', 'field.field.user.user.profile_biography');
|
||||
$this->assertSame('fr - Biography', $config_translation->get('label'));
|
||||
$this->assertSame('fr - Tell people a little bit about yourself', $config_translation->get('description'));
|
||||
|
||||
$config_translation = $language_manager->getLanguageConfigOverride('fr', 'field.field.user.user.profile_sell_address');
|
||||
$this->assertSame('fr - Sell your email address?', $config_translation->get('label'));
|
||||
$this->assertSame("fr - If you check this box, we'll sell your address to spammers to help line the pockets of our shareholders. Thanks!", $config_translation->get('description'));
|
||||
|
||||
$config_translation = $language_manager->getLanguageConfigOverride('fr', 'field.field.user.user.profile_sold_to');
|
||||
$this->assertSame('fr - Sales Category', $config_translation->get('label'));
|
||||
$this->assertSame("fr - Select the sales categories to which this user's address was sold.", $config_translation->get('description'));
|
||||
$this->assertSame('fr - Pill spammers Fitness spammers Back\slash Forward/slash Dot.in.the.middle', $config_translation->get('options'));
|
||||
|
||||
$config_translation = $language_manager->getLanguageConfigOverride('fr', 'field.field.user.user.profile_bands');
|
||||
$this->assertSame('Mes groupes préférés', $config_translation->get('label'));
|
||||
$this->assertSame("fr - Enter your favorite bands. When you've saved your profile, you'll be able to find other people with the same favorites.", $config_translation->get('description'));
|
||||
|
||||
$config_translation = $language_manager->getLanguageConfigOverride('fr', 'field.field.user.user.profile_birthdate');
|
||||
$this->assertSame('fr - Birthdate', $config_translation->get('label'));
|
||||
$this->assertSame('fr - Enter your birth date and we\'ll send you a coupon.', $config_translation->get('description'));
|
||||
|
||||
$config_translation = $language_manager->getLanguageConfigOverride('fr', 'field.field.user.user.profile_blog');
|
||||
$this->assertSame('fr - Blog', $config_translation->get('label'));
|
||||
$this->assertSame('fr - Paste the full URL, including http://, of your personal blog.', $config_translation->get('description'));
|
||||
}
|
||||
|
||||
}
|
||||
+1
@@ -9,6 +9,7 @@ use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
|
||||
*
|
||||
* @covers \Drupal\config_translation\Plugin\migrate\source\d6\I18nProfileField
|
||||
* @group migrate_drupal
|
||||
* @group legacy
|
||||
*/
|
||||
class I18nProfileFieldTest extends MigrateSqlSourceTestBase {
|
||||
|
||||
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\config_translation\Kernel\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
|
||||
|
||||
/**
|
||||
* Tests the i18nProfileField source plugin.
|
||||
*
|
||||
* @covers \Drupal\config_translation\Plugin\migrate\source\d6\ProfileFieldTranslation
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class ProfileFieldTranslationTest extends MigrateSqlSourceTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['config_translation', 'migrate_drupal', 'user'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function providerSource() {
|
||||
$test = [];
|
||||
$test[0]['source_data'] = [
|
||||
'profile_fields' => [
|
||||
[
|
||||
'fid' => 42,
|
||||
'title' => 'I love migrations',
|
||||
'name' => 'profile_love_migrations',
|
||||
],
|
||||
],
|
||||
'i18n_strings' => [
|
||||
[
|
||||
'lid' => 10,
|
||||
'objectid' => 'profile_love_migrations',
|
||||
'type' => 'field',
|
||||
'property' => 'title',
|
||||
],
|
||||
[
|
||||
'lid' => 11,
|
||||
'objectid' => 'profile_love_migrations',
|
||||
'type' => 'field',
|
||||
'property' => 'explanation'
|
||||
]
|
||||
],
|
||||
'locales_target' => [
|
||||
[
|
||||
'lid' => 10,
|
||||
'translation' => "J'aime les migrations.",
|
||||
'language' => 'fr',
|
||||
],
|
||||
[
|
||||
'lid' => 11,
|
||||
'translation' => 'Si vous cochez cette case, vous aimez les migrations.',
|
||||
'language' => 'fr',
|
||||
],
|
||||
],
|
||||
];
|
||||
$test[0]['expected_results'] = [
|
||||
[
|
||||
'property' => 'title',
|
||||
'translation' => "J'aime les migrations.",
|
||||
'language' => 'fr',
|
||||
'fid' => '42',
|
||||
'name' => 'profile_love_migrations',
|
||||
],
|
||||
[
|
||||
'property' => 'explanation',
|
||||
'translation' => 'Si vous cochez cette case, vous aimez les migrations.',
|
||||
'language' => 'fr',
|
||||
'fid' => '42',
|
||||
'name' => 'profile_love_migrations',
|
||||
],
|
||||
];
|
||||
return $test;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -45,7 +45,7 @@ class ConfigEntityMapperTest extends UnitTestCase {
|
||||
/**
|
||||
* The mocked language manager.
|
||||
*
|
||||
* @var \Drupal\Core\Language\LanguageManagerInterface $language_manager|\PHPUnit_Framework_MockObject_MockObject
|
||||
* @var \Drupal\Core\Language\LanguageManagerInterface|\PHPUnit_Framework_MockObject_MockObject
|
||||
*/
|
||||
protected $languageManager;
|
||||
|
||||
|
||||
@@ -88,44 +88,52 @@ class ConfigMapperManagerTest extends UnitTestCase {
|
||||
[$this->getElement(['aaa' => 'bbb']), FALSE],
|
||||
[$this->getElement(['translatable' => FALSE]), FALSE],
|
||||
[$this->getElement(['translatable' => TRUE]), TRUE],
|
||||
[$this->getNestedElement([
|
||||
$this->getElement([]),
|
||||
]), FALSE],
|
||||
[$this->getNestedElement([
|
||||
$this->getElement(['translatable' => TRUE]),
|
||||
]), TRUE],
|
||||
[$this->getNestedElement([
|
||||
$this->getElement(['aaa' => 'bbb']),
|
||||
$this->getElement(['ccc' => 'ddd']),
|
||||
$this->getElement(['eee' => 'fff']),
|
||||
]), FALSE],
|
||||
[$this->getNestedElement([
|
||||
$this->getElement(['aaa' => 'bbb']),
|
||||
$this->getElement(['ccc' => 'ddd']),
|
||||
$this->getElement(['translatable' => TRUE]),
|
||||
]), TRUE],
|
||||
[$this->getNestedElement([
|
||||
$this->getElement(['aaa' => 'bbb']),
|
||||
[$this->getNestedElement([$this->getElement([])]), FALSE],
|
||||
[$this->getNestedElement([$this->getElement(['translatable' => TRUE])]), TRUE],
|
||||
[
|
||||
$this->getNestedElement([
|
||||
$this->getElement(['aaa' => 'bbb']),
|
||||
$this->getElement(['ccc' => 'ddd']),
|
||||
$this->getElement(['eee' => 'fff']),
|
||||
]),
|
||||
FALSE,
|
||||
],
|
||||
[
|
||||
$this->getNestedElement([
|
||||
$this->getElement(['ggg' => 'hhh']),
|
||||
$this->getElement(['iii' => 'jjj']),
|
||||
]),
|
||||
]), FALSE],
|
||||
[$this->getNestedElement([
|
||||
$this->getElement(['aaa' => 'bbb']),
|
||||
$this->getNestedElement([
|
||||
$this->getElement(['aaa' => 'bbb']),
|
||||
$this->getElement(['ccc' => 'ddd']),
|
||||
$this->getElement(['eee' => 'fff']),
|
||||
]),
|
||||
$this->getNestedElement([
|
||||
$this->getElement(['ggg' => 'hhh']),
|
||||
$this->getElement(['translatable' => TRUE]),
|
||||
]),
|
||||
]), TRUE],
|
||||
TRUE,
|
||||
],
|
||||
[
|
||||
$this->getNestedElement([
|
||||
$this->getElement(['aaa' => 'bbb']),
|
||||
$this->getNestedElement([
|
||||
$this->getElement(['ccc' => 'ddd']),
|
||||
$this->getElement(['eee' => 'fff']),
|
||||
]),
|
||||
$this->getNestedElement([
|
||||
$this->getElement(['ggg' => 'hhh']),
|
||||
$this->getElement(['iii' => 'jjj']),
|
||||
]),
|
||||
]),
|
||||
FALSE
|
||||
],
|
||||
[
|
||||
$this->getNestedElement([
|
||||
$this->getElement(['aaa' => 'bbb']),
|
||||
$this->getNestedElement([
|
||||
$this->getElement(['ccc' => 'ddd']),
|
||||
$this->getElement(['eee' => 'fff']),
|
||||
]),
|
||||
$this->getNestedElement([
|
||||
$this->getElement(['ggg' => 'hhh']),
|
||||
$this->getElement(['translatable' => TRUE]),
|
||||
]),
|
||||
]),
|
||||
TRUE,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ class ConfigNamesMapperTest extends UnitTestCase {
|
||||
/**
|
||||
* The mocked language manager.
|
||||
*
|
||||
* @var \Drupal\Core\Language\LanguageManagerInterface $language_manager|\PHPUnit_Framework_MockObject_MockObject
|
||||
* @var \Drupal\Core\Language\LanguageManagerInterface|\PHPUnit_Framework_MockObject_MockObject
|
||||
*/
|
||||
protected $languageManager;
|
||||
|
||||
|
||||
+3
-3
@@ -4,8 +4,8 @@ description: 'Theme for testing the configuration translation mapper system'
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2017-08-16
|
||||
version: '8.3.7'
|
||||
# Information added by Drupal.org packaging script on 2017-11-03
|
||||
version: '8.4.2'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1502903957
|
||||
datestamp: 1509719929
|
||||
|
||||
Reference in New Issue
Block a user