summaryrefslogtreecommitdiffstats
path: root/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeDeriverTest.php
blob: abce689755de8b16c0ed0e410c91779f1f030c05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php

namespace Drupal\Tests\node\Kernel\Migrate\d6;

use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;

/**
 * Test D6NodeDeriver.
 *
 * @group migrate_drupal_6
 */
class MigrateNodeDeriverTest extends MigrateDrupal6TestBase {
  /**
   * The migration plugin manager.
   *
   * @var \Drupal\migrate\Plugin\MigrationPluginManagerInterface
   */
  protected $pluginManager;

  /**
   * {@inheritdoc}
   */
  public function setUp() {
    parent::setUp();
    $this->pluginManager = $this->container->get('plugin.manager.migration');
  }

  /**
   * Test node translation migrations with translation disabled.
   */
  public function testNoTranslations() {
    // Without content_translation, there should be no translation migrations.
    $migrations = $this->pluginManager->createInstances('d6_node_translation');
    $this->assertSame([], $migrations,
      "No node translation migrations without content_translation");
  }

  /**
   * Test node translation migrations with translation enabled.
   */
  public function testTranslations() {
    // With content_translation, there should be translation migrations for
    // each content type.
    $this->enableModules(['language', 'content_translation']);
    $migrations = $this->pluginManager->createInstances('d6_node_translation');
    $this->assertArrayHasKey('d6_node_translation:story', $migrations,
      "Node translation migrations exist after content_translation installed");
  }

}