2b7169a6cb8376a50de24499a4b5388f17fe32a6
[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    * The module handler service.
23    *
24    * @var \Drupal\Core\Extension\ModuleHandlerInterface
25    */
26   protected $moduleHandler;
27
28   /**
29    * {@inheritdoc}
30    */
31   public function setUp() {
32     parent::setUp();
33     $this->pluginManager = $this->container->get('plugin.manager.migration');
34     $this->moduleHandler = $this->container->get('module_handler');
35   }
36
37   /**
38    * Test node translation migrations with translation disabled.
39    */
40   public function testNoTranslations() {
41     // Enabling node module for this test.
42     $this->enableModules(['node']);
43     // Without content_translation, there should be no translation migrations.
44     $migrations = $this->pluginManager->createInstances('d7_node_translation');
45     $this->assertTrue($this->moduleHandler->moduleExists('node'));
46     $this->assertEmpty($migrations);
47   }
48
49   /**
50    * Test node translation migrations with translation enabled.
51    */
52   public function testTranslations() {
53     // With content_translation, there should be translation migrations for
54     // each content type.
55     $this->enableModules(['language', 'content_translation', 'node', 'filter']);
56     $migrations = $this->pluginManager->createInstances('d7_node_translation');
57     $this->assertArrayHasKey('d7_node_translation:article', $migrations,
58       "Node translation migrations exist after content_translation installed");
59   }
60
61 }