Skip to content

Commit cc7b630

Browse files
committed
Merge remote-tracking branch 'origin/MC-34231' into 2.4.0-develop-pr33
2 parents 30d6dec + 7173fa4 commit cc7b630

File tree

6 files changed

+68
-33
lines changed

6 files changed

+68
-33
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ 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);
126126
$baseMediaDir = 'pub/media';
127127
$construction = [
128128
'{{media url="http://wysiwyg/images/image.jpg"}}',

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,11 @@ public function testValidate()
239239
->with(FileProcessor::TMP_DIR . '/' . $value['name'])
240240
->willReturn(true);
241241

242+
$this->ioFileSystemMock->expects($this->once())
243+
->method('getPathInfo')
244+
->with($value['name'])
245+
->willReturn(['extension' => 'gif']);
246+
242247
$model = $this->initialize([
243248
'value' => $value,
244249
'isAjax' => false,
@@ -284,6 +289,11 @@ public function testValidateMaxFileSize()
284289
->with(FileProcessor::TMP_DIR . '/' . $value['name'])
285290
->willReturn(true);
286291

292+
$this->ioFileSystemMock->expects($this->once())
293+
->method('getPathInfo')
294+
->with($value['name'])
295+
->willReturn(['extension' => 'gif']);
296+
287297
$model = $this->initialize([
288298
'value' => $value,
289299
'isAjax' => false,
@@ -328,6 +338,11 @@ public function testValidateMaxImageWidth()
328338
->with(FileProcessor::TMP_DIR . '/' . $value['name'])
329339
->willReturn(true);
330340

341+
$this->ioFileSystemMock->expects($this->once())
342+
->method('getPathInfo')
343+
->with($value['name'])
344+
->willReturn(['extension' => 'gif']);
345+
331346
$model = $this->initialize([
332347
'value' => $value,
333348
'isAjax' => false,
@@ -372,6 +387,11 @@ public function testValidateMaxImageHeight()
372387
->with(FileProcessor::TMP_DIR . '/' . $value['name'])
373388
->willReturn(true);
374389

390+
$this->ioFileSystemMock->expects($this->once())
391+
->method('getPathInfo')
392+
->with($value['name'])
393+
->willReturn(['extension' => 'gif']);
394+
375395
$model = $this->initialize([
376396
'value' => $value,
377397
'isAjax' => false,

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

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

477477
/**
478-
* @expectedException \Magento\Framework\Exception\MailException
479478
* @throws NoSuchEntityException
480479
*/
481480
public function testProtocolDirectiveWithInvalidSchema()
482481
{
482+
$this->expectException(\Magento\Framework\Exception\MailException::class);
483483
$model = $this->getModel();
484484
$storeMock = $this->createMock(\Magento\Store\Model\Store::class);
485485
$storeMock->expects($this->once())->method('isCurrentlySecure')->willReturn(true);

app/code/Magento/Newsletter/Test/Unit/Block/Adminhtml/Queue/PreviewTest.php

Lines changed: 42 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,23 @@ protected function setUp(): void
100100
->willReturn($backendSession);
101101

102102
$templateFactory = $this->createPartialMock(TemplateFactory::class, ['create']);
103-
$this->templateMock = $this->createPartialMock(
104-
Template::class,
105-
[
106-
'isPlain',
107-
'setId',
108-
'setTemplateType',
109-
'setTemplateText',
110-
'setTemplateStyles',
111-
]
112-
);
103+
$this->templateMock = $this->getMockBuilder(Template::class)
104+
->disableOriginalConstructor()
105+
->setMethods(
106+
[
107+
'isPlain',
108+
'setId',
109+
]
110+
)
111+
->addMethods(
112+
[
113+
'setTemplateType',
114+
'setTemplateText',
115+
'setTemplateStyles',
116+
]
117+
)
118+
->getMock();
119+
113120
$templateFactory->expects($this->once())
114121
->method('create')
115122
->willReturn($this->templateMock);
@@ -121,16 +128,22 @@ protected function setUp(): void
121128
->willReturn($this->subscriberMock);
122129

123130
$queueFactory = $this->createPartialMock(QueueFactory::class, ['create']);
124-
$this->queueMock = $this->createPartialMock(
125-
Queue::class,
126-
[
127-
'load',
128-
'getTemplateId',
129-
'getNewsletterType',
130-
'getNewsletterText',
131-
'getNewsletterStyles',
132-
]
133-
);
131+
$this->queueMock = $this->getMockBuilder(Queue::class)
132+
->disableOriginalConstructor()
133+
->setMethods(
134+
[
135+
'load',
136+
]
137+
)
138+
->addMethods(
139+
[
140+
'getTemplateId',
141+
'getNewsletterType',
142+
'getNewsletterText',
143+
'getNewsletterStyles',
144+
]
145+
)
146+
->getMock();
134147
$queueFactory->expects($this->any())
135148
->method('create')
136149
->willReturn($this->queueMock);
@@ -148,7 +161,7 @@ protected function setUp(): void
148161
'context' => $context,
149162
'templateFactory' => $templateFactory,
150163
'subscriberFactory' => $subscriberFactory,
151-
'queueFactory' => $queueFactory
164+
'queueFactory' => $queueFactory,
152165
]
153166
);
154167
}
@@ -178,17 +191,17 @@ public function testToHtmlWithId()
178191
);
179192
$this->queueMock->expects($this->once())
180193
->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);
194+
$this->queueMock->expects($this->once())->method('getTemplateId')->willReturn($templateId);
195+
$this->queueMock->expects($this->once())->method('getNewsletterType')->willReturn($newsletterType);
196+
$this->queueMock->expects($this->once())->method('getNewsletterText')->willReturn($newsletterText);
197+
$this->queueMock->expects($this->once())->method('getNewsletterStyles')->willReturn($newsletterStyle);
185198
$this->templateMock->expects($this->any())
186199
->method('isPlain')
187200
->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);
201+
$this->templateMock->expects($this->once())->method('setId')->willReturn($templateId);
202+
$this->templateMock->expects($this->once())->method('setTemplateType')->willReturn($newsletterType);
203+
$this->templateMock->expects($this->once())->method('setTemplateText')->willReturn($newsletterText);
204+
$this->templateMock->expects($this->once())->method('setTemplateStyles')->willReturn($newsletterStyle);
192205
/** @var Store $store */
193206
$this->storeManagerMock->expects($this->once())
194207
->method('getDefaultStoreView')

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,11 @@ public function testOpenDifferentTypes()
156156
}
157157

158158
/**
159-
* @expectedException \InvalidArgumentException
159+
* Check case with invalid URL
160160
*/
161161
public function testOpenInvalidURL()
162162
{
163+
$this->expectException(\InvalidArgumentException::class);
163164
$this->adapter->open('bar://foo.bar');
164165
}
165166
}

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

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

103103
/**
104-
* @expectedException \InvalidArgumentException
104+
* Check case with invalid URL
105105
*/
106106
public function testOpenInvalidUrl()
107107
{
108+
$this->expectException(\InvalidArgumentException::class);
108109
$this->imageMagic->open('bar://foo.bar');
109110
}
110111
}

0 commit comments

Comments
 (0)