a2b01aa1712eb327fa0030b717e352bdc620fdf7
[yaffs-website] / web / core / modules / user / tests / src / Kernel / Migrate / MigrateUserProfileEntityFormDisplayTest.php
1 <?php
2
3 namespace Drupal\Tests\user\Kernel\Migrate;
4
5 use Drupal\Core\Entity\Entity\EntityFormDisplay;
6 use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
7
8 /**
9  * Tests the user profile entity form display migration.
10  *
11  * @group migrate_drupal_6
12  */
13 class MigrateUserProfileEntityFormDisplayTest extends MigrateDrupal6TestBase {
14
15   /**
16    * {@inheritdoc}
17    */
18   protected function setUp() {
19     parent::setUp();
20     $this->executeMigrations([
21       'user_profile_field',
22       'user_profile_field_instance',
23       'user_profile_entity_form_display',
24     ]);
25   }
26
27   /**
28    * Tests migration of user profile fields.
29    */
30   public function testUserProfileEntityFormDisplay() {
31     $display = EntityFormDisplay::load('user.user.default');
32
33     // Test a text field.
34     $component = $display->getComponent('profile_color');
35     $this->assertIdentical('text_textfield', $component['type']);
36
37     // Test a list field.
38     $component = $display->getComponent('profile_bands');
39     $this->assertIdentical('text_textfield', $component['type']);
40
41     // Test a date field.
42     $component = $display->getComponent('profile_birthdate');
43     $this->assertIdentical('datetime_default', $component['type']);
44
45     // Test PROFILE_PRIVATE field is hidden.
46     $this->assertNull($display->getComponent('profile_sell_address'));
47
48     // Test PROFILE_HIDDEN field is hidden.
49     $this->assertNull($display->getComponent('profile_sold_to'));
50
51     // Test that a checkbox field has the proper display label setting.
52     $component = $display->getComponent('profile_love_migrations');
53     $this->assertIdentical('boolean_checkbox', $component['type']);
54     $this->assertIdentical(TRUE, $component['settings']['display_label']);
55   }
56
57 }