10 use \Magento\Bundle\Model\OptionManagement;
41 $this->optionRepositoryMock =
42 $this->createMock(\
Magento\Bundle\Api\ProductOptionRepositoryInterface::class);
43 $this->productRepositoryMock =
44 $this->createMock(\
Magento\Catalog\Api\ProductRepositoryInterface::class);
45 $this->optionMock = $this->createMock(\
Magento\Bundle\Api\Data\OptionInterface::class);
46 $this->productMock = $this->createMock(\
Magento\Catalog\Api\Data\ProductInterface::class);
48 $this->model =
new OptionManagement($this->optionRepositoryMock, $this->productRepositoryMock);
53 $this->optionMock->expects($this->once())->method(
'getSku')->willReturn(
'bundle_product_sku');
54 $this->productRepositoryMock->expects($this->once())
56 ->with(
'bundle_product_sku')
57 ->willReturn($this->productMock);
58 $this->productMock->expects($this->once())
61 $this->optionRepositoryMock->expects($this->once())
63 ->with($this->productMock, $this->optionMock);
65 $this->model->save($this->optionMock);
74 $this->optionMock->expects($this->once())->method(
'getSku')->willReturn(
'bundle_product_sku');
75 $this->productRepositoryMock->expects($this->once())
77 ->with(
'bundle_product_sku')
78 ->willReturn($this->productMock);
79 $this->productMock->expects($this->once())
82 $this->optionRepositoryMock->expects($this->never())->method(
'save');
84 $this->model->save($this->optionMock);