Skip to content

Commit 1565e5c

Browse files
committed
Merge remote-tracking branch 'anzin/fix-deprecation-integration-part-2' into ph-delivery
2 parents 582344c + 7cbc883 commit 1565e5c

File tree

17 files changed

+139
-112
lines changed

17 files changed

+139
-112
lines changed

app/code/Magento/Catalog/Helper/Product/View.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,21 @@ class View extends \Magento\Framework\App\Helper\AbstractHelper
2626
protected $messageGroups;
2727

2828
/**
29-
* Core registry
30-
*
3129
* @var \Magento\Framework\Registry
3230
*/
3331
protected $_coreRegistry = null;
3432

3533
/**
36-
* Catalog product
37-
*
3834
* @var \Magento\Catalog\Helper\Product
3935
*/
4036
protected $_catalogProduct = null;
4137

4238
/**
43-
* Catalog design
44-
*
4539
* @var \Magento\Catalog\Model\Design
4640
*/
4741
protected $_catalogDesign;
4842

4943
/**
50-
* Catalog session
51-
*
5244
* @var \Magento\Catalog\Model\Session
5345
*/
5446
protected $_catalogSession;
@@ -141,7 +133,9 @@ private function preparePageMetadata(ResultPage $resultPage, $product)
141133
if ($description) {
142134
$pageConfig->setDescription($description);
143135
} else {
144-
$pageConfig->setDescription($this->string->substr(strip_tags($product->getDescription()), 0, 255));
136+
$productDescription = is_string($product->getDescription()) ?
137+
$this->string->substr(strip_tags($product->getDescription()), 0, 255) : '';
138+
$pageConfig->setDescription($productDescription);
145139
}
146140

