View source
<?php
namespace Drupal\Tests\user\Kernel\Migrate\d6;
use Drupal\field\Entity\FieldConfig;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
class MigrateUserProfileFieldInstanceTest extends MigrateDrupal6TestBase {
protected static $modules = [
'field',
];
protected function setUp() : void {
parent::setUp();
$this
->executeMigrations([
'user_profile_field',
'user_profile_field_instance',
]);
}
public function testUserProfileFields() {
$field = FieldConfig::load('user.user.profile_color');
$this
->assertSame('Favorite color', $field
->label());
$this
->assertSame('List your favorite color', $field
->getDescription());
$field = FieldConfig::load('user.user.profile_biography');
$this
->assertSame('Biography', $field
->label());
$this
->assertSame('Tell people a little bit about yourself', $field
->getDescription());
$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());
$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());
$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());
$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());
$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());
$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());
}
}