You are here

public function CommerceAttributeTargetTypeTest::providerTestCommerceAttributeTargetType in Commerce Migrate 3.0.x

Same name and namespace in other branches
  1. 8.2 modules/commerce/tests/src/Unit/Plugin/migrate/process/commerce1/CommerceAttributeTargetTypeTest.php \Drupal\Tests\commerce_migrate_commerce\Unit\Plugin\migrate\process\commerce1\CommerceAttributeTargetTypeTest::providerTestCommerceAttributeTargetType()
  2. 3.1.x modules/commerce/tests/src/Unit/Plugin/migrate/process/commerce1/CommerceAttributeTargetTypeTest.php \Drupal\Tests\commerce_migrate_commerce\Unit\Plugin\migrate\process\commerce1\CommerceAttributeTargetTypeTest::providerTestCommerceAttributeTargetType()

Data provider for testCommerceAttributeTargetType().

File

modules/commerce/tests/src/Unit/Plugin/migrate/process/commerce1/CommerceAttributeTargetTypeTest.php, line 47

Class

CommerceAttributeTargetTypeTest
Tests the CommerceAttributeTargetType plugin.

Namespace

Drupal\Tests\commerce_migrate_commerce\Unit\Plugin\migrate\process\commerce1

Code

public function providerTestCommerceAttributeTargetType() {

  // Tests when this is an attribute value.
  $entity_type = 'commerce_product';
  $type = 'taxonomy_term_reference';
  $instances = [
    [
      'data' => serialize([
        'widget' => [
          'type' => 'options_select',
        ],
      ]),
    ],
  ];
  $tests[0]['source_properties'] = [
    $entity_type,
    $type,
    $instances,
  ];
  $tests[0]['destination_property'] = 'original_target_type';
  $tests[0]['expected'] = 'commerce_product_attribute_value';

  // Tests when not an attribute value.
  $entity_type = 'commerce_product';
  $type = 'taxonomy_term_reference';
  $instances = [
    [
      'data' => serialize([
        'widget' => [
          'type' => 'text',
        ],
      ]),
    ],
  ];
  $tests[1]['source_properties'] = [
    $entity_type,
    $type,
    $instances,
  ];
  $tests[1]['destination_property'] = 'original_target_type';
  $tests[1]['expected'] = 'original_target_type';
  return $tests;
}