You are here

public function MigrateUserProfileEntityFormDisplayTest::testUserProfileEntityFormDisplay in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserProfileEntityFormDisplayTest.php \Drupal\Tests\user\Kernel\Migrate\d6\MigrateUserProfileEntityFormDisplayTest::testUserProfileEntityFormDisplay()
  2. 10 core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserProfileEntityFormDisplayTest.php \Drupal\Tests\user\Kernel\Migrate\d6\MigrateUserProfileEntityFormDisplayTest::testUserProfileEntityFormDisplay()

Tests migration of user profile fields.

File

core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserProfileEntityFormDisplayTest.php, line 30

Class

MigrateUserProfileEntityFormDisplayTest
Tests the user profile entity form display migration.

Namespace

Drupal\Tests\user\Kernel\Migrate\d6

Code

public function testUserProfileEntityFormDisplay() {
  $display = EntityFormDisplay::load('user.user.default');

  // Test a text field.
  $component = $display
    ->getComponent('profile_color');
  $this
    ->assertIdentical('text_textfield', $component['type']);

  // Test a list field.
  $component = $display
    ->getComponent('profile_bands');
  $this
    ->assertIdentical('text_textfield', $component['type']);

  // Test a date field.
  $component = $display
    ->getComponent('profile_birthdate');
  $this
    ->assertIdentical('datetime_default', $component['type']);

  // Test PROFILE_PRIVATE field is hidden.
  $this
    ->assertNull($display
    ->getComponent('profile_sell_address'));

  // Test PROFILE_HIDDEN field is hidden.
  $this
    ->assertNull($display
    ->getComponent('profile_sold_to'));

  // Test that a checkbox field has the proper display label setting.
  $component = $display
    ->getComponent('profile_really_really_love_mig');
  $this
    ->assertIdentical('boolean_checkbox', $component['type']);
  $this
    ->assertIdentical(TRUE, $component['settings']['display_label']);
}