Skip to content

Commit c7fbada

Browse files
🔃 [EngCom] Public Pull Requests - 2.3-develop
Accepted Public Pull Requests: - #14710: added GNU Free Font to be used by sales PDFs (by @rossmc) - #14621: [Forwardport] Fix syntax of expectException() calls (by @mastiuhin-olexandr) Fixed GitHub Issues: - #9666: Magento 2.1.6 - Invoice PDF doesn't support Thai (reported by @jsdupuis) has been fixed in #14710 by @rossmc in 2.3-develop branch Related commits: 1. abd7be0 - #12323: Magento 2.1.3 - Invoice and shipment PDF doesn't support Arabic (reported by @Avinashsain) has been fixed in #14710 by @rossmc in 2.3-develop branch Related commits: 1. abd7be0 - #11059: 92 usages of expectException() with ignored $message parameter (reported by @schmengler) has been fixed in #14621 by @mastiuhin-olexandr in 2.3-develop branch Related commits: 1. 948e5fa 2. c557360 3. 353c04c 4. 5d6600e 5. 0d912e6 6. a205337 7. 87b3b58 8. 4955fae 9. 28cddb9 10. 7893cd6
2 parents b7c76e3 + 7847926 commit c7fbada

File tree

94 files changed

+271
-306
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+271
-306
lines changed

app/code/Magento/Backend/Test/Unit/Model/Config/SessionLifetime/BackendModelTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ public function testBeforeSave($value, $errorMessage = null)
2121
\Magento\Backend\Model\Config\SessionLifetime\BackendModel::class
2222
);
2323
if ($errorMessage !== null) {
24-
$this->expectException(\Magento\Framework\Exception\LocalizedException::class, $errorMessage);
24+
$this->expectException(\Magento\Framework\Exception\LocalizedException::class);
25+
$this->expectExceptionMessage($errorMessage);
2526
}
2627
$model->setValue($value);
2728
$object = $model->beforeSave();

app/code/Magento/Captcha/Test/Unit/Model/CaptchaFactoryTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,9 @@ public function testCreateNegative()
5454
$this->returnValue($defaultCaptchaMock)
5555
);
5656

57-
$this->expectException(
58-
'InvalidArgumentException',
59-
'Magento\Captcha\Model\\' . ucfirst(
60-
$captchaType
61-
) . ' does not implement \Magento\Captcha\Model\CaptchaInterface'
62-
);
57+
$this->expectException('InvalidArgumentException');
58+
$this->expectExceptionMessage('Magento\Captcha\Model\\' . ucfirst($captchaType) .
59+
' does not implement \Magento\Captcha\Model\CaptchaInterface');
6360

6461
$this->assertEquals($defaultCaptchaMock, $this->_model->create($captchaType, 'form_id'));
6562
}

app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Initialization/Helper/HandlerFactoryTest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@ protected function setUp()
2727

2828
public function testCreateWithInvalidType()
2929
{
30-
$this->expectException(
31-
'\InvalidArgumentException',
32-
\Magento\Framework\DataObject::class . ' does not implement ' .
33-
\Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper\HandlerInterface::class
34-
);
30+
$this->expectException('\InvalidArgumentException');
31+
$this->expectExceptionMessage(\Magento\Framework\DataObject::class . ' does not implement ' .
32+
\Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper\HandlerInterface::class);
3533
$this->_objectManagerMock->expects($this->never())->method('create');
3634
$this->_model->create(\Magento\Framework\DataObject::class);
3735
}

