Skip to content

Commit dedc55d

Browse files
karyna-txmav
authored andcommitted
34441: CR fixes
1 parent 5f1809f commit dedc55d

File tree

11 files changed

+33
-46
lines changed

11 files changed

+33
-46
lines changed

app/code/Magento/CatalogImportExport/Model/Import/Product/Validator/Quantity.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,15 @@ public function isValid($value)
1818
if (!empty($value['qty']) && (!is_numeric($value['qty'])
1919
&& $value['qty'] !== $this->context->getEmptyAttributeValueConstant())
2020
) {
21-
if ($this->context->retrieveMessageTemplate(self::ERROR_INVALID_ATTRIBUTE_TYPE) !== null) {
22-
$this->_addMessages(
23-
[
24-
sprintf(
25-
$this->context->retrieveMessageTemplate(self::ERROR_INVALID_ATTRIBUTE_TYPE),
26-
'qty',
27-
'decimal'
28-
),
29-
]
30-
);
31-
}
21+
$this->_addMessages(
22+
[
23+
sprintf(
24+
$this->context->retrieveMessageTemplate(self::ERROR_INVALID_ATTRIBUTE_TYPE),
25+
'qty',
26+
'decimal'
27+
),
28+
]
29+
);
3230
return false;
3331
}
3432
return true;

app/code/Magento/CatalogImportExport/Model/Import/Product/Validator/Weight.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,15 @@ public function isValid($value)
1818
if (!empty($value['weight']) && (!is_numeric($value['weight']) || $value['weight'] < 0)
1919
&& $value['weight'] !== $this->context->getEmptyAttributeValueConstant()
2020
) {
21-
if ($this->context->retrieveMessageTemplate(self::ERROR_INVALID_ATTRIBUTE_TYPE) !== null) {
22-
$this->_addMessages(
23-
[
24-
sprintf(
25-
$this->context->retrieveMessageTemplate(self::ERROR_INVALID_ATTRIBUTE_TYPE),
26-
'weight',
27-
'decimal'
28-
)
29-
]
30-
);
31-
}
21+
$this->_addMessages(
22+
[
23+
sprintf(
24+
$this->context->retrieveMessageTemplate(self::ERROR_INVALID_ATTRIBUTE_TYPE),
25+
'weight',
26+
'decimal'
27+
)
28+
]
29+
);
3230
return false;
3331
}
3432
return true;

app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Validator/QuantityTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ protected function setUp(): void
3030
->method('getEmptyAttributeValueConstant')
3131
->willReturn(Import::DEFAULT_EMPTY_ATTRIBUTE_VALUE_CONSTANT);
3232

33-
$contextStub->method('retrieveMessageTemplate')->willReturn(null);
33+
$contextStub->method('retrieveMessageTemplate')->willReturn('some template');
3434
$this->quantity->init($contextStub);
3535
}
3636

app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Validator/WeightTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ protected function setUp(): void
3030
->method('getEmptyAttributeValueConstant')
3131
->willReturn(Import::DEFAULT_EMPTY_ATTRIBUTE_VALUE_CONSTANT);
3232

33-
$contextStub->method('retrieveMessageTemplate')->willReturn(null);
33+
$contextStub->method('retrieveMessageTemplate')->willReturn('some template');
3434
$this->weight->init($contextStub);
3535
}
3636

app/code/Magento/Checkout/Model/DefaultConfigProvider.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class DefaultConfigProvider implements ConfigProviderInterface
9797
private $configurationPool;
9898

9999
/**
100-
* @param QuoteIdMaskFactory
100+
* @var QuoteIdMaskFactory
101101
*/
102102
protected $quoteIdMaskFactory;
103103

@@ -338,17 +338,17 @@ public function getConfig()
338338
$output['imageData'] = $this->imageProvider->getImages($quoteId);
339339

