You are here

public function OrderItemDiscountAdjustmentTest::testInvalidValue in Commerce Migrate 3.1.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::testInvalidValue()
  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::testInvalidValue()

Tests that exceptions are thrown as needed.

@dataProvider providerTestInvalidValue

File

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

Class

OrderItemDiscountAdjustmentTest
Tests the order item discount adjustment plugin.

Namespace

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

Code

public function testInvalidValue($value, $shipping, $components, $message) {
  $row = $this
    ->prophesize(Row::class);
  $row
    ->getSourceProperty('order_components/0/data/components')
    ->willReturn($components);
  $row
    ->getSourceProperty('shipping')
    ->willReturn($shipping);
  $row
    ->getSourceProperty('line_item_id')
    ->willReturn(2);
  $this
    ->expectException(MigrateSkipRowException::class);
  $this
    ->expectExceptionMessage($message);
  $configuration = [];
  $this->plugin = new OrderItemDiscountAdjustment($configuration, 'test', [], $this->migration
    ->reveal(), $this->migrationPluginManager
    ->reveal(), $this->entityTypeManager
    ->reveal(), $this->rounder
    ->reveal());
  $this->plugin
    ->transform($value, $this->migrateExecutable, $row
    ->reveal(), 'foo');
}