You are here

public function OrderItemAdjustmentTest::providerTestSplit in Commerce Migrate 3.0.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::providerTestSplit()
  2. 3.1.x modules/ubercart/tests/src/Unit/Plugin/migrate/process/OrderItemAdjustmentTest.php \Drupal\Tests\ubercart\Unit\Plugin\migrate\process\ubercart\OrderItemAdjustmentTest::providerTestSplit()

Data provider for testSplit().

File

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

Class

OrderItemAdjustmentTest
Tests order item adjustment process plugin.

Namespace

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

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'),
    ],
  ];
}