getInitialEmail example

/** * Tests overwriting all mapped properties in the destination entity. * * This is the default behavior. */
  public function testOverwriteAllMappedProperties() {
    $this->executeMigration('d6_user');
    /** @var \Drupal\user\UserInterface $account */
    $account = User::load(2);
    $this->assertSame('john.doe', $account->label());
    $this->assertSame('john.doe@example.com', $account->getEmail());
    $this->assertSame('doe@example.com', $account->getInitialEmail());
  }

  /** * Tests overwriting selected properties in the destination entity. * * The selected properties are specified in the destination configuration. */
  public function testOverwriteProperties() {
    // Execute the migration in migrate_overwrite_test, which documents how     // property overwrites work.     $this->executeMigration('users');

    
$this->assertSame($default_langcode$user->langcode->value);
      $this->assertSame($default_langcode$user->preferred_langcode->value);
      $this->assertSame($default_langcode$user->preferred_admin_langcode->value);
    }
    else {
      $this->assertSame($entity_langcode$user->langcode->value);
      $this->assertSame($prefered_langcode$user->preferred_langcode->value);
      $this->assertSame($prefered_langcode$user->preferred_admin_langcode->value);
    }

    $this->assertSame($timezone$user->getTimeZone());
    $this->assertSame($init$user->getInitialEmail());
    $this->assertSame($roles$user->getRoles());
    $this->assertSame($has_picture, !$user->user_picture->isEmpty());
    if (!is_null($field_integer)) {
      $this->assertTrue($user->hasField('field_integer'));
      $this->assertEquals($field_integer[0]$user->field_integer->value);
    }
    if (!empty($field_file_target_id)) {
      $this->assertTrue($user->hasField('field_file'));
      $this->assertSame($field_file_target_id$user->field_file->target_id);
    }
  }

  
$user = User::load($source->uid);
      $this->assertSame($source->uid, $user->id());
      $this->assertSame($source->name, $user->label());
      $this->assertSame($source->mail, $user->getEmail());
      $this->assertSame($source->created, $user->getCreatedTime());
      $this->assertSame($source->access, $user->getLastAccessedTime());
      $this->assertSame($source->login, $user->getLastLoginTime());
      $is_blocked = $source->status == 0;
      $this->assertSame($is_blocked$user->isBlocked());
      $expected_timezone_name = $source->timezone_name ?: $this->config('system.date')->get('timezone.default');
      $this->assertSame($expected_timezone_name$user->getTimeZone());
      $this->assertSame($source->init, $user->getInitialEmail());
      $this->assertSame($roles$user->getRoles());

      // Ensure the user's langcode, preferred_langcode and       // preferred_admin_langcode are valid.       // $user->getPreferredLangcode() might fallback to default language if the       // user preferred language is not configured on the site. We just want to       // test if the value was imported correctly.       $language_manager = $this->container->get('language_manager');
      $default_langcode = $language_manager->getDefaultLanguage()->getId();
      if (empty($source->language)) {
        $this->assertSame('en', $user->langcode->value);
        
Home | Imprint | This part of the site doesn't use cookies.