340340
$output['totalsData'] = $this->getTotalsData();
341+
342+
$policyContent = $this->scopeConfig->getValue(
343+
'shipping/shipping_policy/shipping_policy_content',
344+
ScopeInterface::SCOPE_STORE
345+
);
341346
$output['shippingPolicy'] = [
342347
'isEnabled' => $this->scopeConfig->isSetFlag(
343348
'shipping/shipping_policy/enable_shipping_policy',
344349
ScopeInterface::SCOPE_STORE
345350
),
346-
'shippingPolicyContent' => nl2br(
347-
$this->scopeConfig->getValue(
348-
'shipping/shipping_policy/shipping_policy_content',
349-
ScopeInterface::SCOPE_STORE
350-
)
351-
)
351+
'shippingPolicyContent' => $policyContent ? nl2br($policyContent) : ''
352352
];
353353
$output['useQty'] = $this->scopeConfig->isSetFlag(
354354
'checkout/cart_link/use_qty',

app/code/Magento/Checkout/Test/Unit/Model/DefaultConfigProviderTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
use Magento\Quote\Model\Quote\Address;
4040
use Magento\Quote\Model\QuoteIdMaskFactory;
4141
use Magento\Shipping\Model\Config;
42-
use Magento\Store\Model\ScopeInterface;
4342
use Magento\Store\Model\Store;
4443
use Magento\Store\Model\StoreManagerInterface;
4544
use PHPUnit\Framework\MockObject\MockObject;
@@ -123,13 +122,6 @@ protected function setUp(): void
123122
$this->addressMetadata = $this->createMock(AddressMetadataInterface::class);
124123
$attributeOptionManager = $this->createMock(AttributeOptionManagementInterface::class);
125124
$customerAddressData = $this->createMock(CustomerAddressDataProvider::class);
126-
127-
// PHP 8.1 compatibility; The real code returns '', not null.
128-
$scopeConfig->method('getValue')
129-
->withConsecutive(
130-
['shipping/shipping_policy/shipping_policy_content', ScopeInterface::SCOPE_STORE]
131-
)->willReturn('');
132-
133125
$this->model = new DefaultConfigProvider(
134126
$checkoutHelper,
135127
$this->checkoutSession,

app/code/Magento/Cms/Test/Unit/Model/Wysiwyg/ConfigTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ public function testGetConfig($data, $isAuthorizationAllowed, $expectedResults)
183183
{
184184
$this->backendUrlMock->expects($this->atLeastOnce())
185185
->method('getUrl')
186+
->with('cms/wysiwyg/directive')
186187
->willReturn('some_link');
187188
$this->backendUrlMock->expects($this->once())
188189
->method('getBaseUrl')

app/code/Magento/Config/Test/Unit/Block/System/Config/Form/Field/Select/AllowspecificTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ public function testGetAfterElementHtml()
8787
$afterHtmlCode = 'after html';
8888
$this->_object->setData('after_element_html', $afterHtmlCode);
8989
$this->_object->setForm($this->_formMock);
90-
$this->_object->setId('test');
91-
$this->_object->setData('html_id', 'spec_element');
90+
$this->_object->setId('spec_element');
9291

9392
$actual = $this->_object->getAfterElementHtml();
9493

app/code/Magento/Contact/Test/Unit/Controller/Index/PostTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use Magento\Framework\App\Action\Context;
1414
use Magento\Framework\App\Request\DataPersistorInterface;
1515
use Magento\Framework\App\Request\Http;
16-
use Magento\Framework\App\Request\HttpRequest;
1716
use Magento\Framework\App\ResponseInterface;
1817
use Magento\Framework\Controller\Result\Redirect;
1918
use Magento\Framework\Controller\Result\RedirectFactory;
@@ -50,7 +49,7 @@ class PostTest extends TestCase
5049
private $urlMock;
5150

5251
/**
53-
* @var HttpRequest|MockObject
52+
* @var Http|MockObject
5453
*/
5554
private $requestStub;
5655

lib/internal/Magento/Framework/Code/Generator/ClassGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public function getNamespaceName()
228228
{
229229
$namespaceName = parent::getNamespaceName();
230230
if ($namespaceName !== null) {
231-
$namespaceName = ltrim(parent::getNamespaceName(), '\\') ?: null;
231+
$namespaceName = ltrim($namespaceName, '\\') ?: null;
232232
}
233233
return $namespaceName;
234234
}

0 commit comments

Comments
 (0)