You are here

public function OrderItemDiscountAdjustmentTest::providerTestGetAdjustment in Commerce Migrate 8.2

Same name and namespace in other branches
  1. 3.1.x modules/commerce/tests/src/Unit/Plugin/migrate/process/commerce1/OrderItemDiscountAdjustmentTest.php \Drupal\Tests\commerce_migrate_commerce\Unit\Plugin\migrate\process\commerce1\OrderItemDiscountAdjustmentTest::providerTestGetAdjustment()
  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::providerTestGetAdjustment()

Data provider for testGetAdjustment().

File

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

Class

OrderItemDiscountAdjustmentTest
Tests the order item discount adjustment plugin.

Namespace

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

Code

public function providerTestGetAdjustment() {
  return [
    'not array' => [
      'not array',
      FALSE,
      NULL,
      NULL,
      NULL,
      [],
    ],
    'base price' => [
      [
        'name' => 'base_price',
      ],
      FALSE,
      NULL,
      NULL,
      NULL,
      [],
    ],
    'tax' => [
      [
        'name' => 'tax|sales_tax',
        'price' => [
          'amount' => 1000.0,
          'currency_code' => 'USD',
          'data' => [
            'tax_rate' => [
              'name' => 'A tax',
              'display_title' => 'Sales tax',
              'rate' => '0.05',
              'type' => 'sales_tax',
            ],
          ],
        ],
        'included' => FALSE,
      ],
      FALSE,
      new Price(10.0, 'USD'),
      new Price(10.0, 'USD'),
      new Price(10.0, 'USD'),
      [
        'type' => 'tax',
        'label' => 'Sales tax',
        'amount' => '10',
        'currency_code' => 'USD',
        'percentage' => '0.05',
        'source_id' => 'custom',
        'included' => FALSE,
        'locked' => TRUE,
      ],
    ],
    'discount' => [
      [
        'name' => 'discount|arbor',
        'price' => [
          'amount' => 2000,
          'currency_code' => 'USD',
          'data' => [
            'discount_component_title' => 'Arbor',
          ],
        ],
        'included' => FALSE,
      ],
      FALSE,
      new Price(20, 'USD'),
      new Price(20, 'USD'),
      new Price(20, 'USD'),
      [
        'type' => 'promotion',
        'label' => 'Arbor',
        'amount' => '20',
        'currency_code' => 'USD',
        'percentage' => NULL,
        'source_id' => 'custom',
        'included' => FALSE,
        'locked' => TRUE,
      ],
    ],
  ];
}