Skip to content

Commit 9f622ee

Browse files
committed
fix unit, static tests
1 parent b5c9757 commit 9f622ee

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -533,12 +533,13 @@ public function testAddChildCouldNotSave()
533533
$this->expectException(CouldNotSaveException::class);
534534

535535
$productLink = $this->getMockBuilder(LinkInterface::class)
536-
->setMethods(['getSku', 'getOptionId', 'getSelectionId'])
536+
->setMethods(['getSku', 'getOptionId', 'getSelectionId', 'getWebSiteId'])
537537
->disableOriginalConstructor()
538538
->getMockForAbstractClass();
539539
$productLink->method('getSku')->willReturn('linked_product_sku');
540540
$productLink->method('getOptionId')->willReturn(1);
541541
$productLink->method('getSelectionId')->willReturn(1);
542+
$productLink->method('getWebSiteId')->willReturn(100);
542543

543544
$this->metadataMock->expects($this->once())->method('getLinkField')->willReturn($this->linkField);
544545
$productMock = $this->createMock(Product::class);
@@ -610,12 +611,13 @@ static function () {
610611
public function testAddChild()
611612
{
612613
$productLink = $this->getMockBuilder(LinkInterface::class)
613-
->setMethods(['getSku', 'getOptionId', 'getSelectionId'])
614+
->setMethods(['getSku', 'getOptionId', 'getSelectionId', 'getWebSiteId'])
614615
->disableOriginalConstructor()
615616
->getMockForAbstractClass();
616617
$productLink->method('getSku')->willReturn('linked_product_sku');
617618
$productLink->method('getOptionId')->willReturn(1);
618619
$productLink->method('getSelectionId')->willReturn(1);
620+
$productLink->method('getWebSiteId')->willReturn(100);
619621

620622
$this->metadataMock->expects($this->once())->method('getLinkField')->willReturn($this->linkField);
621623
$productMock = $this->createMock(Product::class);
@@ -689,7 +691,7 @@ public function testSaveChild()
689691
$websiteId = 100;
690692

691693
$productLink = $this->getMockBuilder(LinkInterface::class)
692-
->setMethods(['getSku', 'getOptionId', 'getSelectionId'])
694+
->setMethods(['getSku', 'getOptionId', 'getSelectionId', 'getWebSiteId'])
693695
->disableOriginalConstructor()
694696
->getMockForAbstractClass();
695697
$productLink->method('getSku')->willReturn('linked_product_sku');
@@ -703,6 +705,7 @@ public function testSaveChild()
703705
->willReturn($canChangeQuantity);
704706
$productLink->method('getIsDefault')->willReturn($isDefault);
705707
$productLink->method('getSelectionId')->willReturn($optionId);
708+
$productLink->method('getWebSiteId')->willReturn($websiteId);
706709

707710
$this->metadataMock->expects($this->once())->method('getLinkField')->willReturn($this->linkField);
708711
$productMock = $this->createMock(Product::class);
@@ -741,7 +744,8 @@ public function testSaveChild()
741744
'setSelectionPriceType',
742745
'setSelectionPriceValue',
743746
'setSelectionCanChangeQty',
744-
'setIsDefault'
747+
'setIsDefault',
748+
'setWebsiteId'
745749
]
746750
)
747751
->onlyMethods(['save', 'getId', 'load'])
@@ -775,12 +779,14 @@ public function testSaveChildFailedToSave()
775779
$websiteId = 200;
776780

777781
$productLink = $this->getMockBuilder(LinkInterface::class)
778-
->setMethods(['getSku', 'getOptionId', 'getSelectionId'])
782+
->setMethods(['getSku', 'getOptionId', 'getSelectionId', 'getWebsiteId'])
779783
->disableOriginalConstructor()
780784
->getMockForAbstractClass();
781785
$productLink->method('getSku')->willReturn('linked_product_sku');
782786
$productLink->method('getId')->willReturn($id);
783787
$productLink->method('getSelectionId')->willReturn(1);
788+
$productLink->method('getWebsiteId')->willReturn($websiteId);
789+
784790
$bundleProductSku = 'bundleProductSku';
785791

786792
$productMock = $this->createMock(Product::class);

0 commit comments

Comments
 (0)