only in patch2: unchanged: --- a/core/modules/file/tests/src/Kernel/Migrate/d6/MigrateFileTest.php +++ b/core/modules/file/tests/src/Kernel/Migrate/d6/MigrateFileTest.php @@ -69,7 +69,7 @@ public function testFiles() { $this->assertEntity(1, 'Image1.png', '39325', 'public://image-1.png', 'image/png', '1'); $this->assertEntity(2, 'Image2.jpg', '1831', 'public://image-2.jpg', 'image/jpeg', '1'); $this->assertEntity(3, 'Image-test.gif', '183', 'public://image-test.gif', 'image/jpeg', '1'); - $this->assertEntity(5, 'html-1.txt', '24', 'public://html-1.txt', 'text/plain', '1'); + $this->assertEntity(4, 'html-1.txt', '24', 'public://html-1.txt', 'text/plain', '1'); // Test that we can re-import and also test with file_directory_path set. \Drupal::database() @@ -93,9 +93,9 @@ public function testFiles() { $file = File::load(2); $this->assertIdentical('public://core/modules/simpletest/files/image-2.jpg', $file->getFileUri()); - // File 7, created in static::migrateDumpAlter(), shares a path with - // file 5, which means it should be skipped entirely. - $this->assertNull(File::load(7)); + // File 5, created in static::migrateDumpAlter(), shares a path with + // file 4, which means it should be skipped entirely. + $this->assertNull(File::load(5)); } /** only in patch2: unchanged: --- a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTest.php @@ -77,7 +77,7 @@ public function testNode() { // Test the file field meta. $this->assertIdentical('desc', $node->field_test_filefield->description); - $this->assertIdentical('5', $node->field_test_filefield->target_id); + $this->assertIdentical('4', $node->field_test_filefield->target_id); $node = Node::load(2); $this->assertIdentical('Test title rev 3', $node->getTitle()); only in patch2: unchanged: --- /dev/null +++ b/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserPictureD6FileTest.php @@ -0,0 +1,69 @@ +installEntitySchema('file'); + $this->executeMigration('d6_user_picture_file'); + $this->setUpMigratedFiles(); + } + + /** + * Asserts a file entity. + * + * @param int $fid + * The file ID. + * @param string $name + * The expected file name. + * @param int $size + * The expected file size. + * @param string $uri + * The expected file URI. + * @param string $type + * The expected MIME type. + * @param int $uid + * The expected file owner ID. + */ + protected function assertEntity($fid, $name, $size, $uri, $type, $uid) { + /** @var \Drupal\file\FileInterface $file */ + $file = File::load($fid); + $this->assertInstanceOf(FileInterface::class, $file); + $this->assertSame($name, $file->getFilename()); + $this->assertSame($size, $file->getSize()); + $this->assertSame($uri, $file->getFileUri()); + $this->assertSame($type, $file->getMimeType()); + $this->assertSame($uid, $file->getOwnerId()); + } + + /** + * Tests the D6 user pictures migration in combination with D6 file. + */ + public function testUserPicturesWithD6File() { + $this->assertEntity(1, 'image-test.jpg', '1901', 'public://image-test.jpg', 'image/jpeg', '2'); + $this->assertEntity(2, 'image-test.png', '125', 'public://image-test.png', 'image/png', '8'); + $this->assertEntity(3, 'Image1.png', '39325', 'public://image-1.png', 'image/png', '1'); + $this->assertEntity(4, 'Image2.jpg', '1831', 'public://image-2.jpg', 'image/jpeg', '1'); + $this->assertEntity(5, 'Image-test.gif', '183', 'public://image-test.gif', 'image/jpeg', '1'); + $this->assertEntity(6, 'html-1.txt', '24', 'public://html-1.txt', 'text/plain', '1'); + } + +}