You are here

public function CommerceFieldNameTest::providerCommerceFieldName 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/CommerceFieldNameTest.php \Drupal\Tests\commerce_migrate_commerce\Unit\Plugin\migrate\process\commerce1\CommerceFieldNameTest::providerCommerceFieldName()
  2. 3.1.x modules/commerce/tests/src/Unit/Plugin/migrate/process/commerce1/CommerceFieldNameTest.php \Drupal\Tests\commerce_migrate_commerce\Unit\Plugin\migrate\process\commerce1\CommerceFieldNameTest::providerCommerceFieldName()

Data provider for testCommerceFieldName().

File

modules/commerce/tests/src/Unit/Plugin/migrate/process/commerce1/CommerceFieldNameTest.php, line 78

Class

CommerceFieldNameTest
Tests the CommerceFieldName plugin.

Namespace

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

Code

public function providerCommerceFieldName() {

  // Tests attribute field name is stripped of leading 'field_'.
  $tests[0]['destination_property'] = NULL;
  $field_name = 'field_color';
  $entity_type = 'commerce_product';
  $type = 'taxonomy_term_reference';
  $instances = [
    [
      'data' => serialize([
        'widget' => [
          'type' => 'options_select',
        ],
      ]),
    ],
    [
      'data' => serialize([
        'widget' => [
          'type' => 'text',
        ],
      ]),
    ],
  ];
  $tests[0]['source_properties'] = [
    $field_name,
    $entity_type,
    $type,
    $instances,
  ];
  $tests[0]['expected'] = 'color';
  return $tests;
}