You are here

public function OrderItemAdjustmentTest::providerTestTransform in Commerce Migrate 3.1.x

Same name and namespace in other branches
  1. 8.2 modules/ubercart/tests/src/Unit/Plugin/migrate/process/OrderItemAdjustmentTest.php \Drupal\Tests\ubercart\Unit\Plugin\migrate\process\ubercart\OrderItemAdjustmentTest::providerTestTransform()
  2. 3.0.x modules/ubercart/tests/src/Unit/Plugin/migrate/process/OrderItemAdjustmentTest.php \Drupal\Tests\ubercart\Unit\Plugin\migrate\process\ubercart\OrderItemAdjustmentTest::providerTestTransform()

Data provider for testTransform().

File

modules/ubercart/tests/src/Unit/Plugin/migrate/process/OrderItemAdjustmentTest.php, line 95

Class

OrderItemAdjustmentTest
Tests order item adjustment process plugin.

Namespace

Drupal\Tests\ubercart\Unit\Plugin\migrate\process\ubercart

Code

public function providerTestTransform() {
  return [
    'one line item' => [
      [
        'line_item_id' => '6',
        'order_id' => '2',
        'type' => 'tax',
        'title' => 'Handling',
        'amount' => '60.00000',
        'weight' => '9',
        'data' => [
          'tax_id' => '1',
          'tax_rate' => '0.04',
          'taxable_amount' => 1500.0,
          'tax_jurisdiction' => 'Handling',
        ],
        'currency_code' => 'NZD',
      ],
      1,
      TRUE,
      new Price(60.0, 'NZD'),
      2,
      2,
      new Price(60.0, 'NZD'),
      [
        'type' => 'tax',
        'label' => 'Handling',
        'amount' => '60',
        'currency_code' => 'NZD',
        'percentage' => '0.04',
        'source_id' => 'custom',
        'included' => FALSE,
        'locked' => TRUE,
      ],
    ],
    'first of 2 line items' => [
      [
        'line_item_id' => '5',
        'order_id' => '1',
        'type' => 'generic',
        'title' => 'Service',
        'amount' => '1.99000',
        'weight' => '2',
        'data' => NULL,
        'currency_code' => 'NZD',
      ],
      2,
      FALSE,
      new Price(1.99, 'NZD'),
      3,
      4,
      new Price(0.99, 'NZD'),
      [
        'type' => 'tax',
        'label' => 'Service',
        'amount' => '0.99',
        'currency_code' => 'NZD',
        'percentage' => NULL,
        'source_id' => 'custom',
        'included' => FALSE,
        'locked' => TRUE,
      ],
    ],
    'second of 2 line items' => [
      [
        'line_item_id' => '99',
        'order_id' => '1',
        'type' => 'tax',
        'title' => 'Handling',
        'amount' => '1.40000',
        'weight' => '9',
        'data' => [
          'tax_id' => '1',
          'tax_rate' => '0.04',
          'taxable_amount' => 35.0,
          'tax_jurisdiction' => 'Handling',
        ],
        'currency_code' => 'NZD',
      ],
      2,
      TRUE,
      new Price(1.4, 'NZD'),
      4,
      4,
      new Price(0.79, 'NZD'),
      [
        'type' => 'tax',
        'label' => 'Handling',
        'amount' => '0.79',
        'currency_code' => 'NZD',
        'percentage' => '0.04',
        'source_id' => 'custom',
        'included' => FALSE,
        'locked' => TRUE,
      ],
    ],
    'promotion' => [
      [
        'line_item_id' => '7',
        'order_id' => '1',
        'type' => 'coupon',
        'title' => 'Handling',
        'amount' => '1.40000',
        'weight' => '9',
        'data' => [],
        'currency_code' => 'NZD',
      ],
      2,
      TRUE,
      new Price(1.4, 'NZD'),
      4,
      4,
      new Price(0.7, 'NZD'),
      [
        'type' => 'promotion',
        'label' => 'Handling',
        'amount' => '0.7',
        'currency_code' => 'NZD',
        'percentage' => NULL,
        'source_id' => 'custom',
        'included' => FALSE,
        'locked' => TRUE,
      ],
    ],
    'no product line' => [
      [
        'line_item_id' => '7',
        'order_id' => '1',
        'type' => 'tax',
        'title' => 'Handling',
        'amount' => '1.40000',
        'weight' => '9',
        'data' => [],
        'currency_code' => 'NZD',
      ],
      0,
      TRUE,
      new Price(1.4, 'NZD'),
      4,
      4,
      NULL,
      [],
    ],
  ];
}