Skip to content

Commit 4955fae

Browse files
author
Mastiuhin Oleksandr
committed
Fix failed tests
1 parent 87b3b58 commit 4955fae

File tree

10 files changed

+20
-13
lines changed

10 files changed

+20
-13
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,8 @@ public function saveWithValidateCategoryExceptionDataProvider()
285285
return [
286286
[
287287
true, \Magento\Framework\Exception\CouldNotSaveException::class,
288-
'Could not save category: Attribute "ValidateCategoryTest" is required.',
288+
'Could not save category: Attribute The "ValidateCategoryTest" attribute is required.' .
289+
'Enter and try again.',
289290
], [
290291
'Something went wrong', \Magento\Framework\Exception\CouldNotSaveException::class,
291292
'Could not save category: Something went wrong'

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ public function testGetCurrentPath($pathId, $expectedPath, $isExist)
380380
public function testGetCurrentPathThrowException()
381381
{
382382
$this->expectException(\Magento\Framework\Exception\LocalizedException::class);
383-
$this->expectExceptionMessage('The directory PATH/wysiwyg is not writable by server.');
383+
$this->expectExceptionMessage('The directory PATH is not writable by server.');
384384

385385
$this->directoryWriteMock->expects($this->once())
386386
->method('isExist')

app/code/Magento/Payment/Test/Unit/Block/Transparent/FormTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ public function testGetMethodSuccess()
291291
public function testGetMethodNotTransparentInterface()
292292
{
293293
$this->expectException(\Magento\Framework\Exception\LocalizedException::class);
294-
$this->expectExceptionMessage(__('We cannot retrieve the transparent payment method model object.'));
294+
$this->expectExceptionMessage((string)__('We cannot retrieve the transparent payment method model object.'));
295295

296296
$methodMock = $this->getMockBuilder(\Magento\Payment\Model\MethodInterface::class)
297297
->getMockForAbstractClass();

app/code/Magento/Security/Test/Unit/Model/SecurityManagerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public function testConstructorException()
128128

129129
$this->expectException(\Magento\Framework\Exception\LocalizedException::class);
130130
$this->expectExceptionMessage(
131-
__('Incorrect Security Checker class. It has to implement SecurityCheckerInterface')
131+
(string)__('Incorrect Security Checker class. It has to implement SecurityCheckerInterface')
132132
);
133133

134134
$this->model->__construct(

app/code/Magento/Ui/Test/Unit/Model/ManagerTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@ public function testGetReader()
153153
public function testPrepareDataWithoutName()
154154
{
155155
$this->expectException(\Magento\Framework\Exception\LocalizedException::class);
156-
$this->expectExceptionMessage(__('The "" UI component element name is invalid. Verify the name and try again.'));
156+
$this->expectExceptionMessage(
157+
(string)__('The "" UI component element name is invalid. Verify the name and try again.')
158+
);
157159
$this->manager->prepareData(null);
158160
}
159161

app/code/Magento/Ui/Test/Unit/Model/ResourceModel/BookmarkRepositoryTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,11 @@ public function testGetByIdWithException()
124124
->with($this->bookmarkMock, $notExistsBookmarkId)
125125
->willReturn($this->bookmarkMock);
126126
$this->expectException(\Magento\Framework\Exception\NoSuchEntityException::class);
127-
$this->expectExceptionMessage(
128-
__('The bookmark with "%1" ID doesn\'t exist. Verify your information and try again.', $notExistsBookmarkId)
127+
$exceptionMessage = (string)__(
128+
'The bookmark with "%1" ID doesn\'t exist. Verify your information and try again.',
129+
$notExistsBookmarkId
129130
);
131+
$this->expectExceptionMessage($exceptionMessage);
130132
$this->bookmarkRepository->getById($notExistsBookmarkId);
131133
}
132134

@@ -146,7 +148,7 @@ public function testDeleteWithException()
146148
->with($this->bookmarkMock)
147149
->willThrowException(new \Exception($exceptionMessage));
148150
$this->expectException(\Magento\Framework\Exception\CouldNotDeleteException::class);
149-
$this->expectExceptionMessage(__($exceptionMessage));
151+
$this->expectExceptionMessage((string)__($exceptionMessage));
150152
$this->expectExceptionMessage($exceptionMessage);
151153
$this->assertTrue($this->bookmarkRepository->delete($this->bookmarkMock));
152154
}

app/code/Magento/User/Test/Unit/Model/UserTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -779,13 +779,13 @@ public function testPerformIdentityCheck($verifyIdentityResult, $lockExpires)
779779

780780
if ($lockExpires) {
781781
$this->expectException(\Magento\Framework\Exception\State\UserLockedException::class);
782-
$this->expectExceptionMessage(__('Your account is temporarily disabled. Please try again later.'));
782+
$this->expectExceptionMessage((string)__('Your account is temporarily disabled. Please try again later.'));
783783
}
784784

785785
if (!$verifyIdentityResult) {
786786
$this->expectException(\Magento\Framework\Exception\AuthenticationException::class);
787787
$this->expectExceptionMessage(
788-
__('The password entered for the current user is invalid. Verify the password and try again.')
788+
(string)__('The password entered for the current user is invalid. Verify the password and try again.')
789789
);
790790
}
791791

app/code/Magento/Wishlist/Test/Unit/Model/ItemTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public function testSetAndSaveItemOptions()
300300
public function testGetProductWithException()
301301
{
302302
$this->expectException(\Magento\Framework\Exception\LocalizedException::class);
303-
$this->expectExceptionMessage(__('Cannot specify product.'));
303+
$this->expectExceptionMessage((string)__('Cannot specify product.'));
304304
$this->expectExceptionMessage('Cannot specify product.');
305305
$this->model->getProduct();
306306
}

dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,10 @@ public function testRunValidationException()
7979
public function testLargeSizeFile()
8080
{
8181
$this->expectException(\Magento\Framework\Exception\LocalizedException::class);
82+
$exceptionMessage = 'The file was too big and couldn\'t be uploaded. Use a file smaller than %s MBs and try ' .
83+
'to upload again.';
8284
$this->expectExceptionMessage(
83-
sprintf('The file you uploaded is larger than %s Megabytes allowed by server', $this->maxFileSizeInMb)
85+
sprintf($exceptionMessage, $this->maxFileSizeInMb)
8486
);
8587
$this->prepareEnv();
8688
$_SERVER['CONTENT_LENGTH'] = $this->maxFileSize + 1;

lib/internal/Magento/Framework/DB/Test/Unit/Tree/NodeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function constructorDataProvider()
109109
'node_data' => true,
110110
'keys' => null,
111111
], \Magento\Framework\Exception\LocalizedException::class,
112-
'Enter the encryption key and try again.'
112+
'The encryption key can\'t be empty. Enter the key and try again.'
113113
]
114114
];
115115
}

0 commit comments

Comments
 (0)