public function ProductNodeMigrationTest::testNoProducts in Commerce Migrate 8.2
Same name in this branch
- 8.2 modules/ubercart/tests/src/Kernel/Migrate/uc7/ProductNodeMigrationTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7\ProductNodeMigrationTest::testNoProducts()
- 8.2 modules/ubercart/tests/src/Kernel/Migrate/uc6/ProductNodeMigrationTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc6\ProductNodeMigrationTest::testNoProducts()
Same name and namespace in other branches
- 3.1.x modules/ubercart/tests/src/Kernel/Migrate/uc7/ProductNodeMigrationTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7\ProductNodeMigrationTest::testNoProducts()
- 3.0.x modules/ubercart/tests/src/Kernel/Migrate/uc7/ProductNodeMigrationTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7\ProductNodeMigrationTest::testNoProducts()
Test node product type migrations are created.
File
- modules/
ubercart/ tests/ src/ Kernel/ Migrate/ uc7/ ProductNodeMigrationTest.php, line 36
Class
- ProductNodeMigrationTest
- Tests that migrations for product nodes do not exist.
Namespace
Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7Code
public function testNoProducts() {
/** @var \Drupal\Migrate\Plugin\Migration $migration */
$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']);
// The destination is altered for nodes that are products.
$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',
]);
// Translations are not enabled in the ubercart 7 test fixture.
$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.');
}