You are here

public function OrderItemDiscountAdjustmentTest::testSplit in Commerce Migrate 3.0.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::testSplit()
  2. 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::testSplit()

Tests split method.

@dataProvider providerTestSplit

File

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

Class

OrderItemDiscountAdjustmentTest
Tests the order item discount adjustment plugin.

Namespace

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

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 TestOrderItemDiscountAdjustment($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);
}