569582dd8653ce288a9c36249abb7b80fbec95a5
[yaffs-website] / web / core / modules / node / tests / src / Kernel / Migrate / d7 / MigrateNodeDeriverTest.php
1 <?php
2
3 namespace Drupal\Tests\node\Kernel\Migrate\d7;
4
5 use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
6
7 /**
8  * Test D7NodeDeriver.
9  *
10  * @group migrate_drupal_7
11  */
12 class MigrateNodeDeriverTest extends MigrateDrupal7TestBase {
13
14   /**
15    * The migration plugin manager.
16    *
17    * @var \Drupal\migrate\Plugin\MigrationPluginManagerInterface
18    */
19   protected $pluginManager;
20
21   /**
22    * {@inheritdoc}
23    */
24   public function setUp() {
25     parent::setUp();
26     $this->pluginManager = $this->container->get('plugin.manager.migration');
27   }
28
29   /**
30    * Test node translation migrations with translation disabled.
31    */
32   public function testNoTranslations() {
33     // Without content_translation, there should be no translation migrations.
34     $migrations = $this->pluginManager->createInstances('d7_node_translation');
35     $this->assertSame([], $migrations,
36       "No node translation migrations without content_translation");
37   }
38
39   /**
40    * Test node translation migrations with translation enabled.
41    */
42   public function testTranslations() {
43     // With content_translation, there should be translation migrations for
44     // each content type.
45     $this->enableModules(['language', 'content_translation', 'node', 'filter']);
46     $migrations = $this->pluginManager->createInstances('d7_node_translation');
47     $this->assertArrayHasKey('d7_node_translation:article', $migrations,
48       "Node translation migrations exist after content_translation installed");
49   }
50
51 }