Skip to content

Commit a039950

Browse files
author
Joan He
committed
MAGETWO-89091: CE edition - Update composer dependencies
- fix unit test failures
1 parent b12bcb7 commit a039950

File tree

22 files changed

+48
-37
lines changed

22 files changed

+48
-37
lines changed

app/code/Magento/Backend/Block/Widget/Grid/ColumnSet.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ public function getRowUrl($item)
258258
*/
259259
public function getMultipleRows($item)
260260
{
261-
return $item->getChildren();
261+
$children = $item->getChildren();
262+
return $children ?: [];
262263
}
263264

264265
/**

app/code/Magento/Bundle/Model/Product/Type.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ protected function _prepareProduct(\Magento\Framework\DataObject $buyRequest, $p
706706

707707
$selections = $this->mergeSelectionsWithOptions($options, $selections);
708708
}
709-
if (count($selections) > 0 || !$isStrictProcessMode) {
709+
if ((is_array($selections) && count($selections) > 0) || !$isStrictProcessMode) {
710710
$uniqueKey = [$product->getId()];
711711
$selectionIds = [];
712712
$qtys = $buyRequest->getBundleOptionQty();
@@ -1322,8 +1322,9 @@ protected function checkIsResult($_result)
13221322
protected function mergeSelectionsWithOptions($options, $selections)
13231323
{
13241324
foreach ($options as $option) {
1325-
if ($option->getRequired() && count($option->getSelections()) == 1) {
1326-
$selections = array_merge($selections, $option->getSelections());
1325+
$optionSelections = $option->getSelections();
1326+
if ($option->getRequired() && is_array($optionSelections) && count($optionSelections) == 1) {
1327+
$selections = array_merge($selections, $optionSelections);
13271328
} else {
13281329
$selections = [];
13291330
break;

app/code/Magento/Catalog/Model/Layer/Filter/DataProvider/Decimal.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function getRange(FilterInterface $filter)
5656
$index = 1;
5757
do {
5858
$range = pow(10, strlen(floor($maxValue)) - $index);
59-
$items = $this->getRangeItemCounts($range, $filter);
59+
$items = $this->getRangeItemCounts($range, $filter) ?: [];
6060
$index++;
6161
} while ($range > self::MIN_RANGE_POWER && count($items) < 2);
6262
$this->range = $range;
@@ -109,7 +109,7 @@ public function getMinValue(FilterInterface $filter)
109109
*
110110
* @param int $range
111111
* @param FilterInterface $filter
112-
* @return mixed
112+
* @return array
113113
*/
114114
public function getRangeItemCounts($range, FilterInterface $filter)
115115
{

app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function getDefaultStoreId()
7878
*/
7979
protected function _isApplicableAttribute($object, $attribute)
8080
{
81-
$applyTo = $attribute->getApplyTo();
81+
$applyTo = $attribute->getApplyTo() ?: [];
8282
return (count($applyTo) == 0 || in_array($object->getTypeId(), $applyTo))
8383
&& $attribute->isInSet($object->getAttributeSetId());
8484
}

app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/AbstractTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ protected function _getAttributes()
2525
foreach ($codes as $code) {
2626
$mock = $this->createPartialMock(
2727
\Magento\Eav\Model\Entity\Attribute\AbstractAttribute::class,
28-
['isInSet', 'getBackend', '__wakeup']
28+
['isInSet', 'getApplyTo', 'getBackend', '__wakeup']
2929
);
3030

3131
$mock->setAttributeId($code);

app/code/Magento/CatalogUrlRewrite/Model/ProductScopeRewriteGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public function generateForSpecificStoreView($storeId, $productCategories, Produ
208208
public function isCategoryProperForGenerating(Category $category, $storeId)
209209
{
210210
$parentIds = $category->getParentIds();
211-
if (count($parentIds) >= 2) {
211+
if (is_array($parentIds) && count($parentIds) >= 2) {
212212
$rootCategoryId = $parentIds[1];
213213
return $rootCategoryId == $this->storeManager->getStore($storeId)->getRootCategoryId();
214214
}

app/code/Magento/ImportExport/Test/Unit/Model/Import/SourceAbstractTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function testIteratorInterface()
5757
)->method(
5858
'_getNextRow'
5959
)->will(
60-
$this->onConsecutiveCalls([1, 2, 3], [4, 5, 5], [6, 7, 8])
60+
$this->onConsecutiveCalls([1, 2, 3], [4, 5, 5], [6, 7, 8], [])
6161
);
6262
$data = [];
6363
foreach ($this->_model as $key => $value) {

app/code/Magento/Quote/Test/Unit/Observer/Backend/CustomerQuoteObserverTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ public function testDispatch($isWebsiteScope, $websites)
160160
public function dispatchDataProvider()
161161
{
162162
return [
163-
[true, ['website1']],
164-
[true, ['website1', 'website2']],
163+
[true, [['website1']]],
164+
[true, [['website1'], ['website2']]],
165165
[false, ['website1']],
166166
[false, ['website1', 'website2']],
167167
];

app/code/Magento/Swatches/Helper/Data.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ private function addFallbackOptions(array $fallbackValues, array $swatches)
515515
*/
516516
public function isProductHasSwatch(Product $product)
517517
{
518-
$swatchAttributes = $this->getSwatchAttributes($product);
518+
$swatchAttributes = $this->getSwatchAttributes($product) ?: [];
519519
return count($swatchAttributes) > 0;
520520
}
521521

app/code/Magento/Weee/Model/Tax.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ public function getProductWeeeAttributes(
326326
$amountExclTax = $amountInclTax - $taxAmount;
327327
} else {
328328
$appliedRates = $this->_calculationFactory->create()->getAppliedRates($rateRequest);
329-
if (count($appliedRates) > 1) {
329+
if (is_array($appliedRates) && count($appliedRates) > 1) {
330330
$taxAmount = 0;
331331
foreach ($appliedRates as $appliedRate) {
332332
$taxRate = $appliedRate['percent'];

0 commit comments

Comments
 (0)