public function OrderItemAdjustmentTest::testTransform in Commerce Migrate 3.1.x
Same name and namespace in other branches
- 8.2 modules/ubercart/tests/src/Unit/Plugin/migrate/process/OrderItemAdjustmentTest.php \Drupal\Tests\ubercart\Unit\Plugin\migrate\process\ubercart\OrderItemAdjustmentTest::testTransform()
- 3.0.x modules/ubercart/tests/src/Unit/Plugin/migrate/process/OrderItemAdjustmentTest.php \Drupal\Tests\ubercart\Unit\Plugin\migrate\process\ubercart\OrderItemAdjustmentTest::testTransform()
Tests valid input.
@dataProvider providerTestTransform
File
- modules/
ubercart/ tests/ src/ Unit/ Plugin/ migrate/ process/ OrderItemAdjustmentTest.php, line 67
Class
- OrderItemAdjustmentTest
- Tests order item adjustment process plugin.
Namespace
Drupal\Tests\ubercart\Unit\Plugin\migrate\process\ubercartCode
public function testTransform($value, $num_product_line, $last_line, $rounder_output, $order_product_id, $max_order_product_id, $split, $expected) {
$row = $this
->prophesize(Row::class);
$row
->getSourceProperty('num_product_line')
->willReturn($num_product_line);
$row
->getSourceProperty('order_product_id')
->willReturn($order_product_id);
$row
->getSourceProperty('max_order_product_id')
->willReturn($max_order_product_id);
$price = new Price((string) $value['amount'], $value['currency_code']);
$this->rounder
->round($price)
->willReturn($rounder_output);
$mock = $this
->getMockBuilder('\\Drupal\\Tests\\ubercart\\Unit\\Plugin\\migrate\\process\\ubercart\\TestOrderItemAdjustment')
->disableOriginalConstructor()
->setMethods([
'split',
])
->getMock();
$mock
->expects($this
->once())
->method('split')
->with($num_product_line, $last_line, $price)
->willReturn($split);
$mock
->setRounder($this->rounder
->reveal());
$result = $mock
->transform($value, $this->migrateExecutable, $row
->reveal(), 'foo');
$this
->assertEquals($expected, $result);
}