Skip to content

Commit 16497a0

Browse files
MC-29566: [2.4.x] Deprecate SID query parameter-related methods
1 parent 51b5080 commit 16497a0

File tree

7 files changed

+59
-16
lines changed

7 files changed

+59
-16
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,11 @@ public function testMediaDirectiveRelativePath()
119119
* Test using media directive with a URL path including schema.
120120
*
121121
* @covers \Magento\Cms\Model\Template\Filter::mediaDirective
122-
* @expectedException \InvalidArgumentException
123122
*/
124123
public function testMediaDirectiveURL()
125124
{
125+
$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');
@@ -272,6 +280,14 @@ public function testValidateMaxFileSize()
272280
->method('getValue')
273281
->willReturn($maxFileSize);
274282

283+
$this->ioFileSystemMock->expects($this->any())
284+
->method('getPathInfo')
285+
->with($value['name'])
286+
->willReturn([
287+
'filename' => 'logo',
288+
'extension' => 'gif'
289+
]);
290+
275291
$this->attributeMetadataMock->expects($this->once())
276292
->method('getStoreLabel')
277293
->willReturn('File Input Field Label');
@@ -316,6 +332,14 @@ public function testValidateMaxImageWidth()
316332
->method('getValue')
317333
->willReturn($maxImageWidth);
318334

335+
$this->ioFileSystemMock->expects($this->any())
336+
->method('getPathInfo')
337+
->with($value['name'])
338+
->willReturn([
339+
'filename' => 'logo',
340+
'extension' => 'gif'
341+
]);
342+
319343
$this->attributeMetadataMock->expects($this->once())
320344
->method('getStoreLabel')
321345
->willReturn('File Input Field Label');
@@ -360,6 +384,14 @@ public function testValidateMaxImageHeight()
360384
->method('getValue')
361385
->willReturn($maxImageHeight);
362386

387+
$this->ioFileSystemMock->expects($this->any())
388+
->method('getPathInfo')
389+
->with($value['name'])
390+
->willReturn([
391+
'filename' => 'logo',
392+
'extension' => 'gif'
393+
]);
394+
363395
$this->attributeMetadataMock->expects($this->once())
364396
->method('getStoreLabel')
365397
->willReturn('File Input Field Label');

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,11 +475,14 @@ public function testProtocolDirectiveWithValidSchema()
475475
}
476476

477477
/**
478-
* @expectedException \Magento\Framework\Exception\MailException
479478
* @throws NoSuchEntityException
480479
*/
481480
public function testProtocolDirectiveWithInvalidSchema()
482481
{
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/Newsletter/Test/Unit/Block/Adminhtml/Queue/PreviewTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -178,17 +178,17 @@ public function testToHtmlWithId()
178178
);
179179
$this->queueMock->expects($this->once())
180180
->method('load')->willReturnSelf();
181-
$this->queue->expects($this->once())->method('getTemplateId')->willReturn($templateId);
182-
$this->queue->expects($this->once())->method('getNewsletterType')->willReturn($newsletterType);
183-
$this->queue->expects($this->once())->method('getNewsletterText')->willReturn($newsletterText);
184-
$this->queue->expects($this->once())->method('getNewsletterStyles')->willReturn($newsletterStyle);
181+
$this->queueMock->expects($this->once())->method('getTemplateId')->willReturn($templateId);
182+
$this->queueMock->expects($this->once())->method('getNewsletterType')->willReturn($newsletterType);
183+
$this->queueMock->expects($this->once())->method('getNewsletterText')->willReturn($newsletterText);
184+
$this->queueMock->expects($this->once())->method('getNewsletterStyles')->willReturn($newsletterStyle);
185185
$this->templateMock->expects($this->any())
186186
->method('isPlain')
187187
->willReturn(true);
188-
$this->template->expects($this->once())->method('setId')->willReturn($templateId);
189-
$this->template->expects($this->once())->method('setTemplateType')->willReturn($newsletterType);
190-
$this->template->expects($this->once())->method('setTemplateText')->willReturn($newsletterText);
191-
$this->template->expects($this->once())->method('setTemplateStyles')->willReturn($newsletterStyle);
188+
$this->templateMock->expects($this->once())->method('setId')->willReturn($templateId);
189+
$this->templateMock->expects($this->once())->method('setTemplateType')->willReturn($newsletterType);
190+
$this->templateMock->expects($this->once())->method('setTemplateText')->willReturn($newsletterText);
191+
$this->templateMock->expects($this->once())->method('setTemplateStyles')->willReturn($newsletterStyle);
192192
/** @var Store $store */
193193
$this->storeManagerMock->expects($this->once())
194194
->method('getDefaultStoreView')

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,16 @@ private function getMockObject(string $class, array $methods = []): \PHPUnit\Fra
9292

9393
/**
9494
* Test for beforeSave method with invalid file extension.
95-
*
96-
* @expectedException \Magento\Framework\Exception\LocalizedException
97-
* @expectedExceptionMessage Something is wrong with the file upload settings.
9895
*/
9996
public function testBeforeSaveWithInvalidExtensionFile()
10097
{
98+
$this->expectException(
99+
\Magento\Framework\Exception\LocalizedException::class
100+
);
101+
$this->expectExceptionMessage(
102+
'Something is wrong with the file upload settings.'
103+
);
104+
101105
$invalidFileName = 'fileName.invalidExtension';
102106
$this->imageBackend->setData(
103107
[

lib/internal/Magento/Framework/Image/Test/Unit/Adapter/Gd2Test.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ public function filesProvider()
122122

123123
/**
124124
* Test if open() method resets cached fileType
125-
*
126125
*/
127126
public function testOpenDifferentTypes()
128127
{
@@ -156,10 +155,12 @@ public function testOpenDifferentTypes()
156155
}
157156

158157
/**
159-
* @expectedException \InvalidArgumentException
158+
* Test open() with invalid URL.
160159
*/
161160
public function testOpenInvalidURL()
162161
{
162+
$this->expectException(\InvalidArgumentException::class);
163+
163164
$this->adapter->open('bar://foo.bar');
164165
}
165166
}

lib/internal/Magento/Framework/Image/Test/Unit/Adapter/ImageMagickTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,12 @@ public function testSaveWithException()
101101
}
102102

103103
/**
104-
* @expectedException \InvalidArgumentException
104+
* Test open() with invalid URL.
105105
*/
106106
public function testOpenInvalidUrl()
107107
{
108+
$this->expectException(\InvalidArgumentException::class);
109+
108110
$this->imageMagic->open('bar://foo.bar');
109111
}
110112
}

0 commit comments

Comments
 (0)