function MigrateUserPictureFileTest::testUserPictures
Tests the Drupal 6 user pictures to Drupal 8 migration.
File
-
core/
modules/ user/ tests/ src/ Kernel/ Migrate/ d6/ MigrateUserPictureFileTest.php, line 31
Class
- MigrateUserPictureFileTest
- User pictures migration.
Namespace
Drupal\Tests\user\Kernel\Migrate\d6Code
public function testUserPictures() {
$file_ids = [];
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->assertEmpty($files);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.