You are here

public function MigrateUserProfileEntityDisplayTest::testUserProfileFields in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/user/src/Tests/Migrate/MigrateUserProfileEntityDisplayTest.php \Drupal\user\Tests\Migrate\MigrateUserProfileEntityDisplayTest::testUserProfileFields()

Tests migration of user profile fields.

File

core/modules/user/src/Tests/Migrate/MigrateUserProfileEntityDisplayTest.php, line 35
Contains \Drupal\user\Tests\Migrate\MigrateUserProfileEntityDisplayTest.

Class

MigrateUserProfileEntityDisplayTest
Tests the user profile entity display migration.

Namespace

Drupal\user\Tests\Migrate

Code

public function testUserProfileFields() {
  $display = EntityViewDisplay::load('user.user.default');

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

  // Test a list field.
  $component = $display
    ->getComponent('profile_bands');
  $this
    ->assertIdentical('text_default', $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'));
}