You are here

public function ProductTypeTest::providerSource in Commerce Migrate 8.2

Same name in this branch
  1. 8.2 modules/ubercart/tests/src/Kernel/Plugin/migrate/source/uc7/ProductTypeTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source\uc7\ProductTypeTest::providerSource()
  2. 8.2 modules/ubercart/tests/src/Kernel/Plugin/migrate/source/uc6/ProductTypeTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source\uc6\ProductTypeTest::providerSource()
  3. 8.2 modules/commerce/tests/src/Kernel/Plugin/migrate/source/commerce1/ProductTypeTest.php \Drupal\Tests\commerce_migrate_commerce\Kernel\Plugin\migrate\source\commerce1\ProductTypeTest::providerSource()
Same name and namespace in other branches
  1. 3.1.x modules/ubercart/tests/src/Kernel/Plugin/migrate/source/uc6/ProductTypeTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source\uc6\ProductTypeTest::providerSource()
  2. 3.0.x modules/ubercart/tests/src/Kernel/Plugin/migrate/source/uc6/ProductTypeTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source\uc6\ProductTypeTest::providerSource()

The data provider.

Return value

array Array of data sets to test, each of which is a numerically indexed array with the following elements:

  • An array of source data, which can be optionally processed and set up by subclasses.
  • An array of expected result rows.
  • (optional) The number of result rows the plugin under test is expected to return. If this is not a numeric value, the plugin will not be counted.
  • (optional) Array of configuration options for the plugin under test.

Overrides MigrateSourceTestBase::providerSource

See also

\Drupal\Tests\migrate\Kernel\MigrateSourceTestBase::testSource

File

modules/ubercart/tests/src/Kernel/Plugin/migrate/source/uc6/ProductTypeTest.php, line 28

Class

ProductTypeTest
Tests the Ubercart product type source plugin.

Namespace

Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source\uc6

Code

public function providerSource() {
  $tests = [];

  // The source data.
  $tests[0]['source_data']['node_type'] = [
    [
      'type' => 'page',
      'name' => 'Page',
      'module' => 'node',
      'description' => 'A page',
      'help' => '',
      'title_label' => 'Title',
      'has_body' => 1,
      'body_label' => 'Body',
      'min_word_count' => 0,
      'custom' => 1,
      'modified' => 0,
      'locked' => 0,
      'orig_type' => 'page',
    ],
    [
      'type' => 'product',
      'name' => 'Product',
      'module' => 'uc_product',
      'description' => '',
      'help' => '',
      'title_label' => 'Title',
      'has_body' => 1,
      'body_label' => 'Body',
      'min_word_count' => 0,
      'custom' => 1,
      'modified' => 0,
      'locked' => 0,
      'orig_type' => 'product',
    ],
    [
      'type' => 'product_kit',
      'name' => 'Product Kit',
      'module' => 'uc_product_kit',
      'description' => '',
      'help' => '',
      'title_label' => 'Title',
      'has_body' => 1,
      'body_label' => 'Body',
      'min_word_count' => 0,
      'custom' => 1,
      'modified' => 0,
      'locked' => 0,
      'orig_type' => 'product_kit',
    ],
  ];

  // The expected results.
  $tests[0]['expected_data'] = [
    [
      'type' => 'product',
      'name' => 'Product',
      'module' => 'uc_product',
      'description' => '',
      'help' => '',
      'title_label' => 'Title',
      'has_body' => 1,
      'body_label' => 'Body',
      'min_word_count' => 0,
      'custom' => 1,
      'modified' => 0,
      'locked' => 0,
      'orig_type' => 'product',
    ],
    [
      'type' => 'product_kit',
      'name' => 'Product Kit',
      'module' => 'uc_product_kit',
      'description' => '',
      'help' => '',
      'title_label' => 'Title',
      'has_body' => 1,
      'body_label' => 'Body',
      'min_word_count' => 0,
      'custom' => 1,
      'modified' => 0,
      'locked' => 0,
      'orig_type' => 'product_kit',
    ],
  ];
  return $tests;
}