3 namespace Drupal\Tests\user\Kernel\Migrate;
5 use Drupal\field\Entity\FieldConfig;
6 use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
9 * Tests the user profile field instance migration.
11 * @group migrate_drupal_6
13 class MigrateUserProfileFieldInstanceTest extends MigrateDrupal6TestBase {
18 public static $modules = ['field'];
23 protected function setUp() {
25 $this->executeMigrations([
27 'user_profile_field_instance',
32 * Tests migration of user profile fields.
34 public function testUserProfileFields() {
35 // Migrated a text field.
36 $field = FieldConfig::load('user.user.profile_color');
37 $this->assertIdentical('Favorite color', $field->label());
38 $this->assertIdentical('List your favorite color', $field->getDescription());
40 // Migrated a textarea.
41 $field = FieldConfig::load('user.user.profile_biography');
42 $this->assertIdentical('Biography', $field->label());
43 $this->assertIdentical('Tell people a little bit about yourself', $field->getDescription());
45 // Migrated checkbox field.
46 $field = FieldConfig::load('user.user.profile_sell_address');
47 $this->assertIdentical('Sell your email address?', $field->label());
48 $this->assertIdentical("If you check this box, we'll sell your address to spammers to help line the pockets of our shareholders. Thanks!", $field->getDescription());
50 // Migrated selection field.
51 $field = FieldConfig::load('user.user.profile_sold_to');
52 $this->assertIdentical('Sales Category', $field->label());
53 $this->assertIdentical("Select the sales categories to which this user's address was sold.", $field->getDescription());
55 // Migrated list field.
56 $field = FieldConfig::load('user.user.profile_bands');
57 $this->assertIdentical('Favorite bands', $field->label());
58 $this->assertIdentical("Enter your favorite bands. When you've saved your profile, you'll be able to find other people with the same favorites.", $field->getDescription());
60 // Migrated URL field.
61 $field = FieldConfig::load('user.user.profile_blog');
62 $this->assertIdentical('Blog', $field->label());
63 $this->assertIdentical("Paste the full URL, including http://, of your personal blog.", $field->getDescription());
65 // Migrated date field.
66 $field = FieldConfig::load('user.user.profile_birthdate');
67 $this->assertIdentical('Birthdate', $field->label());
68 $this->assertIdentical("Enter your birth date and we'll send you a coupon.", $field->getDescription());
70 // Another migrated checkbox field, with a different source visibility setting.
71 $field = FieldConfig::load('user.user.profile_really_really_love_mig');
72 $this->assertIdentical('I really, really, really love migrations', $field->label());
73 $this->assertIdentical("If you check this box, you love migrations.", $field->getDescription());