You are here

public function ProductNodeMigrationTest::testNoProducts in Commerce Migrate 8.2

Same name in this branch
  1. 8.2 modules/ubercart/tests/src/Kernel/Migrate/uc7/ProductNodeMigrationTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7\ProductNodeMigrationTest::testNoProducts()
  2. 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
  1. 3.1.x modules/ubercart/tests/src/Kernel/Migrate/uc6/ProductNodeMigrationTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc6\ProductNodeMigrationTest::testNoProducts()
  2. 3.0.x modules/ubercart/tests/src/Kernel/Migrate/uc6/ProductNodeMigrationTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc6\ProductNodeMigrationTest::testNoProducts()

Test node product type migrations are not created.

File

modules/ubercart/tests/src/Kernel/Migrate/uc6/ProductNodeMigrationTest.php, line 31

Class

ProductNodeMigrationTest
Tests that migrations for product nodes do not exist.

Namespace

Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc6

Code

public function testNoProducts() {

  /** @var \Drupal\Migrate\Plugin\Migration $migration */
  $migrations = $this->pluginManager
    ->createInstances([
    'd6_node',
  ]);
  $name = 'd6_node:page';
  $this
    ->assertArrayHasKey($name, $migrations, 'Node type page migration exists.');
  $migration = $migrations[$name];
  $destination = $migration
    ->getDestinationConfiguration();
  $this
    ->assertSame('entity:node', $destination['plugin']);
  $name = 'd6_node:story';
  $this
    ->assertArrayHasKey($name, $migrations, 'Node type story migration exists.');
  $migration = $migrations[$name];
  $destination = $migration
    ->getDestinationConfiguration();
  $this
    ->assertSame('entity:node', $destination['plugin']);
  $name = 'd6_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([
    'd6_node_translation',
  ]);

  // Translations are not enabled in the ubercart 6 test fixture.
  $this
    ->assertArrayNotHasKey('d6_node_translation:page', $migrations, 'Node translation migration for page exists.');
  $this
    ->assertArrayNotHasKey('d6_node_translation:story', $migrations, 'Node translation migration for story exists.');
  $this
    ->assertArrayNotHasKey('d6_node_translation:product', $migrations, 'Node translation migration for product  exists.');
}