You are here

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

Tests valid input.

@dataProvider providerTestSplit

File

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

Class

OrderItemAdjustmentTest
Tests order item adjustment process plugin.

Namespace

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

Code

public function testSplit($num_product_line, $last_line, $price, $split_rounder_input, $split_rounder_output, $expected) {
  $this->rounder
    ->round($split_rounder_input, PHP_ROUND_HALF_DOWN)
    ->willReturn($split_rounder_output);
  $configuration = [];
  $this->plugin = new TestOrderItemAdjustment($configuration, 'map', [], $this->migration
    ->reveal(), $this->migrationPluginManager
    ->reveal(), $this->entityTypeManager
    ->reveal(), $this->rounder
    ->reveal());
  $result = $this->plugin
    ->split($num_product_line, $last_line, $price);
  $this
    ->assertEquals($expected, $result);
}