bundleOptionsMock = $this->createMock(BundleOptions::class); $this->saleableItemMock = $this->createMock(Product::class); $this->bundleCalculatorMock = $this->createMock(Calculator::class); $this->objectManagerHelper = new ObjectManagerHelper($this); $this->bundleOptionRegularPrice = $this->objectManagerHelper->getObject( BundleOptionRegularPrice::class, [ 'saleableItem' => $this->saleableItemMock, 'quantity' => 1., 'calculator' => $this->bundleCalculatorMock, 'bundleOptions' => $this->bundleOptionsMock, ] ); } /** * Test method \Magento\Bundle\Pricing\Price\BundleOptionRegularPrice::getOptions * * @return void */ public function testGetOptions() { $collection = $this->createMock(Collection::class); $this->bundleOptionsMock->expects($this->any()) ->method('getOptions') ->will($this->returnValue($collection)); $this->assertEquals($collection, $this->bundleOptionRegularPrice->getOptions()); } /** * Test method \Magento\Bundle\Pricing\Price\BundleOptionRegularPrice::getOptionSelectionAmount * * @return void */ public function testGetOptionSelectionAmount() { $selectionAmount = $this->createMock(AmountInterface::class); $product = $this->createMock(Product::class); $selection = $this->createMock(Selection::class); $this->bundleOptionsMock->expects($this->any()) ->method('getOptionSelectionAmount') ->will($this->returnValue($selectionAmount)) ->with($product, $selection, true); $this->assertEquals($selectionAmount, $this->bundleOptionRegularPrice->getOptionSelectionAmount($selection)); } /** * Test method \Magento\Bundle\Pricing\Price\BundleOptionRegularPrice::getAmount * * @return void */ public function testGetAmount() { $amountMock = $this->createMock(AmountInterface::class); $this->bundleCalculatorMock->expects($this->once()) ->method('getOptionsAmount') ->with($this->equalTo($this->saleableItemMock)) ->will($this->returnValue($amountMock)); $this->assertSame($amountMock, $this->bundleOptionRegularPrice->getAmount()); } /** * Test method \Magento\Bundle\Pricing\Price\BundleOptionRegularPrice::getValue * * @return void */ public function testGetValue() { $value = 1; $this->bundleOptionsMock->expects($this->any())->method('calculateOptions')->will($this->returnValue($value)); $this->assertEquals($value, $this->bundleOptionRegularPrice->getValue()); } }