Skip to content

Commit 0d912e6

Browse files
Stanislav IdolovMastiuhin Oleksandr
authored andcommitted
(cherry picked from commit 02a09d6)
1 parent 5d6600e commit 0d912e6

File tree

41 files changed

+94
-48
lines changed

Some content is hidden

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

41 files changed

+94
-48
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ public function testSaveWithException()
9494
->method('save')
9595
->with($this->bookmarkMock)
9696
->willThrowException(new \Exception($exceptionMessage));
97-
$this->expectException(\Magento\Framework\Exception\CouldNotSaveException::class, __($exceptionMessage));
97+
$this->expectException(\Magento\Framework\Exception\CouldNotSaveException::class);
98+
$this->expectExceptionMessage($exceptionMessage);
9899
$this->bookmarkRepository->save($this->bookmarkMock);
99100
}
100101

@@ -143,7 +144,8 @@ public function testDeleteWithException()
143144
->method('delete')
144145
->with($this->bookmarkMock)
145146
->willThrowException(new \Exception($exceptionMessage));
146-
$this->expectException(\Magento\Framework\Exception\CouldNotDeleteException::class, __($exceptionMessage));
147+
$this->expectException(\Magento\Framework\Exception\CouldNotDeleteException::class);
148+
$this->expectExceptionMessage($exceptionMessage);
147149
$this->assertTrue($this->bookmarkRepository->delete($this->bookmarkMock));
148150
}
149151

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,8 @@ public function testSetAndSaveItemOptions()
299299

300300
public function testGetProductWithException()
301301
{
302-
$this->expectException(\Magento\Framework\Exception\LocalizedException::class, __('Cannot specify product.'));
302+
$this->expectException(\Magento\Framework\Exception\LocalizedException::class);
303+
$this->expectExceptionMessage('Cannot specify product.');
303304
$this->model->getProduct();
304305
}
305306

lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/ResolverTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ protected function setUp()
4040

4141
public function testGetTagsForNotObject()
4242
{
43-
$this->expectException(\InvalidArgumentException::class, 'Provided argument is not an object');
43+
$this->expectException(\InvalidArgumentException::class);
44+
$this->expectExceptionMessage('Provided argument is not an object');
4445
$this->model->getTags('some scalar');
4546
}
4647

lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/DummyTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ protected function setUp()
2020

2121
public function testGetTagsWithScalar()
2222
{
23-
$this->expectException(\InvalidArgumentException::class, 'Provided argument is not an object');
23+
$this->expectException(\InvalidArgumentException::class);
24+
$this->expectExceptionMessage('Provided argument is not an object');
2425
$this->model->getTags('scalar');
2526
}
2627

lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/FactoryTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ protected function setUp()
4949

5050
public function testGetStrategyWithScalar()
5151
{
52-
$this->expectException(\InvalidArgumentException::class, 'Provided argument is not an object');
52+
$this->expectException(\InvalidArgumentException::class);
53+
$this->expectExceptionMessage('Provided argument is not an object');
5354
$this->model->getStrategy('some scalar');
5455
}
5556

lib/internal/Magento/Framework/App/Test/Unit/Cache/Tag/Strategy/IdentifierTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ protected function setUp()
2222

2323
public function testGetWithScalar()
2424
{
25-
$this->expectException(\InvalidArgumentException::class, 'Provided argument is not an object');
25+
$this->expectException(\InvalidArgumentException::class);
26+
$this->expectExceptionMessage('Provided argument is not an object');
2627
$this->model->getTags('scalar');
2728
}
2829

lib/internal/Magento/Framework/App/Test/Unit/ErrorHandlerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ public function testHandlerException($errorNo, $errorPhrase)
5454
$errorLine = 'test_error_line';
5555

5656
$exceptedExceptionMessage = sprintf('%s: %s in %s on line %s', $errorPhrase, $errorStr, $errorFile, $errorLine);
57-
$this->expectException('Exception', $exceptedExceptionMessage);
57+
$this->expectException('Exception');
58+
$this->expectExceptionMessage($exceptedExceptionMessage);
5859

5960
$this->object->handler($errorNo, $errorStr, $errorFile, $errorLine);
6061
}

lib/internal/Magento/Framework/App/Test/Unit/SetupInfoTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ class SetupInfoTest extends \PHPUnit\Framework\TestCase
2424
*/
2525
public function testConstructorExceptions($server, $expectedError)
2626
{
27-
$this->expectException('\InvalidArgumentException', $expectedError);
27+
$this->expectException('\InvalidArgumentException');
28+
$this->expectExceptionMessage($expectedError);
2829
new SetupInfo($server);
2930
}
3031

lib/internal/Magento/Framework/App/Test/Unit/ShellTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ public function testExecuteFailure()
6969
);
7070
$this->driverMock->expects($this->once())->method('execute')->willReturn($response);
7171
$this->loggerMock->expects($this->once())->method('error')->with($logEntry);
72-
$this->expectException(LocalizedException::class, "Command returned non-zero exit code:\n`$command`");
72+
$this->expectException(LocalizedException::class);
73+
$this->expectExceptionMessage("Command returned non-zero exit code:\n`$command`");
7374
$this->model->execute($command, []);
7475
}
7576
}

lib/internal/Magento/Framework/App/Test/Unit/View/Asset/MaterializationStrategy/FactoryTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ public function testCreateException()
8787

8888
$factory = new Factory($this->objectManager, []);
8989

90-
$this->expectException('LogicException', 'No materialization strategy is supported');
90+
$this->expectException('LogicException');
91+
$this->expectExceptionMessage('No materialization strategy is supported');
9192
$factory->create($asset);
9293
}
9394

0 commit comments

Comments
 (0)