Skip to content

Commit 659beb2

Browse files
committed
Fixes for failed static tests in Bundle module.
1 parent 49c261e commit 659beb2

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

app/code/Magento/Bundle/Model/LinkManagement.php

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ class LinkManagement implements \Magento\Bundle\Api\ProductLinkManagementInterfa
5454
*/
5555
private $metadataPool;
5656

57+
/**
58+
* @var \Magento\Store\Model\StoreManagerInterface
59+
*/
60+
private $storeManager;
61+
5762
/**
5863
* @param ProductRepositoryInterface $productRepository
5964
* @param \Magento\Bundle\Api\Data\LinkInterfaceFactory $linkFactory
@@ -82,7 +87,7 @@ public function __construct(
8287
}
8388

8489
/**
85-
* {@inheritdoc}
90+
* @inheritdoc
8691
*/
8792
public function getChildren($productSku, $optionId = null)
8893
{
@@ -105,7 +110,7 @@ public function getChildren($productSku, $optionId = null)
105110
}
106111

107112
/**
108-
* {@inheritdoc}
113+
* @inheritdoc
109114
*/
110115
public function addChildByProductSku($sku, $optionId, \Magento\Bundle\Api\Data\LinkInterface $linkedProduct)
111116
{
@@ -115,7 +120,8 @@ public function addChildByProductSku($sku, $optionId, \Magento\Bundle\Api\Data\L
115120
}
116121

117122
/**
118-
* {@inheritdoc}
123+
* @inheritdoc
124+
*
119125
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
120126
* @SuppressWarnings(PHPMD.NPathComplexity)
121127
*/
@@ -169,6 +175,8 @@ public function saveChild(
169175
}
170176

171177
/**
178+
* Map data from the product link object to the new selection model
179+
*
172180
* @param \Magento\Bundle\Model\Selection $selectionModel
173181
* @param \Magento\Bundle\Api\Data\LinkInterface $productLink
174182
* @param string $linkedProductId
@@ -217,7 +225,8 @@ protected function mapProductLinkToSelectionModel(
217225
}
218226

219227
/**
220-
* {@inheritdoc}
228+
* @inheritdoc
229+
*
221230
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
222231
*/
223232
public function addChild(
@@ -297,7 +306,7 @@ public function addChild(
297306
}
298307

299308
/**
300-
* {@inheritdoc}
309+
* @inheritdoc
301310
*/
302311
public function removeChild($sku, $optionId, $childSku)
303312
{
@@ -336,6 +345,8 @@ public function removeChild($sku, $optionId, $childSku)
336345
}
337346

338347
/**
348+
* Build new Link object from the product and selection
349+
*
339350
* @param \Magento\Catalog\Model\Product $selection
340351
* @param \Magento\Catalog\Model\Product $product
341352
* @return \Magento\Bundle\Api\Data\LinkInterface
@@ -367,6 +378,8 @@ private function buildLink(\Magento\Catalog\Model\Product $selection, \Magento\C
367378
}
368379

369380
/**
381+
* Retrieve bundle options with selections
382+
*
370383
* @param \Magento\Catalog\Api\Data\ProductInterface $product
371384
* @return \Magento\Bundle\Api\Data\OptionInterface[]
372385
*/
@@ -392,6 +405,7 @@ private function getOptions(\Magento\Catalog\Api\Data\ProductInterface $product)
392405

393406
/**
394407
* Get MetadataPool instance
408+
*
395409
* @return MetadataPool
396410
*/
397411
private function getMetadataPool()

app/code/Magento/Bundle/Model/Option/SaveAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function save(ProductInterface $bundleProduct, OptionInterface $option)
102102
}
103103
} else {
104104
if (!$existingOption->getOptionId()) {
105-
throw new NoSuchEntityException(
105+
throw new \Magento\Framework\Exception\NoSuchEntityException(
106106
__("The option that was requested doesn't exist. Verify the entity and try again.")
107107
);
108108
}

app/code/Magento/Bundle/Model/Selection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,6 @@ public function afterSave()
105105
$this->unsSelectionPriceType();
106106
}
107107
}
108-
parent::afterSave();
108+
return parent::afterSave();
109109
}
110110
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1212

1313
/**
14-
* Class LinkManagementTest
14+
* Unit Test for Link Management Model
1515
*
1616
* @SuppressWarnings(PHPMD.TooManyFields)
1717
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -121,7 +121,7 @@ protected function setUp()
121121
->setMethods(['get'])
122122
->disableOriginalConstructor()
123123
->getMock();
124-
$this->productType = $this->getMockBuilder(\Magento\Bundle\Model\Product\Type\Interceptor::class)
124+
$this->productType = $this->getMockBuilder(\Magento\Bundle\Model\Product\Type::class)
125125
->setMethods(['getOptionsCollection', 'setStoreFilter', 'getSelectionsCollection', 'getOptionsIds'])
126126
->disableOriginalConstructor()
127127
->getMock();

0 commit comments

Comments
 (0)