ProductNodeMigrationTest.php in Commerce Migrate 8.2
File
modules/ubercart/tests/src/Kernel/Migrate/uc7/ProductNodeMigrationTest.php
View source
<?php
namespace Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7;
class ProductNodeMigrationTest extends Ubercart7TestBase {
public static $modules = [
'node',
];
protected $pluginManager;
public function setUp() {
parent::setUp();
$this->pluginManager = $this->container
->get('plugin.manager.migration');
}
public function testNoProducts() {
$migrations = $this->pluginManager
->createInstances([
'd7_node',
]);
$name = 'd7_node:page';
$this
->assertArrayHasKey($name, $migrations, 'Node type page migration exists.');
$migration = $migrations[$name];
$destination = $migration
->getDestinationConfiguration();
$this
->assertSame('entity:node', $destination['plugin']);
$name = 'd7_node:article';
$this
->assertArrayHasKey($name, $migrations, 'Node type article migration exists.');
$migration = $migrations[$name];
$destination = $migration
->getDestinationConfiguration();
$this
->assertSame('entity:node', $destination['plugin']);
$name = 'd7_node:product';
$this
->assertArrayHasKey($name, $migrations, 'Product type product migration exists.');
$migration = $migrations[$name];
$destination = $migration
->getDestinationConfiguration();
$this
->assertSame('entity:commerce_product', $destination['plugin']);
$this
->enableModules([
'language',
'content_translation',
]);
$migrations = $this->pluginManager
->createInstances([
'd7_node_translation',
]);
$this
->assertArrayNotHasKey('d7_node_translation:page', $migrations, 'Node translation migration for page exists.');
$this
->assertArrayNotHasKey('d7_node_translation:article', $migrations, 'Node translation migration for article exists.');
$this
->assertArrayNotHasKey('d7_node_translation:product', $migrations, 'Node translation migration for product exists.');
}
}