You are here

public function MigrateUserPictureFileTest::testUserPictures in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/user/src/Tests/Migrate/d6/MigrateUserPictureFileTest.php \Drupal\user\Tests\Migrate\d6\MigrateUserPictureFileTest::testUserPictures()

Tests the Drupal 6 user pictures to Drupal 8 migration.

File

core/modules/user/src/Tests/Migrate/d6/MigrateUserPictureFileTest.php, line 40
Contains \Drupal\user\Tests\Migrate\d6\MigrateUserPictureFileTest.

Class

MigrateUserPictureFileTest
User pictures migration.

Namespace

Drupal\user\Tests\Migrate\d6

Code

public function testUserPictures() {
  $file_ids = array();
  foreach ($this->migration
    ->getIdMap() as $destination_ids) {
    $file_ids[] = reset($destination_ids);
  }
  $files = File::loadMultiple($file_ids);

  /** @var \Drupal\file\FileInterface $file */
  $file = array_shift($files);
  $this
    ->assertIdentical('image-test.jpg', $file
    ->getFilename());
  $this
    ->assertIdentical('public://image-test.jpg', $file
    ->getFileUri());
  $this
    ->assertIdentical('2', $file
    ->getOwnerId());
  $this
    ->assertIdentical('1901', $file
    ->getSize());
  $this
    ->assertIdentical('image/jpeg', $file
    ->getMimeType());
  $file = array_shift($files);
  $this
    ->assertIdentical('image-test.png', $file
    ->getFilename());
  $this
    ->assertIdentical('public://image-test.png', $file
    ->getFileUri());
  $this
    ->assertIdentical('8', $file
    ->getOwnerId());
  $this
    ->assertFalse($files);
}