147141
if ($this->_catalogProduct->canUseCanonicalTag()) {

app/code/Magento/PageCache/Model/System/Config/Backend/Varnish.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ protected function _afterLoad()
5858
$currentValue = $this->getValue();
5959
if (!$currentValue) {
6060
foreach ($data as $field => $value) {
61-
if (strstr($this->getPath(), (string) $field)) {
61+
if (is_string($this->getPath()) && strstr($this->getPath(), (string) $field)) {
6262
$this->setValue($value);
6363
$this->save();
6464
break;

app/code/Magento/ReleaseNotification/Model/Condition/CanViewNotification.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
/**
1515
* Dynamic validator for UI release notification, manage UI component visibility.
1616
* Return true if the logged in user has not seen the notification.
17+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1718
*/
1819
class CanViewNotification implements VisibilityConditionInterface
1920
{
@@ -72,15 +73,14 @@ public function __construct(
7273
}
7374

7475
/**
75-
* Validate if notification popup can be shown and set the notification flag
76-
*
7776
* @inheritdoc
7877
*/
7978
public function isVisible(array $arguments)
8079
{
8180
$userId = $this->session->getUser()->getId();
8281
$cacheKey = self::$cachePrefix . $userId;
8382
$value = $this->cacheStorage->load($cacheKey);
83+
8484
if ($value === false) {
8585
$value = version_compare(
8686
$this->viewerLogger->get($userId)->getLastViewVersion(),

app/code/Magento/ReleaseNotification/Test/Unit/Model/Condition/CanViewNotificationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function isVisibleProvider()
122122
return [
123123
[false, '2.2.1-dev', '999.999.999-alpha'],
124124
[true, '2.2.1-dev', '2.0.0'],
125-
[true, '2.2.1-dev', null],
125+
[true, '2.2.1-dev', '2.2.0'],
126126
[false, '2.2.1-dev', '2.2.1'],
127127
[true, '2.2.1-dev', '2.2.0'],
128128
[true, '2.3.0', '2.2.0'],

app/code/Magento/Sales/Helper/Guest.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
class Guest extends \Magento\Framework\App\Helper\AbstractHelper
2121
{
2222
/**
23-
* Core registry
24-
*
2523
* @var \Magento\Framework\Registry
2624
*/
2725
protected $coreRegistry;
@@ -69,17 +67,17 @@ class Guest extends \Magento\Framework\App\Helper\AbstractHelper
6967
/**
7068
* Cookie key for guest view
7169
*/
72-
const COOKIE_NAME = 'guest-view';
70+
public const COOKIE_NAME = 'guest-view';
7371

7472
/**
7573
* Cookie path value
7674
*/
77-
const COOKIE_PATH = '/';
75+
public const COOKIE_PATH = '/';
7876

7977
/**
8078
* Cookie lifetime value
8179
*/
82-
const COOKIE_LIFETIME = 600;
80+
public const COOKIE_LIFETIME = 600;
8381

8482
/**
8583
* @var \Magento\Store\Model\StoreManagerInterface
@@ -227,11 +225,14 @@ private function setGuestViewCookie($cookieValue)
227225
*/
228226
private function loadFromCookie($fromCookie)
229227
{
228+
if (!is_string($fromCookie)) {
229+
throw new InputException(__($this->inputExceptionMessage));
230+
}
230231
// phpcs:ignore Magento2.Functions.DiscouragedFunction
231232
$cookieData = explode(':', base64_decode($fromCookie));
232-
$protectCode = isset($cookieData[0]) ? $cookieData[0] : null;
233-
$incrementId = isset($cookieData[1]) ? $cookieData[1] : null;
234-
if (!empty($protectCode) && !empty($incrementId)) {
233+
$protectCode = $cookieData[0] ?? null;
234+
$incrementId = $cookieData[1] ?? null;
235+
if ($protectCode && $incrementId) {
235236
$order = $this->getOrderRecord($incrementId);
236237
if (hash_equals((string)$order->getProtectCode(), $protectCode)) {
237238
$this->setGuestViewCookie($fromCookie);

dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/Massaction/AdditionalTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function testToHtml()
4141
$evaluatedValues
4242
);
4343

44+
$block->setNameInLayout('test_block_name');
4445
$html = $block->toHtml();
4546
$this->assertStringMatchesFormat(
4647
'%acustom_class absolute-advice%avalue="value1"%slabel 1%avalue="value2"%slabel 2%a',

dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/ViewTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ public function testInitProductLayout()
7777
$uniqid = uniqid();
7878
/** @var $product \Magento\Catalog\Model\Product */
7979
$product = $this->objectManager->create(\Magento\Catalog\Model\Product::class);
80-
$product->setTypeId(\Magento\Catalog\Model\Product\Type::DEFAULT_TYPE)->setId(99)->setUrlKey($uniqid);
80+
$product->setTypeId(\Magento\Catalog\Model\Product\Type::DEFAULT_TYPE)
81+
->setId(99)
82+
->setSku('test-sku')
83+
->setUrlKey($uniqid);
8184
/** @var $objectManager \Magento\TestFramework\ObjectManager */
8285
$objectManager = $this->objectManager;
8386
$objectManager->get(\Magento\Framework\Registry::class)->register('product', $product);

dev/tests/integration/testsuite/Magento/Framework/Image/Adapter/InterfaceTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,13 @@ protected function _getFixture($pattern)
115115
*/
116116
protected function _isFormatSupported($image, $adapter)
117117
{
118+
if ($image === null || !file_exists($image)) {
119+
return false;
120+
}
118121
$data = pathinfo($image);
119122
$supportedTypes = $adapter->getSupportedFormats();
120-
return $image && file_exists($image) && in_array(strtolower($data['extension']), $supportedTypes);
123+
124+
return isset($data['extension']) && in_array(strtolower($data['extension']), $supportedTypes);
121125
}
122126

123127
/**

dev/tests/integration/testsuite/Magento/Framework/Translate/InlineTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Framework\Translate;
78

89
class InlineTest extends \PHPUnit\Framework\TestCase
@@ -116,10 +117,6 @@ public function processResponseBodyDataProvider()
116117
$originalText = file_get_contents(__DIR__ . '/_files/_inline_page_original.html');
117118
$expectedText = file_get_contents(__DIR__ . '/_files/_inline_page_expected.html');
118119

119-
$package = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
120-
\Magento\Framework\View\DesignInterface::class
121-
)->getDesignTheme()->getPackageCode();
122-
$expectedText = str_replace('{{design_package}}', $package, $expectedText);
123120
return [
124121
'plain text' => ['text with no translations and tags', 'text with no translations and tags'],
125122
'html string' => [$originalText, $expectedText],

dev/tests/integration/testsuite/Magento/Integration/Block/Adminhtml/Integration/TokensTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public function testGetFormFields()
6868

6969
public function testToHtml()
7070
{
71+
$this->tokensBlock->setNameInLayout('test_block_name');
7172
$htmlContent = $this->tokensBlock->toHtml();
7273

7374
$this->assertStringContainsString('name="consumer_key"', $htmlContent);

0 commit comments

Comments
 (0)