Skip to content

Commit 975c0c1

Browse files
#12584: Bundle Item price cannot differ per website.
1 parent ac37ae1 commit 975c0c1

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

app/code/Magento/Bundle/Test/Unit/Model/LinkManagementTest.php

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -542,15 +542,12 @@ public function testAddChildCouldNotSave()
542542
$this->expectException(CouldNotSaveException::class);
543543

544544
$productLink = $this->getMockBuilder(LinkInterface::class)
545-
->setMethods(['getSku', 'getOptionId', 'getSelectionId', 'getWebSiteId'])
545+
->setMethods(['getSku', 'getOptionId', 'getSelectionId'])
546546
->disableOriginalConstructor()
547547
->getMockForAbstractClass();
548548
$productLink->method('getSku')->willReturn('linked_product_sku');
549549
$productLink->method('getOptionId')->willReturn(1);
550550
$productLink->method('getSelectionId')->willReturn(1);
551-
$store = $this->createMock(Store::class);
552-
$this->storeManagerMock->expects($this->once())->method('getStore')->willReturn($store);
553-
$store->expects($this->once())->method('getWebsiteId')->willReturn(100);
554551

555552
$this->metadataMock->expects($this->once())->method('getLinkField')->willReturn($this->linkField);
556553
$productMock = $this->createMock(Product::class);
@@ -622,15 +619,12 @@ static function () {
622619
public function testAddChild()
623620
{
624621
$productLink = $this->getMockBuilder(LinkInterface::class)
625-
->setMethods(['getSku', 'getOptionId', 'getSelectionId', 'getWebSiteId'])
622+
->setMethods(['getSku', 'getOptionId', 'getSelectionId'])
626623
->disableOriginalConstructor()
627624
->getMockForAbstractClass();
628625
$productLink->method('getSku')->willReturn('linked_product_sku');
629626
$productLink->method('getOptionId')->willReturn(1);
630627
$productLink->method('getSelectionId')->willReturn(1);
631-
$store = $this->createMock(Store::class);
632-
$this->storeManagerMock->expects($this->once())->method('getStore')->willReturn($store);
633-
$store->expects($this->once())->method('getWebsiteId')->willReturn(100);
634628

635629
$this->metadataMock->expects($this->once())->method('getLinkField')->willReturn($this->linkField);
636630
$productMock = $this->createMock(Product::class);
@@ -701,10 +695,9 @@ public function testSaveChild()
701695
$linkProductId = 45;
702696
$parentProductId = 32;
703697
$bundleProductSku = 'bundleProductSku';
704-
$websiteId = 100;
705698

706699
$productLink = $this->getMockBuilder(LinkInterface::class)
707-
->setMethods(['getSku', 'getOptionId', 'getSelectionId', 'getWebSiteId'])
700+
->setMethods(['getSku', 'getOptionId', 'getSelectionId'])
708701
->disableOriginalConstructor()
709702
->getMockForAbstractClass();
710703
$productLink->method('getSku')->willReturn('linked_product_sku');
@@ -718,9 +711,6 @@ public function testSaveChild()
718711
->willReturn($canChangeQuantity);
719712
$productLink->method('getIsDefault')->willReturn($isDefault);
720713
$productLink->method('getSelectionId')->willReturn($optionId);
721-
$store = $this->createMock(Store::class);
722-
$this->storeManagerMock->expects($this->once())->method('getStore')->willReturn($store);
723-
$store->expects($this->once())->method('getWebsiteId')->willReturn($websiteId);
724714

725715
$this->metadataMock->expects($this->once())->method('getLinkField')->willReturn($this->linkField);
726716
$productMock = $this->createMock(Product::class);
@@ -760,7 +750,6 @@ public function testSaveChild()
760750
'setSelectionPriceValue',
761751
'setSelectionCanChangeQty',
762752
'setIsDefault',
763-
'setWebsiteId'
764753
]
765754
)
766755
->onlyMethods(['save', 'getId', 'load'])
@@ -778,7 +767,6 @@ public function testSaveChild()
778767
$selection->expects($this->once())->method('setSelectionPriceValue')->with($price);
779768
$selection->expects($this->once())->method('setSelectionCanChangeQty')->with($canChangeQuantity);
780769
$selection->expects($this->once())->method('setIsDefault')->with($isDefault);
781-
$selection->expects($this->once())->method('setWebsiteId')->with($websiteId);
782770

783771
$this->bundleSelectionMock->expects($this->once())->method('create')->willReturn($selection);
784772
$this->assertTrue($this->model->saveChild($bundleProductSku, $productLink));
@@ -791,18 +779,14 @@ public function testSaveChildFailedToSave()
791779
$id = 12;
792780
$linkProductId = 45;
793781
$parentProductId = 32;
794-
$websiteId = 200;
795782

796783
$productLink = $this->getMockBuilder(LinkInterface::class)
797-
->setMethods(['getSku', 'getOptionId', 'getSelectionId', 'getWebsiteId'])
784+
->setMethods(['getSku', 'getOptionId', 'getSelectionId'])
798785
->disableOriginalConstructor()
799786
->getMockForAbstractClass();
800787
$productLink->method('getSku')->willReturn('linked_product_sku');
801788
$productLink->method('getId')->willReturn($id);
802789
$productLink->method('getSelectionId')->willReturn(1);
803-
$store = $this->createMock(Store::class);
804-
$this->storeManagerMock->expects($this->once())->method('getStore')->willReturn($store);
805-
$store->expects($this->once())->method('getWebsiteId')->willReturn($websiteId);
806790

807791
$bundleProductSku = 'bundleProductSku';
808792
$this->metadataMock->expects($this->once())->method('getLinkField')->willReturn($this->linkField);

0 commit comments

Comments
 (0)