Skip to content

Commit 6ca60fc

Browse files
committed
Merge remote-tracking branch 'origin/MC-34231' into 2.4.0-develop-pr33
2 parents 078028e + 44444c3 commit 6ca60fc

File tree

22 files changed

+119
-165
lines changed

22 files changed

+119
-165
lines changed

app/code/Magento/Catalog/Model/Template/Filter.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
/**
1616
* Work with catalog(store, website) urls
17-
*
18-
* @package Magento\Catalog\Model\Template
1917
*/
2018
class Filter extends \Magento\Framework\Filter\Template
2119
{
@@ -30,6 +28,7 @@ class Filter extends \Magento\Framework\Filter\Template
3028
* Whether to allow SID in store directive: NO
3129
*
3230
* @var bool
31+
* @deprecated SID query parameter is not used in URLs anymore.
3332
*/
3433
protected $_useSessionInUrl = false;
3534

@@ -81,10 +80,14 @@ public function setUseAbsoluteLinks($flag)
8180
*
8281
* @param bool $flag
8382
* @return $this
83+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
84+
* @deprecated SID query parameter is not used in URLs anymore.
8485
*/
8586
public function setUseSessionInUrl($flag)
8687
{
87-
$this->_useSessionInUrl = $flag;
88+
// phpcs:disable Magento2.Functions.DiscouragedFunction
89+
trigger_error('Session ID is not used as URL parameter anymore.', E_USER_DEPRECATED);
90+
8891
return $this;
8992
}
9093

@@ -126,6 +129,7 @@ public function viewDirective($construction)
126129
*/
127130
public function mediaDirective($construction)
128131
{
132+
// phpcs:disable Magento2.Functions.DiscouragedFunction
129133
$params = $this->getParameters(html_entity_decode($construction[2], ENT_QUOTES));
130134
return $this->_storeManager->getStore()
131135
->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) . $params['url'];

app/code/Magento/Cms/Model/Template/Filter.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,6 @@
1010
*/
1111
class Filter extends \Magento\Email\Model\Template\Filter
1212
{
13-
/**
14-
* Whether to allow SID in store directive: AUTO
15-
*
16-
* @var bool
17-
*/
18-
protected $_useSessionInUrl;
19-
20-
/**
21-
* Setter whether SID is allowed in store directive
22-
*
23-
* @param bool $flag
24-
* @return $this
25-
*/
26-
public function setUseSessionInUrl($flag)
27-
{
28-
$this->_useSessionInUrl = (bool)$flag;
29-
return $this;
30-
}
31-
3213
/**
3314
* Retrieve media file URL directive
3415
*

app/code/Magento/Cms/Test/Unit/Model/Template/FilterTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ public function testMediaDirectiveRelativePath()
123123
public function testMediaDirectiveURL()
124124
{
125125
$this->expectException(\InvalidArgumentException::class);
126+
126127
$baseMediaDir = 'pub/media';
127128
$construction = [
128129
'{{media url="http://wysiwyg/images/image.jpg"}}',

app/code/Magento/Customer/Test/Unit/Model/Metadata/Form/ImageTest.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,14 @@ public function testValidate()
230230
'name' => 'logo.gif',
231231
];
232232

233+
$this->ioFileSystemMock->expects($this->any())
234+
->method('getPathInfo')
235+
->with($value['name'])
236+
->willReturn([
237+
'filename' => 'logo',
238+
'extension' => 'gif'
239+
]);
240+
233241
$this->attributeMetadataMock->expects($this->once())
234242
->method('getStoreLabel')
235243
->willReturn('File Input Field Label');
@@ -277,6 +285,14 @@ public function testValidateMaxFileSize()
277285
->method('getValue')
278286
->willReturn($maxFileSize);
279287

288+
$this->ioFileSystemMock->expects($this->any())
289+
->method('getPathInfo')
290+
->with($value['name'])
291+
->willReturn([
292+
'filename' => 'logo',
293+
'extension' => 'gif'
294+
]);
295+
280296
$this->attributeMetadataMock->expects($this->once())
281297
->method('getStoreLabel')
282298
->willReturn('File Input Field Label');
@@ -326,6 +342,14 @@ public function testValidateMaxImageWidth()
326342
->method('getValue')
327343
->willReturn($maxImageWidth);
328344

345+
$this->ioFileSystemMock->expects($this->any())
346+
->method('getPathInfo')
347+
->with($value['name'])
348+
->willReturn([
349+
'filename' => 'logo',
350+
'extension' => 'gif'
351+
]);
352+
329353
$this->attributeMetadataMock->expects($this->once())
330354
->method('getStoreLabel')
331355
->willReturn('File Input Field Label');
@@ -375,6 +399,14 @@ public function testValidateMaxImageHeight()
375399
->method('getValue')
376400
->willReturn($maxImageHeight);
377401

402+
$this->ioFileSystemMock->expects($this->any())
403+
->method('getPathInfo')
404+
->with($value['name'])
405+
->willReturn([
406+
'filename' => 'logo',
407+
'extension' => 'gif'
408+
]);
409+
378410
$this->attributeMetadataMock->expects($this->once())
379411
->method('getStoreLabel')
380412
->willReturn('File Input Field Label');

app/code/Magento/Email/Model/Template/Filter.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class Filter extends \Magento\Framework\Filter\Template
4545
* Whether to allow SID in store directive: NO
4646
*
4747
* @var bool
48+
* @deprecated SID is not being used as query parameter anymore.
4849
*/
4950
protected $_useSessionInUrl = false;
5051

@@ -264,10 +265,14 @@ public function setUseAbsoluteLinks($flag)
264265
*
265266
* @param bool $flag
266267
* @return $this
268+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
269+
* @deprecated SID query parameter is not used in URLs anymore.
267270
*/
268271
public function setUseSessionInUrl($flag)
269272
{
270-
$this->_useSessionInUrl = $flag;
273+
// phpcs:disable Magento2.Functions.DiscouragedFunction
274+
trigger_error('Session ID is not used as URL parameter anymore.', E_USER_DEPRECATED);
275+
271276
return $this;
272277
}
273278

app/code/Magento/Email/Test/Unit/Model/Template/FilterTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,10 @@ public function testProtocolDirectiveWithValidSchema()
479479
*/
480480
public function testProtocolDirectiveWithInvalidSchema()
481481
{
482-
$this->expectException(\Magento\Framework\Exception\MailException::class);
482+
$this->expectException(
483+
\Magento\Framework\Exception\MailException::class
484+
);
485+
483486
$model = $this->getModel();
484487
$storeMock = $this->createMock(\Magento\Store\Model\Store::class);
485488
$storeMock->expects($this->once())->method('isCurrentlySecure')->willReturn(true);

app/code/Magento/Store/Model/StoreSwitcher/CleanTargetUrl.php

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
/**
1616
* Remove SID, from_store, store from target url.
17+
*
18+
* Used in store-switching process in HTML frontend.
1719
*/
1820
class CleanTargetUrl implements StoreSwitcherInterface
1921
{
@@ -22,42 +24,27 @@ class CleanTargetUrl implements StoreSwitcherInterface
2224
*/
2325
private $urlHelper;
2426

25-
/**
26-
* @var \Magento\Framework\Session\Generic
27-
*/
28-
private $session;
29-
30-
/**
31-
* @var \Magento\Framework\Session\SidResolverInterface
32-
*/
33-
private $sidResolver;
34-
3527
/**
3628
* @param UrlHelper $urlHelper
37-
* @param \Magento\Framework\Session\Generic $session
38-
* @param \Magento\Framework\Session\SidResolverInterface $sidResolver
3929
*/
4030
public function __construct(
41-
UrlHelper $urlHelper,
42-
\Magento\Framework\Session\Generic $session,
43-
\Magento\Framework\Session\SidResolverInterface $sidResolver
31+
UrlHelper $urlHelper
4432
) {
4533
$this->urlHelper = $urlHelper;
46-
$this->session = $session;
47-
$this->sidResolver = $sidResolver;
4834
}
4935

5036
/**
37+
* Generate target URL to switch stores through other mechanism then via URL params.
38+
*
5139
* @param StoreInterface $fromStore store where we came from
5240
* @param StoreInterface $targetStore store where to go to
5341
* @param string $redirectUrl original url requested for redirect after switching
5442
* @return string redirect url
43+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
5544
*/
5645
public function switch(StoreInterface $fromStore, StoreInterface $targetStore, string $redirectUrl): string
5746
{
5847
$targetUrl = $redirectUrl;
59-
$sidName = $this->sidResolver->getSessionIdQueryParam($this->session);
60-
$targetUrl = $this->urlHelper->removeRequestParam($targetUrl, $sidName);
6148
$targetUrl = $this->urlHelper->removeRequestParam($targetUrl, '___from_store');
6249
$targetUrl = $this->urlHelper->removeRequestParam($targetUrl, StoreResolverInterface::PARAM_NAME);
6350

app/code/Magento/Theme/Test/Unit/Model/Design/Backend/ImageTest.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class ImageTest extends \PHPUnit\Framework\TestCase
3636
/**
3737
* @inheritdoc
3838
*/
39-
public function setUp() : void
39+
public function setUp(): void
4040
{
4141
$context = $this->getMockObject(Context::class);
4242
$registry = $this->getMockObject(Registry::class);
@@ -70,7 +70,7 @@ public function setUp() : void
7070
/**
7171
* @inheritdoc
7272
*/
73-
public function tearDown() : void
73+
public function tearDown(): void
7474
{
7575
unset($this->imageBackend);
7676
}
@@ -95,8 +95,12 @@ private function getMockObject(string $class, array $methods = []): \PHPUnit\Fra
9595
*/
9696
public function testBeforeSaveWithInvalidExtensionFile()
9797
{
98-
$this->expectException(\Magento\Framework\Exception\LocalizedException::class);
99-
$this->expectExceptionMessage('Something is wrong with the file upload settings.');
98+
$this->expectException(
99+
\Magento\Framework\Exception\LocalizedException::class
100+
);
101+
$this->expectExceptionMessage(
102+
'Something is wrong with the file upload settings.'
103+
);
100104

101105
$invalidFileName = 'fileName.invalidExtension';
102106
$this->imageBackend->setData(

dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Eav/AttributeTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use Magento\Eav\Api\AttributeRepositoryInterface;
99
use Magento\Eav\Api\Data\AttributeInterface;
1010
use Magento\Eav\Model\Config;
11-
use Magento\Framework\Exception\LocalizedException;
1211
use Magento\Framework\ObjectManagerInterface;
1312
use Magento\TestFramework\Helper\Bootstrap;
1413

@@ -72,7 +71,9 @@ public function testCRUD()
7271
*/
7372
public function testAttributeSaveWithChangedEntityType(): void
7473
{
75-
$this->expectException(LocalizedException::class);
74+
$this->expectException(
75+
\Magento\Framework\Exception\LocalizedException::class
76+
);
7677
$this->expectExceptionMessage('Do not change entity type.');
7778

7879
$attribute = $this->attributeRepository->get($this->catalogProductEntityType, 'test_attribute_code_333');

dev/tests/integration/testsuite/Magento/Customer/Model/AttributeTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class AttributeTest extends \PHPUnit\Framework\TestCase
4141
/**
4242
* @inheritDoc
4343
*/
44-
protected function setUp() : void
44+
protected function setUp(): void
4545
{
4646
$this->objectManager = Bootstrap::getObjectManager();
4747
$this->model = $this->objectManager->get(Attribute::class);
@@ -73,8 +73,11 @@ public function testCRUD(): void
7373
*/
7474
public function testAttributeSaveWithChangedEntityType(): void
7575
{
76-
$this->expectException(\Magento\Framework\Exception\LocalizedException::class);
76+
$this->expectException(
77+
\Magento\Framework\Exception\LocalizedException::class
78+
);
7779
$this->expectExceptionMessage('Do not change entity type.');
80+
7881
$attribute = $this->attributeRepository->get($this->customerEntityType, 'user_attribute');
7982
$attribute->setEntityTypeId(5);
8083
$attribute->save();

0 commit comments

Comments
 (0)