You are here

public function OrderItemDiscountAdjustmentTest::providerTestSplit 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::providerTestSplit()
  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::providerTestSplit()

Data provider for testSplit().

File

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

Class

OrderItemDiscountAdjustmentTest
Tests the order item discount adjustment plugin.

Namespace

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

Code

public function providerTestSplit() {
  $zero_price = new Price(0, 'USD');
  $ten_price = new Price(10.0, 'USD');
  return [
    'no product line' => [
      0,
      FALSE,
      $zero_price,
      $zero_price,
      $zero_price,
      NULL,
    ],
    'one product line not last line' => [
      1,
      FALSE,
      $ten_price,
      $ten_price,
      $ten_price,
      $ten_price,
    ],
    'one product line last line' => [
      1,
      TRUE,
      $ten_price,
      $ten_price,
      $ten_price,
      $ten_price,
    ],
    'two product lines not last line' => [
      2,
      FALSE,
      $ten_price,
      new Price(5.0, 'USD'),
      new Price(5.0, 'USD'),
      new Price(5.0, 'USD'),
    ],
    'two product lines last line' => [
      2,
      TRUE,
      $ten_price,
      new Price(5.0, 'USD'),
      new Price(5.0, 'USD'),
      new Price(5.0, 'USD'),
    ],
    'three product lines not last line' => [
      3,
      FALSE,
      new Price(10.0, 'USD'),
      new Price(3.333333, 'USD'),
      new Price(3.33, 'USD'),
      new Price(3.33, 'USD'),
    ],
    'three product lines last line' => [
      3,
      TRUE,
      new Price(10.0, 'USD'),
      new Price(3.333333, 'USD'),
      new Price(3.33, 'USD'),
      new Price(3.34, 'USD'),
    ],
  ];
}