diff --git a/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentTest.php b/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentTest.php index a0a8aa8e5138757d67e5abf0e715f63129303392..da27687cf101cb756055d02f699512ced07c0f5f 100644 --- a/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentTest.php +++ b/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentTest.php @@ -123,12 +123,8 @@ public function testMigration() { $node = $comment->getCommentedEntity(); $this->assertInstanceOf(NodeInterface::class, $node); $this->assertSame('1', $node->id()); - } - /** - * Tests the migration of comment entity translations. - */ - public function testCommentEntityTranslations() { + // Tests the migration of comment entity translations. $manager = $this->container->get('content_translation.manager'); // Get the comment and its translations. diff --git a/core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateUserConfigsTranslationTest.php b/core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateUserConfigsTranslationTest.php index 1db1c4fc0fc57033fc0ed224f1efac80599775f5..04b642243b29972ed50095ce0e249aa26b2bfbcb 100644 --- a/core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateUserConfigsTranslationTest.php +++ b/core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateUserConfigsTranslationTest.php @@ -59,12 +59,8 @@ public function testUserMail() { $config = \Drupal::service('language_manager')->getLanguageConfigOverride('zu', 'user.mail'); $this->assertSame('zu - An administrator created an account for you at [site:name]', $config->get('register_admin_created.subject')); $this->assertSame("zu - [user:name],\r\n\r\nA site administrator at [site:name] has created an account for you. You may now log in to [site:login-url] using the following username and password:\r\n\r\nusername: [user:name]\r\npassword: \r\n\r\nYou may also log in by clicking on this link or copying and pasting it in your browser:\r\n\r\n[user:one-time-login-url]\r\n\r\nThis is a one-time login, so it can be used only once.\r\n\r\nAfter logging in, you will be redirected to [user:edit-url] so you can change your password.\r\n\r\n\r\n-- [site:name] team", $config->get('register_admin_created.body')); - } - /** - * Tests migration of i18n user variables to user.settings.yml. - */ - public function testUserSettings() { + // Tests migration of i18n user variables to user.settings.yml. $config = \Drupal::service('language_manager')->getLanguageConfigOverride('fr', 'user.settings'); $this->assertSame(1, $config->get('notify.status_blocked')); $this->assertSame(0, $config->get('notify.status_activated')); diff --git a/core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentSettingsTest.php b/core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentSettingsTest.php index a5b23485093f989ab429598ff0dd34b315f45c56..1c17d3dedf63a898b3402ac489fbe23676046f66 100644 --- a/core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentSettingsTest.php +++ b/core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentSettingsTest.php @@ -51,13 +51,8 @@ public function testLanguageContent() { $this->assertTrue($config->isDefaultConfiguration()); $this->assertFalse($config->isLanguageAlterable()); $this->assertSame($config->getDefaultLangcode(), 'site_default'); - } - /** - * Tests migration of content language settings when there is no language lock. - */ - public function testLanguageContentWithNoLanguageLock() { - // Assert that a we can assign a language. + // Assert that a we can assign a language when there is no language lock. $config = ContentLanguageSettings::loadByEntityTypeBundle('node', 'employee'); $this->assertSame($config->getDefaultLangcode(), 'current_interface'); $this->assertTrue($config->isLanguageAlterable()); diff --git a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php index fb61c3c62104a7abde1b73915264fa79c9f5d538..65b1ad85e3049f456419503d54d8d377173546b2 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php @@ -250,12 +250,7 @@ public function testNode() { $node = $node->getTranslation('is'); $this->assertSame($value, $node->field_text_plain->value); - } - - /** - * Test node entity translations migration from Drupal 7 to 8. - */ - public function testNodeEntityTranslations() { + // Test node entity translations migration from Drupal 7 to 8. $manager = $this->container->get('content_translation.manager'); // Get the node and its translations. diff --git a/core/modules/path/tests/src/Kernel/Migrate/d6/MigrateUrlAliasTest.php b/core/modules/path/tests/src/Kernel/Migrate/d6/MigrateUrlAliasTest.php index 974cfd54e0b14bd3156f89114359c3b621afad94..984014476c49fa0b7f4d9352d8e482c81d51a8be 100644 --- a/core/modules/path/tests/src/Kernel/Migrate/d6/MigrateUrlAliasTest.php +++ b/core/modules/path/tests/src/Kernel/Migrate/d6/MigrateUrlAliasTest.php @@ -122,14 +122,9 @@ public function testUrlAlias() { 'langcode' => 'und', ]; $this->assertPath(8, $conditions, $path_alias); - } - /** - * Test the URL alias migration with translated nodes. - */ - public function testUrlAliasWithTranslatedNodes() { + // Test the URL alias migration with translated nodes. // Alias for the 'The Real McCoy' node in English. - $path_alias = $this->loadPathAliasByConditions(['alias' => '/the-real-mccoy']); $this->assertSame('/node/10', $path_alias->getPath()); $this->assertSame('en', $path_alias->get('langcode')->value); diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeComplete.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeComplete.php index be2d04497648b39301b87f051a61b542e95c65c6..97beb2de1960519b549ae0c48216b56c71665468 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeComplete.php +++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeComplete.php @@ -62,12 +62,8 @@ public function testTermNode() { $this->assertCount(2, $node->field_vocabulary_2_i_1_); $this->assertSame('2', $node->field_vocabulary_2_i_1_[0]->target_id); $this->assertSame('3', $node->field_vocabulary_2_i_1_[1]->target_id); - } - /** - * Tests the Drupal 6 term-node association to Drupal 8 node revisions. - */ - public function testTermNodeRevision() { + // Tests the Drupal 6 term-node association to Drupal 8 node revisions. $this->executeMigrations(['d6_term_node_revision']); $node = \Drupal::entityTypeManager()->getStorage('node')->loadRevision(2001); diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTest.php index 0855ba09575013d255368680af3b77dc522e22bb..ab2afce6e1f52a52057e35a28e65a55f5c20b90b 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateTaxonomyTermTest.php @@ -154,49 +154,8 @@ public function testTaxonomyTerms() { // Fixed. $this->assertEntity(24, 'fr', 'FR - Crewman', 'vocabfixed', NULL, NULL, '0', []); - } - - /** - * Retrieves the parent term IDs for a given term. - * - * @param $tid - * ID of the term to check. - * - * @return array - * List of parent term IDs. - */ - protected function getParentIDs($tid) { - return array_keys(\Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadParents($tid)); - } - /** - * Assert that a term is present in the tree storage, with the right parents. - * - * @param string $vid - * Vocabulary ID. - * @param int $tid - * ID of the term to check. - * @param array $parent_ids - * The expected parent term IDs. - */ - protected function assertHierarchy($vid, $tid, array $parent_ids) { - if (!isset($this->treeData[$vid])) { - $tree = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree($vid); - $this->treeData[$vid] = []; - foreach ($tree as $item) { - $this->treeData[$vid][$item->tid] = $item; - } - } - - $this->assertArrayHasKey($tid, $this->treeData[$vid], "Term $tid exists in taxonomy tree"); - $term = $this->treeData[$vid][$tid]; - $this->assertEquals($parent_ids, array_filter($term->parents), "Term $tid has correct parents in taxonomy tree"); - } - - /** - * Tests the migration of taxonomy term entity translations. - */ - public function testTaxonomyTermEntityTranslations() { + // Tests the migration of taxonomy term entity translations. $manager = $this->container->get('content_translation.manager'); // Get the term and its translations. @@ -245,4 +204,41 @@ public function testTaxonomyTermEntityTranslations() { $this->assertSame($term->parent->terget_id, $term_is->parent->terget_id); } + /** + * Retrieves the parent term IDs for a given term. + * + * @param $tid + * ID of the term to check. + * + * @return array + * List of parent term IDs. + */ + protected function getParentIDs($tid) { + return array_keys(\Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadParents($tid)); + } + + /** + * Assert that a term is present in the tree storage, with the right parents. + * + * @param string $vid + * Vocabulary ID. + * @param int $tid + * ID of the term to check. + * @param array $parent_ids + * The expected parent term IDs. + */ + protected function assertHierarchy($vid, $tid, array $parent_ids) { + if (!isset($this->treeData[$vid])) { + $tree = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree($vid); + $this->treeData[$vid] = []; + foreach ($tree as $item) { + $this->treeData[$vid][$item->tid] = $item; + } + } + + $this->assertArrayHasKey($tid, $this->treeData[$vid], "Term $tid exists in taxonomy tree"); + $term = $this->treeData[$vid][$tid]; + $this->assertEquals($parent_ids, array_filter($term->parents), "Term $tid has correct parents in taxonomy tree"); + } + } diff --git a/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserConfigsTest.php b/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserConfigsTest.php index 9c85befcd6fbc24b6456bfd851e5c3c5214462ce..1708dbb43e5757b615dc773270aed28bd7bd2201 100644 --- a/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserConfigsTest.php +++ b/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserConfigsTest.php @@ -46,12 +46,8 @@ public function testUserMail() { $this->assertSame('Account details for [user:name] at [site:name] (blocked)', $config->get('status_blocked.subject')); $this->assertSame("[user:name],\n\nYour account on [site:name] has been blocked.", $config->get('status_blocked.body')); $this->assertConfigSchema(\Drupal::service('config.typed'), 'user.mail', $config->get()); - } - /** - * Tests migration of user variables to user.settings.yml. - */ - public function testUserSettings() { + // Tests migration of user variables to user.settings.yml. $config = $this->config('user.settings'); $this->assertTrue($config->get('notify.status_blocked')); $this->assertFalse($config->get('notify.status_activated')); 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 27d2da148545e3e0a7de2f67ad955dd0febf8de1..ffeb2442ba7aff79564d3a113f49c2a4dbe77055 100644 --- a/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserPictureD6FileTest.php +++ b/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserPictureD6FileTest.php @@ -48,6 +48,15 @@ public function testUserPictures() { $this->assertSame('public://image-test.png', $file->getFileUri()); $this->assertSame('8', $file->getOwnerId()); $this->assertEmpty($files); + + // Tests the D6 user pictures migration in combination with D6 file. + $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'); + $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'); } /** @@ -77,17 +86,4 @@ protected function assertEntity($fid, $name, $size, $uri, $type, $uid) { $this->assertSame($uid, $file->getOwnerId()); } - /** - * 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'); - $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'); - } - } diff --git a/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserTest.php b/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserTest.php index 179d80e0c80795fb956c1406a0b5ca04547da5e3..8f40bea87ce012a28a4b8f98d1215d939695c6e4 100644 --- a/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserTest.php +++ b/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserTest.php @@ -217,12 +217,8 @@ public function testUser() { $user = User::load($source->uid); $this->assertEquals($rehash, $user->getPassword()); } - } - /** - * Tests the Drupal 7 user entity translations to Drupal 8 migration. - */ - public function testUserEntityTranslations() { + // Tests the Drupal 7 user entity translations to Drupal 8 migration. $manager = $this->container->get('content_translation.manager'); // Get the user and its translations.