You are here

MigrateUserContactSettingsTest.php in Drupal 8

File

core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserContactSettingsTest.php
View source
<?php

namespace Drupal\Tests\user\Kernel\Migrate\d6;

use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;

/**
 * Users contact settings migration.
 *
 * @group migrate_drupal_6
 */
class MigrateUserContactSettingsTest extends MigrateDrupal6TestBase {

  /**
   * {@inheritdoc}
   */
  public static $modules = [
    'contact',
  ];

  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();
    $this
      ->migrateUsers(FALSE);
    $this
      ->installSchema('user', [
      'users_data',
    ]);
    $this
      ->executeMigration('d6_user_contact_settings');
  }

  /**
   * Tests the Drupal6 user contact settings migration.
   */
  public function testUserContactSettings() {
    $user_data = \Drupal::service('user.data');
    $module = $key = 'contact';
    $uid = 2;
    $setting = $user_data
      ->get($module, $uid, $key);
    $this
      ->assertIdentical('1', $setting);
    $uid = 8;
    $setting = $user_data
      ->get($module, $uid, $key);
    $this
      ->assertIdentical('0', $setting);
    $uid = 15;
    $setting = $user_data
      ->get($module, $uid, $key);
    $this
      ->assertIdentical(NULL, $setting);
  }

}

Classes

Namesort descending Description
MigrateUserContactSettingsTest Users contact settings migration.