Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / migrate / tests / src / Kernel / Plugin / MigrationPluginListTest.php
index 62f3d19ba31a08f26270fdbc9de3a1c246e8a8a1..b256e3f3a3eaff7b95ae12bb828283177615a04a 100644 (file)
@@ -7,6 +7,7 @@ use Drupal\KernelTests\KernelTestBase;
 use Drupal\migrate\Exception\RequirementsException;
 use Drupal\migrate\Plugin\migrate\source\SqlBase;
 use Drupal\migrate\Plugin\RequirementsInterface;
+use Drupal\Tests\field\Traits\EntityReferenceTestTrait;
 
 /**
  * Tests the migration plugin manager.
@@ -16,6 +17,8 @@ use Drupal\migrate\Plugin\RequirementsInterface;
  */
 class MigrationPluginListTest extends KernelTestBase {
 
+  use EntityReferenceTestTrait;
+
   /**
    * {@inheritdoc}
    */
@@ -30,6 +33,7 @@ class MigrationPluginListTest extends KernelTestBase {
     'book',
     'comment',
     'contact',
+    'content_translation',
     'dblog',
     'field',
     'file',
@@ -41,6 +45,7 @@ class MigrationPluginListTest extends KernelTestBase {
     'menu_link_content',
     'menu_ui',
     'node',
+    'options',
     'path',
     'search',
     'shortcut',
@@ -59,6 +64,11 @@ class MigrationPluginListTest extends KernelTestBase {
    * @covers ::getDefinitions
    */
   public function testGetDefinitions() {
+    // Create an entity reference field to make sure that migrations derived by
+    // EntityReferenceTranslationDeriver do not get discovered without
+    // migrate_drupal enabled.
+    $this->createEntityReferenceField('user', 'user', 'field_entity_reference', 'Entity Reference', 'node');
+
     // Make sure retrieving all the core migration plugins does not throw any
     // errors.
     $migration_plugins = $this->container->get('plugin.manager.migration')->getDefinitions();
@@ -131,6 +141,11 @@ class MigrationPluginListTest extends KernelTestBase {
     $migration_plugins = $this->container->get('plugin.manager.migration')->getDefinitions();
     // All the plugins provided by core depend on migrate_drupal.
     $this->assertNotEmpty($migration_plugins);
+
+    // Test that migrations derived by EntityReferenceTranslationDeriver are
+    // discovered now that migrate_drupal is enabled.
+    $this->assertArrayHasKey('d6_entity_reference_translation:user__user', $migration_plugins);
+    $this->assertArrayHasKey('d7_entity_reference_translation:user__user', $migration_plugins);
   }
 
 }