public function OrderItemDiscountAdjustmentTest::testTransform in Commerce Migrate 8.2
Same name and namespace in other branches
- 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::testTransform()
- 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::testTransform()
Tests valid input.
@dataProvider providerTestTransform
File
- modules/
commerce/ tests/ src/ Unit/ Plugin/ migrate/ process/ commerce1/ OrderItemDiscountAdjustmentTest.php, line 68
Class
- OrderItemDiscountAdjustmentTest
- Tests the order item discount adjustment plugin.
Namespace
Drupal\Tests\commerce_migrate_commerce\Unit\Plugin\migrate\process\commerce1Code
public function testTransform($value, $components, $shipping, $getadj, $expected) {
$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);
$row
->getSourceProperty('max_line_item_id')
->willReturn(1);
$mock = $this
->getMockBuilder('\\Drupal\\Tests\\commerce_migrate_commerce\\Unit\\Plugin\\migrate\\process\\commerce1\\TestOrderItemDiscountAdjustment')
->disableOriginalConstructor()
->setMethods([
'getAdjustment',
])
->getMock();
$mock
->expects($this
->any())
->method('getAdjustment')
->willReturn($getadj);
$mock
->setRounder($this->rounder
->reveal());
$result = $mock
->transform($value, $this->migrateExecutable, $row
->reveal(), 'foo');
$this
->assertEquals($expected, $result);
}