From f8decef7391859834c80d568b406e4d75d191bbc Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Mon, 25 Jan 2021 16:21:40 +0000 Subject: [PATCH] Issue #3194385 by benjifisher, quietone: Combine two tests of migrating D6 user pictures --- .../d6/MigrateUserPictureD6FileTest.php | 26 +++++++++- .../Migrate/d6/MigrateUserPictureFileTest.php | 52 ------------------- 2 files changed, 25 insertions(+), 53 deletions(-) delete mode 100644 core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserPictureFileTest.php diff --git a/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserPictureD6FileTest.php b/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserPictureD6FileTest.php index 95616814fe33..27d2da148545 100644 --- a/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserPictureD6FileTest.php +++ b/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserPictureD6FileTest.php @@ -24,7 +24,30 @@ class MigrateUserPictureD6FileTest extends MigrateDrupal6TestBase { $this->installEntitySchema('file'); $this->executeMigration('d6_user_picture_file'); - $this->setUpMigratedFiles(); + } + + /** + * Tests the Drupal 6 user pictures to Drupal 8 migration. + */ + 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->assertSame('image-test.jpg', $file->getFilename()); + $this->assertSame('public://image-test.jpg', $file->getFileUri()); + $this->assertSame('2', $file->getOwnerId()); + $this->assertSame('1901', $file->getSize()); + $this->assertSame('image/jpeg', $file->getMimeType()); + + $file = array_shift($files); + $this->assertSame('image-test.png', $file->getFilename()); + $this->assertSame('public://image-test.png', $file->getFileUri()); + $this->assertSame('8', $file->getOwnerId()); + $this->assertEmpty($files); } /** @@ -58,6 +81,7 @@ class MigrateUserPictureD6FileTest extends MigrateDrupal6TestBase { * Tests the D6 user pictures migration in combination with D6 file. */ public function testUserPicturesWithD6File() { + $this->setUpMigratedFiles(); $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'); diff --git a/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserPictureFileTest.php b/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserPictureFileTest.php deleted file mode 100644 index 09222aaf1286..000000000000 --- a/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserPictureFileTest.php +++ /dev/null @@ -1,52 +0,0 @@ -installEntitySchema('file'); - $this->executeMigration('d6_user_picture_file'); - } - - /** - * Tests the Drupal 6 user pictures to Drupal 8 migration. - */ - 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->assertSame('image-test.jpg', $file->getFilename()); - $this->assertSame('public://image-test.jpg', $file->getFileUri()); - $this->assertSame('2', $file->getOwnerId()); - $this->assertSame('1901', $file->getSize()); - $this->assertSame('image/jpeg', $file->getMimeType()); - - $file = array_shift($files); - $this->assertSame('image-test.png', $file->getFilename()); - $this->assertSame('public://image-test.png', $file->getFileUri()); - $this->assertSame('8', $file->getOwnerId()); - $this->assertEmpty($files); - } - -}