MigrateUserProfileFieldInstanceTest.php in Zircon Profile 8        
                          
                  
                        
  
  
  
File
  core/modules/user/src/Tests/Migrate/MigrateUserProfileFieldInstanceTest.php
  
    View source  
  <?php
namespace Drupal\user\Tests\Migrate;
use Drupal\field\Entity\FieldConfig;
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
class MigrateUserProfileFieldInstanceTest extends MigrateDrupal6TestBase {
  
  public static $modules = [
    'field',
  ];
  
  protected function setUp() {
    parent::setUp();
    $this
      ->executeMigrations([
      'user_profile_field',
      'user_profile_field_instance',
    ]);
  }
  
  public function testUserProfileFields() {
    
    $field = FieldConfig::load('user.user.profile_color');
    $this
      ->assertIdentical('Favorite color', $field
      ->label());
    $this
      ->assertIdentical('List your favorite color', $field
      ->getDescription());
    
    $field = FieldConfig::load('user.user.profile_biography');
    $this
      ->assertIdentical('Biography', $field
      ->label());
    $this
      ->assertIdentical('Tell people a little bit about yourself', $field
      ->getDescription());
    
    $field = FieldConfig::load('user.user.profile_sell_address');
    $this
      ->assertIdentical('Sell your email address?', $field
      ->label());
    $this
      ->assertIdentical("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
      ->assertIdentical('Sales Category', $field
      ->label());
    $this
      ->assertIdentical("Select the sales categories to which this user's address was sold.", $field
      ->getDescription());
    
    $field = FieldConfig::load('user.user.profile_bands');
    $this
      ->assertIdentical('Favorite bands', $field
      ->label());
    $this
      ->assertIdentical("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
      ->assertIdentical('Blog', $field
      ->label());
    $this
      ->assertIdentical("Paste the full URL, including http://, of your personal blog.", $field
      ->getDescription());
    
    $field = FieldConfig::load('user.user.profile_birthdate');
    $this
      ->assertIdentical('Birthdate', $field
      ->label());
    $this
      ->assertIdentical("Enter your birth date and we'll send you a coupon.", $field
      ->getDescription());
    
    $field = FieldConfig::load('user.user.profile_love_migrations');
    $this
      ->assertIdentical('I love migrations', $field
      ->label());
    $this
      ->assertIdentical("If you check this box, you love migrations.", $field
      ->getDescription());
  }
}