You are here

public function NodeDeriverTest::testProductNodeMigrations in Commerce Migrate 3.1.x

Same name and namespace in other branches
  1. 8.2 modules/commerce/tests/src/Kernel/Migrate/commerce1/NodeDeriverTest.php \Drupal\Tests\commerce_migrate_commerce\Kernel\Migrate\commerce1\NodeDeriverTest::testProductNodeMigrations()
  2. 3.0.x modules/commerce/tests/src/Kernel/Migrate/commerce1/NodeDeriverTest.php \Drupal\Tests\commerce_migrate_commerce\Kernel\Migrate\commerce1\NodeDeriverTest::testProductNodeMigrations()

Test product node migrations for product displays do not exist.

File

modules/commerce/tests/src/Kernel/Migrate/commerce1/NodeDeriverTest.php, line 40

Class

NodeDeriverTest
Test Product Variation Deriver.

Namespace

Drupal\Tests\commerce_migrate_commerce\Kernel\Migrate\commerce1

Code

public function testProductNodeMigrations() {

  // Create the product variation derivatives.
  $migrations = $this->pluginManager
    ->createInstances([
    'd7_node',
  ]);

  // Test that node migrations for nodes exist.
  $nodes = [
    'ad_push',
    'blog_post',
    'page',
    'slideshow',
  ];
  foreach ($nodes as $node) {
    $this
      ->assertArrayHasKey('d7_node:' . $node, $migrations, "Node migration page does not exist");
  }

  // Test that derived node migrations for product nodes do not exist.
  $products = [
    'bags_cases',
    'drinks',
    'hats',
    'products',
    'shoes',
    'storage_devices',
    'tops',
  ];
  foreach ($products as $product) {
    $this
      ->assertArrayNotHasKey('d7_node:' . $product, $migrations, "Node migration {$product} exists");
  }
}