Skip to content

Commit 33f253d

Browse files
committed
CE#34569: Fix failed tests
1 parent 310cad9 commit 33f253d

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

app/code/Magento/Catalog/Model/Product/Option/Type/Date.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,9 @@ public function prepareOptionValueForRequest($optionValue)
306306
try {
307307
$value = $this->serializer->unserialize($infoBuyRequest->getValue());
308308

309-
if (
310-
is_array($value) && isset($value['options']) && isset($value['options'][$this->getOption()->getId()])
309+
if (is_array($value)
310+
&& isset($value['options'])
311+
&& isset($value['options'][$this->getOption()->getId()])
311312
) {
312313
return $value['options'][$this->getOption()->getId()];
313314
} else {

app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/CatalogEavValidationRulesTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ public function testBuild($frontendInput, $frontendClass, array $eavConfig, arra
5050
$attribute->expects($this->once())
5151
->method('getFrontendInput')
5252
->willReturn($frontendInput);
53-
$attribute->expects($this->once())
54-
->method('getFrontendClass')
53+
$attribute->method('getFrontendClass')
5554
->willReturn($frontendClass);
5655

5756
$this->assertEquals($expectedResult, $this->catalogEavValidationRules->build($attribute, $eavConfig));

app/code/Magento/Catalog/Ui/DataProvider/CatalogEavValidationRules.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ public function build(ProductAttributeInterface $attribute, array $data)
3939

4040
foreach ($validationClasses as $class) {
4141
if (preg_match('/^maximum-length-(\d+)$/', $class, $matches)) {
42+
// phpcs:ignore Magento2.Performance.ForeachArrayMerge
4243
$rules = array_merge($rules, ['max_text_length' => $matches[1]]);
4344
continue;
4445
}
4546
if (preg_match('/^minimum-length-(\d+)$/', $class, $matches)) {
47+
// phpcs:ignore Magento2.Performance.ForeachArrayMerge
4648
$rules = array_merge($rules, ['min_text_length' => $matches[1]]);
4749
continue;
4850
}

app/code/Magento/CatalogImportExport/Model/Import/Product/Option.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1279,8 +1279,9 @@ protected function _importData()
12791279
$multiRowData = $this->_getMultiRowFormat($rowData);
12801280
if (!empty($rowData[self::COLUMN_SKU]) && isset($this->_productsSkuToId[$rowData[self::COLUMN_SKU]])) {
12811281
$this->_rowProductId = $this->_productsSkuToId[$rowData[self::COLUMN_SKU]];
1282-
if (isset($rowData['custom_options'])
1282+
if (array_key_exists('custom_options', $rowData)
12831283
&& (
1284+
$rowData['custom_options'] === null ||
12841285
trim($rowData['custom_options']) === '' ||
12851286
trim($rowData['custom_options']) === $this->_productEntity->getEmptyAttributeValueConstant()
12861287
)

app/code/Magento/Tax/Model/Calculation/RateRepository.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ public function __construct(
110110
$this->resourceModel = $rateResource;
111111
$this->joinProcessor = $joinProcessor;
112112
$this->collectionProcessor = $collectionProcessor
113-
?? ObjectManager::getInstance()->get(TaxRateCollectionProcessor::class);
113+
?? ObjectManager::getInstance()->get(
114+
// phpcs:ignore Magento2.PHP.LiteralNamespaces
115+
'Magento\Tax\Model\Api\SearchCriteria\TaxRateCollectionProcessor'
116+
);
114117
}
115118

116119
/**
@@ -238,10 +241,8 @@ private function validate(TaxRateInterface $taxRate)
238241
$exception = new InputException();
239242

240243
$countryCode = $taxRate->getTaxCountryId();
241-
/** @phpstan-ignore-next-line */
242244
if (!\Zend_Validate::is($countryCode, 'NotEmpty')) {
243245
$exception->addError(__('"%fieldName" is required. Enter and try again.', ['fieldName' => 'country_id']));
244-
/** @phpstan-ignore-next-line */
245246
} elseif (!\Zend_Validate::is(
246247
$this->countryFactory->create()->loadByCode($countryCode)->getId(),
247248
'NotEmpty'
@@ -257,11 +258,9 @@ private function validate(TaxRateInterface $taxRate)
257258

258259
$regionCode = $taxRate->getTaxRegionId();
259260
// if regionCode eq 0 (all regions *), do not validate with existing region list
260-
/** @phpstan-ignore-next-line */
261261
if (\Zend_Validate::is($regionCode, 'NotEmpty')
262262
&& $regionCode != "0"
263-
/** @phpstan-ignore-next-line */
264-
&& !\Zend_Validate::is($this->regionFactory->create()->load($regionCode)->getId(),'NotEmpty')
263+
&& !\Zend_Validate::is($this->regionFactory->create()->load($regionCode)->getId(), 'NotEmpty')
265264
) {
266265
$exception->addError(__(
267266
'Invalid value of "%value" provided for the %fieldName field.',
@@ -279,7 +278,6 @@ private function validate(TaxRateInterface $taxRate)
279278
}
280279

281280
if ($taxRate->getCode() === null
282-
/** @phpstan-ignore-next-line */
283281
|| !\Zend_Validate::is(trim($taxRate->getCode()), 'NotEmpty')
284282
) {
285283
$exception->addError(__('"%fieldName" is required. Enter and try again.', ['fieldName' => 'code']));
@@ -305,7 +303,6 @@ private function validate(TaxRateInterface $taxRate)
305303
}
306304
} else {
307305
if ($taxRate->getTaxPostcode() === null
308-
/** @phpstan-ignore-next-line */
309306
|| !\Zend_Validate::is(trim($taxRate->getTaxPostcode()), 'NotEmpty')
310307
) {
311308
$exception->addError(

0 commit comments

Comments
 (0)