You are here

protected function DestinationCategoryTestTrait::assertCategories in Commerce Migrate 8.2

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

Asserts that all migrations are tagged as either Configuration or Content.

Parameters

\Drupal\migrate\Plugin\MigrationInterface[] $migrations: The migrations.

6 calls to DestinationCategoryTestTrait::assertCategories()
DestinationCategoryTest::testCommerceCategories in modules/commerce/tests/src/Kernel/Plugin/migrate/DestinationCategoryTest.php
Tests Commerce 1 migrations are tagged as either Configuration or Content.
DestinationCategoryTest::testMagento2Categories in modules/magento/tests/src/Kernel/Plugin/migrate/DestinationCategoryTest.php
Tests Commerce 1 migrations are tagged as either Configuration or Content.
DestinationCategoryTest::testMagento2Categories in modules/shopify/tests/src/Kernel/Plugin/migrate/DestinationCategoryTest.php
Tests Commerce 1 migrations are tagged as either Configuration or Content.
DestinationCategoryTest::testUbercart6Categories in modules/ubercart/tests/src/Kernel/Plugin/migrate/DestinationCategoryTest.php
Tests Ubercart 6 migrations are tagged as either Configuration or Content.
DestinationCategoryTest::testUbercart7Categories in modules/ubercart/tests/src/Kernel/Plugin/migrate/DestinationCategoryTest.php
Tests Ubercart 7 migrations are tagged as either Configuration or Content.

... See full list

File

tests/src/Kernel/Plugin/migrate/DestinationCategoryTestTrait.php, line 28

Class

DestinationCategoryTestTrait
Class DestinationCategoryTestTrait.

Namespace

Drupal\Tests\commerce_migrate\Kernel\Plugin\migrate

Code

protected function assertCategories(array $migrations) {
  foreach ($migrations as $id => $migration) {
    $object_classes = class_parents($migration
      ->getDestinationPlugin());
    $object_classes[] = get_class($migration
      ->getDestinationPlugin());

    // Ensure that the destination plugin is an instance of at least one of
    // the expected classes.
    if (in_array('Configuration', $migration
      ->getMigrationTags(), TRUE)) {
      $this
        ->assertNotEmpty(array_intersect($object_classes, $this
        ->getConfigurationClasses()), "The migration {$id} is tagged as Configuration.");
    }
    elseif (in_array('Content', $migration
      ->getMigrationTags(), TRUE)) {
      $this
        ->assertNotEmpty(array_intersect($object_classes, $this
        ->getContentClasses()), "The migration {$id} is tagged as Content.");
    }
    else {
      $this
        ->fail("The migration {$id} is not tagged as either 'Content' or 'Configuration'.");
    }
  }
}