public function OrderItemDiscountAdjustmentTest::testGetAdjustment in Commerce Migrate 3.1.x
Same name and namespace in other branches
- 8.2 modules/commerce/tests/src/Unit/Plugin/migrate/process/commerce1/OrderItemDiscountAdjustmentTest.php \Drupal\Tests\commerce_migrate_commerce\Unit\Plugin\migrate\process\commerce1\OrderItemDiscountAdjustmentTest::testGetAdjustment()
- 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::testGetAdjustment()
Tests getAdjustment method.
@dataProvider providerTestGetAdjustment
File
- modules/
commerce/ tests/ src/ Unit/ Plugin/ migrate/ process/ commerce1/ OrderItemDiscountAdjustmentTest.php, line 262
Class
- OrderItemDiscountAdjustmentTest
- Tests the order item discount adjustment plugin.
Namespace
Drupal\Tests\commerce_migrate_commerce\Unit\Plugin\migrate\process\commerce1Code
public function testGetAdjustment($value, $last_line, $rounder_imput, $rounder_output, $split, $expected) {
$num_product_line = 1;
$row = $this
->prophesize(Row::class);
$row
->getSourceProperty('line_item_id')
->willReturn(2);
$row
->getSourceProperty('max_line_item_id')
->willReturn(1);
$row
->getSourceProperty('num_product_line')
->willReturn($num_product_line);
$this->rounder
->round($rounder_imput)
->willReturn($rounder_output);
$mock = $this
->getMockBuilder('\\Drupal\\Tests\\commerce_migrate_commerce\\Unit\\Plugin\\migrate\\process\\commerce1\\TestOrderItemDiscountAdjustment')
->disableOriginalConstructor()
->setMethods([
'split',
])
->getMock();
$mock
->expects($this
->any())
->method('split')
->willReturn($split);
$mock
->setRounder($this->rounder
->reveal());
$result = $mock
->getAdjustment($value, $this->migrateExecutable, $row
->reveal());
$this
->assertSame($expected, $result);
}