Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / config_translation / tests / src / Kernel / Migrate / d7 / MigrateUserConfigsTranslationTest.php
1 <?php
2
3 namespace Drupal\Tests\config_translation\Kernel\Migrate\d7;
4
5 use Drupal\Tests\SchemaCheckTestTrait;
6 use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
7
8 /**
9  * Test migration of i18n user variables.
10  *
11  * @group migrate_drupal_7
12  */
13 class MigrateUserConfigsTranslationTest extends MigrateDrupal7TestBase {
14
15   use SchemaCheckTestTrait;
16
17   /**
18    * {@inheritdoc}
19    */
20   public static $modules = [
21     'language',
22     'locale',
23     'config_translation',
24     // Required for translation migrations.
25     'migrate_drupal_multilingual',
26   ];
27
28   /**
29    * {@inheritdoc}
30    */
31   protected function setUp() {
32     parent::setUp();
33     $this->installSchema('locale', [
34       'locales_source',
35       'locales_target',
36       'locales_location',
37     ]);
38     $this->executeMigrations([
39       'd7_user_mail_translation',
40       'd7_user_settings_translation',
41     ]);
42   }
43
44   /**
45    * Tests migration of i18n user variables to user.mail and user.settings.
46    */
47   public function testUserConfig() {
48     // Tests migration of i18n user variables to user.mail.yml.
49     $language_manager = \Drupal::service('language_manager');
50     $config = $language_manager->getLanguageConfigOverride('is', 'user.mail');
51     $this->assertSame('is - Are you sure?', $config->get('cancel_confirm.subject'));
52     $this->assertSame('is - A little birdie said you wanted to cancel your account.', $config->get('cancel_confirm.body'));
53     $this->assertSame('is - Fix your password', $config->get('password_reset.subject'));
54     $this->assertSame("is - Nope! You're locked out forever.", $config->get('password_reset.body'));
55     $this->assertSame('is - Gawd made you an account', $config->get('register_admin_created.subject'));
56     $this->assertSame("is - ...and she could take it away.\r\n[site:name], [site:url]", $config->get('register_admin_created.body'));
57     $this->assertSame('is - Welcome!', $config->get('register_no_approval_required.subject'));
58     $this->assertSame('is - You can now log in if you can figure out how to use Drupal!', $config->get('register_no_approval_required.body'));
59     $this->assertSame('is - Soon...', $config->get('register_pending_approval.subject'));
60     $this->assertSame('is - ...you will join our Circle. Let the Drupal flow through you.', $config->get('register_pending_approval.body'));
61     $this->assertSame('is - Your account is approved!', $config->get('status_activated.subject'));
62     $this->assertSame('is - Your account was activated, and there was much rejoicing.', $config->get('status_activated.body'));
63     $this->assertSame('is - BEGONE!', $config->get('status_blocked.subject'));
64     $this->assertSame('is - You no longer please the robot overlords. Go to your room and chill out.', $config->get('status_blocked.body'));
65     $this->assertSame('is - So long, bub', $config->get('status_canceled.subject'));
66     $this->assertSame('is - The gates of Drupal are closed to you. Now you will work in the salt mines.', $config->get('status_canceled.body'));
67     $this->assertConfigSchema(\Drupal::service('config.typed'), 'user.mail', $config->get());
68
69     // Tests migration of i18n user variables to user.settings.yml.
70     $config = $language_manager->getLanguageConfigOverride('is', 'user.settings');
71     $this->assertSame('is - anonymous', $config->get('anonymous'));
72   }
73
74 }