app/code/Magento/Catalog/Test/Unit/Model/CategoryRepositoryTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@ public function testSaveWithException()
255255
*/
256256
public function testSaveWithValidateCategoryException($error, $expectedException, $expectedExceptionMessage)
257257
{
258-
$this->expectException($expectedException, $expectedExceptionMessage);
258+
$this->expectException($expectedException);
259+
$this->expectExceptionMessage($expectedExceptionMessage);
259260
$categoryId = 5;
260261
$categoryMock = $this->createMock(\Magento\Catalog\Model\Category::class);
261262
$this->extensibleDataObjectConverterMock
@@ -284,7 +285,7 @@ public function saveWithValidateCategoryExceptionDataProvider()
284285
return [
285286
[
286287
true, \Magento\Framework\Exception\CouldNotSaveException::class,
287-
'Could not save category: Attribute "ValidateCategoryTest" is required.',
288+
'Could not save category: The "ValidateCategoryTest" attribute is required. Enter and try again.'
288289
], [
289290
'Something went wrong', \Magento\Framework\Exception\CouldNotSaveException::class,
290291
'Could not save category: Something went wrong'

app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Eav/Action/FullTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ public function testExecuteWithAdapterErrorThrowsException()
4848
$tableSwitcherMock
4949
);
5050

51-
$this->expectException(\Magento\Framework\Exception\LocalizedException::class, $exceptionMessage);
51+
$this->expectException(\Magento\Framework\Exception\LocalizedException::class);
52+
$this->expectExceptionMessage($exceptionMessage);
5253

5354
$model->execute();
5455
}

app/code/Magento/Catalog/Test/Unit/Model/Product/CopyConstructorFactoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ protected function setUp()
2727

2828
public function testCreateWithInvalidType()
2929
{
30-
$this->expectException(
31-
'\InvalidArgumentException',
30+
$this->expectException('\InvalidArgumentException');
31+
$this->expectExceptionMessage(
3232
'Magento\Framework\DataObject does not implement \Magento\Catalog\Model\Product\CopyConstructorInterface'
3333
);
3434
$this->_objectManagerMock->expects($this->never())->method('create');

app/code/Magento/CatalogInventory/Test/Unit/Model/Indexer/Stock/Action/FullTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ public function testExecuteWithAdapterErrorThrowsException()
4444
]
4545
);
4646

47-
$this->expectException(\Magento\Framework\Exception\LocalizedException::class, $exceptionMessage);
47+
$this->expectException(\Magento\Framework\Exception\LocalizedException::class);
48+
$this->expectExceptionMessage($exceptionMessage);
4849

4950
$model->execute();
5051
}

app/code/Magento/Cms/Test/Unit/Helper/Wysiwyg/ImagesTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,10 +379,8 @@ public function testGetCurrentPath($pathId, $expectedPath, $isExist)
379379

380380
public function testGetCurrentPathThrowException()
381381
{
382-
$this->expectException(
383-
\Magento\Framework\Exception\LocalizedException::class,
384-
'The directory PATH/wysiwyg is not writable by server.'
385-
);
382+
$this->expectException(\Magento\Framework\Exception\LocalizedException::class);
383+
$this->expectExceptionMessage('The directory PATH is not writable by server.');
386384

387385
$this->directoryWriteMock->expects($this->once())
388386
->method('isExist')

app/code/Magento/Cms/Test/Unit/Model/Wysiwyg/Images/StorageTest.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ public function testGetResizeHeight()
239239
*/
240240
public function testDeleteDirectoryOverRoot()
241241
{
242-
$this->expectException(
243-
\Magento\Framework\Exception\LocalizedException::class,
242+
$this->expectException(\Magento\Framework\Exception\LocalizedException::class);
243+
$this->expectExceptionMessage(
244244
sprintf('Directory %s is not under storage root path.', self::INVALID_DIRECTORY_OVER_ROOT)
245245
);
246246
$this->imagesStorage->deleteDirectory(self::INVALID_DIRECTORY_OVER_ROOT);
@@ -251,10 +251,9 @@ public function testDeleteDirectoryOverRoot()
251251
*/
252252
public function testDeleteRootDirectory()
253253
{
254-
$this->expectException(
255-
\Magento\Framework\Exception\LocalizedException::class,
256-
sprintf('We can\'t delete root directory %s right now.', self::STORAGE_ROOT_DIR)
257-
);
254+
$this->expectException(\Magento\Framework\Exception\LocalizedException::class);
255+
$this->expectExceptionMessage(sprintf('We can\'t delete root directory %s right now.', self::STORAGE_ROOT_DIR));
256+
258257
$this->imagesStorage->deleteDirectory(self::STORAGE_ROOT_DIR);
259258
}
260259

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ public function testRenderCellTemplateWrongColumnName()
128128

129129
$this->object->addColumn($wrongColumnName, $this->cellParameters);
130130

131-
$this->expectException('\Exception', 'Wrong column name specified.');
131+
$this->expectException('\Exception');
132+
$this->expectExceptionMessage('Wrong column name specified.');
132133

133134
$this->object->renderCellTemplate($columnName);
134135
}

0 commit comments

Comments
 (0)