14 use \Magento\Bundle\Model\Selection;
21 private $bundleOptionPrice;
26 private $objectManagerHelper;
31 private $saleableItemMock;
36 private $bundleCalculatorMock;
41 private $bundleOptionsMock;
48 $this->bundleOptionsMock = $this->createMock(BundleOptions::class);
49 $this->saleableItemMock = $this->createMock(Product::class);
50 $this->bundleCalculatorMock = $this->createMock(Calculator::class);
52 $this->objectManagerHelper =
new ObjectManagerHelper($this);
53 $this->bundleOptionPrice = $this->objectManagerHelper->getObject(
56 'saleableItem' => $this->saleableItemMock,
58 'calculator' => $this->bundleCalculatorMock,
59 'bundleOptions' => $this->bundleOptionsMock,
72 $this->bundleOptionsMock->expects($this->any())
73 ->method(
'getOptions')
75 $this->assertEquals(
$collection, $this->bundleOptionPrice->getOptions());
85 $selectionAmount = $this->createMock(AmountInterface::class);
86 $product = $this->createMock(Product::class);
87 $selection = $this->createMock(Selection::class);
88 $this->bundleOptionsMock->expects($this->any())
89 ->method(
'getOptionSelectionAmount')
90 ->will($this->returnValue($selectionAmount))
92 $this->assertEquals($selectionAmount, $this->bundleOptionPrice->getOptionSelectionAmount($selection));
102 $amountMock = $this->createMock(AmountInterface::class);
103 $this->bundleCalculatorMock->expects($this->once())
104 ->method(
'getOptionsAmount')
105 ->with($this->equalTo($this->saleableItemMock))
106 ->will($this->returnValue($amountMock));
107 $this->assertSame($amountMock, $this->bundleOptionPrice->getAmount());
118 $this->bundleOptionsMock->expects($this->any())->method(
'calculateOptions')->will($this->returnValue(
$value));
119 $this->assertEquals(
$value, $this->bundleOptionPrice->getValue());
testGetOptionSelectionAmount()