class MigrateUserProfileFieldInstanceTest
Same name and namespace in other branches
- 11.x core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserProfileFieldInstanceTest.php \Drupal\Tests\user\Kernel\Migrate\d6\MigrateUserProfileFieldInstanceTest
- 10 core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserProfileFieldInstanceTest.php \Drupal\Tests\user\Kernel\Migrate\d6\MigrateUserProfileFieldInstanceTest
- 8.9.x core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserProfileFieldInstanceTest.php \Drupal\Tests\user\Kernel\Migrate\d6\MigrateUserProfileFieldInstanceTest
Tests the user profile field instance migration.
@group migrate_drupal_6
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\migrate\Kernel\MigrateTestBase extends \Drupal\migrate\MigrateMessageInterface implements \Drupal\KernelTests\KernelTestBase
- class \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase implements \Drupal\Tests\migrate\Kernel\MigrateTestBase
- class \Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase uses \Drupal\Tests\migrate_drupal\Traits\NodeMigrateTypeTestTrait implements \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase
- class \Drupal\Tests\user\Kernel\Migrate\d6\MigrateUserProfileFieldInstanceTest implements \Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase
- class \Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase uses \Drupal\Tests\migrate_drupal\Traits\NodeMigrateTypeTestTrait implements \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase
- class \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase implements \Drupal\Tests\migrate\Kernel\MigrateTestBase
- class \Drupal\Tests\migrate\Kernel\MigrateTestBase extends \Drupal\migrate\MigrateMessageInterface implements \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of MigrateUserProfileFieldInstanceTest
File
-
core/
modules/ user/ tests/ src/ Kernel/ Migrate/ d6/ MigrateUserProfileFieldInstanceTest.php, line 13
Namespace
Drupal\Tests\user\Kernel\Migrate\d6View source
class MigrateUserProfileFieldInstanceTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'field',
];
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->executeMigrations([
'user_profile_field',
'user_profile_field_instance',
]);
}
/**
* Tests migration of user profile fields.
*/
public function testUserProfileFields() {
// Migrated a text field.
$field = FieldConfig::load('user.user.profile_color');
$this->assertSame('Favorite color', $field->label());
$this->assertSame('List your favorite color', $field->getDescription());
// Migrated a textarea.
$field = FieldConfig::load('user.user.profile_biography');
$this->assertSame('Biography', $field->label());
$this->assertSame('Tell people a little bit about yourself', $field->getDescription());
// Migrated checkbox field.
$field = FieldConfig::load('user.user.profile_sell_address');
$this->assertSame('Sell your email address?', $field->label());
$this->assertSame("If you check this box, we'll sell your address to spammers to help line the pockets of our shareholders. Thanks!", $field->getDescription());
// Migrated selection field.
$field = FieldConfig::load('user.user.profile_sold_to');
$this->assertSame('Sales Category', $field->label());
$this->assertSame("Select the sales categories to which this user's address was sold.", $field->getDescription());
// Migrated list field.
$field = FieldConfig::load('user.user.profile_bands');
$this->assertSame('Favorite bands', $field->label());
$this->assertSame("Enter your favorite bands. When you've saved your profile, you'll be able to find other people with the same favorites.", $field->getDescription());
// Migrated URL field.
$field = FieldConfig::load('user.user.profile_blog');
$this->assertSame('Blog', $field->label());
$this->assertSame("Paste the full URL, including http://, of your personal blog.", $field->getDescription());
// Migrated date field.
$field = FieldConfig::load('user.user.profile_birthdate');
$this->assertSame('Birthdate', $field->label());
$this->assertSame("Enter your birth date and we'll send you a coupon.", $field->getDescription());
// Another migrated checkbox field, with a different source visibility setting.
$field = FieldConfig::load('user.user.profile_really_really_love_mig');
$this->assertSame('I really, really, really love migrations', $field->label());
$this->assertSame("If you check this box, you love migrations.", $field->getDescription());
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.