You are here

protected function CommerceMigrateTestTrait::executeRollbacks in Commerce Migrate 8.2

Same name and namespace in other branches
  1. 3.1.x tests/src/Kernel/CommerceMigrateTestTrait.php \Drupal\Tests\commerce_migrate\Kernel\CommerceMigrateTestTrait::executeRollbacks()
  2. 3.0.x tests/src/Kernel/CommerceMigrateTestTrait.php \Drupal\Tests\commerce_migrate\Kernel\CommerceMigrateTestTrait::executeRollbacks()

Executes a set of migrations in dependency order.

Parameters

string[] $ids: Array of migration IDs, in any order.

5 calls to CommerceMigrateTestTrait::executeRollbacks()
ProductRollbackTest::testProduct in modules/ubercart/tests/src/Kernel/Migrate/uc7/ProductRollbackTest.php
Test product migration rollback.
ProductRollbackTest::testProduct in modules/commerce/tests/src/Kernel/Migrate/commerce1/ProductRollbackTest.php
Test product migration rollback.
ProductVariationRollbackTest::testProductVariation in modules/ubercart/tests/src/Kernel/Migrate/uc7/ProductVariationRollbackTest.php
Test product migration rollback.
ProductVariationRollbackTest::testProductVariation in modules/commerce/tests/src/Kernel/Migrate/commerce1/ProductVariationRollbackTest.php
Test product migration rollback.
ProductVariationRollbackTest::testProductVariation in modules/ubercart/tests/src/Kernel/Migrate/uc6/ProductVariationRollbackTest.php
Test product migration rollback.

File

tests/src/Kernel/CommerceMigrateTestTrait.php, line 944

Class

CommerceMigrateTestTrait
Helper function to test migrations.

Namespace

Drupal\Tests\commerce_migrate\Kernel

Code

protected function executeRollbacks(array $ids) {
  $manager = $this->container
    ->get('plugin.manager.migration');
  array_walk($ids, function ($id) use ($manager) {

    // This is possibly a base plugin ID and we want to run all derivatives.
    $instances = $manager
      ->createInstances($id);
    $this
      ->assertNotEmpty($instances, sprintf("No migrations created for id '%s'.", $id));
    array_walk($instances, [
      $this,
      'executeRollback',
    ]);
  });
}