You are here

public function OrderPaymentTest::providerSource in Commerce Migrate 8.2

Same name and namespace in other branches
  1. 3.1.x modules/ubercart/tests/src/Kernel/Plugin/migrate/source/OrderPaymentTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source6\OrderPaymentTest::providerSource()
  2. 3.0.x modules/ubercart/tests/src/Kernel/Plugin/migrate/source/OrderPaymentTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source6\OrderPaymentTest::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/OrderPaymentTest.php, line 24

Class

OrderPaymentTest
Tests the Ubercart order payment source plugin.

Namespace

Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source6

Code

public function providerSource() {
  $tests = [];
  $tests[0]['source_data']['uc_payment_receipts'] = [
    [
      'receipt_id' => '1',
      'order_id' => '1',
      'method' => 'check',
      'title' => 'Product 1',
      'amount' => '2.00000',
      'uid' => 1,
      'data' => '',
      'comment' => 'Receipt 1',
      'received' => '1234567890',
    ],
    [
      'receipt_id' => '2',
      'order_id' => '3',
      'method' => 'cash',
      'title' => 'Product 1',
      'amount' => '6.00000',
      'uid' => 1,
      'data' => '',
      'comment' => 'Receipt 2',
      'received' => '9876543211',
    ],
  ];
  $tests[0]['source_data']['uc_orders'] = [
    [
      'order_id' => 1,
      'created' => '1234567890',
      'modified' => '1234567890',
    ],
    [
      'order_id' => 3,
      'created' => '1234567890',
      'modified' => '1234567890',
    ],
  ];
  $tests[0]['expected_data'] = [
    [
      'receipt_id' => '1',
      'order_id' => '1',
      'method' => 'check',
      'title' => 'Product 1',
      'amount' => '2.00000',
      'uid' => 1,
      'data' => '',
      'comment' => 'Receipt 1',
      'received' => '1234567890',
    ],
    [
      'receipt_id' => '2',
      'order_id' => '3',
      'method' => 'cash',
      'title' => 'Product 1',
      'amount' => '6.00000',
      'uid' => 1,
      'data' => '',
      'comment' => 'Receipt 2',
      'received' => '9876543211',
    ],
  ];
  return $tests;
}