You are here

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

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

Data provider for testTransform().

File

modules/commerce/tests/src/Unit/Plugin/migrate/process/commerce1/OrderItemDiscountAdjustmentTest.php, line 94

Class

OrderItemDiscountAdjustmentTest
Tests the order item discount adjustment plugin.

Namespace

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

Code

public function providerTestTransform() {
  return [
    'no components' => [
      [
        'name' => 'tax|sample_michigan_sales_tax',
        'price' => [
          'amount' => 288.0,
          'currency_code' => 'USD',
          'data' => [],
        ],
      ],
      [],
      [
        'data' => serialize([]),
      ],
      new Price(0, 'USD'),
      [],
    ],
    'not shipping and adjustment' => [
      [
        'name' => 'tax|sample_michigan_sales_tax',
        'price' => [
          'amount' => 288.0,
          'currency_code' => 'USD',
          'data' => [],
        ],
        'included' => FALSE,
      ],
      [
        [
          'name' => 'base_price',
          'price' => [
            'amount' => 4800.0,
            'currency_code' => 'USD',
            'data' => [],
          ],
          'included' => TRUE,
        ],
        [
          'name' => 'tax|sample_michigan_sales_tax',
          'price' => [
            'amount' => 288.0,
            'currency_code' => 'USD',
            'data' => [],
          ],
          'included' => FALSE,
        ],
      ],
      [
        [
          'line_item_id' => '26',
          'data' => serialize([
            'shipping_service' => [
              'name' => 'express_shipping',
              'price_component' => 'flat_rate_express_shipping',
            ],
          ]),
        ],
      ],
      new Price(10, 'USD'),
      new Price(10, 'USD'),
    ],
    'shipping no adjustment' => [
      [
        'name' => 'tax|sample_michigan_sales_tax',
        'price' => [
          'amount' => 288.0,
          'currency_code' => 'USD',
          'data' => [],
        ],
        'included' => FALSE,
      ],
      [
        [
          'name' => 'flat_rate_express_shipping',
          'price' => [
            'amount' => 288.0,
            'currency_code' => 'USD',
            'data' => [],
          ],
          'included' => FALSE,
        ],
      ],
      [
        [
          'line_item_id' => '26',
          'data' => serialize([
            'shipping_service' => [
              'name' => 'express_shipping',
              'price_component' => 'flat_rate_express_shipping',
            ],
          ]),
        ],
      ],
      new Price(0, 'USD'),
      [],
    ],
  ];
}