diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeMediaGalleryManagementInterfaceTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeMediaGalleryManagementInterfaceTest.php index ca9ad9897bf8c..17bc1226d992c 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeMediaGalleryManagementInterfaceTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeMediaGalleryManagementInterfaceTest.php @@ -609,9 +609,11 @@ public function testGetListForAbsentSku() 'sku' => $productSku, ]; if (TESTS_WEB_API_ADAPTER == self::ADAPTER_SOAP) { - $this->expectException('SoapFault', 'Requested product doesn\'t exist'); + $this->expectException('SoapFault'); + $this->expectExceptionMessage('Requested product doesn\'t exist'); } else { - $this->expectException('Exception', '', 404); + $this->expectException('Exception'); + $this->expectExceptionCode(404); } $this->_webApiCall($serviceInfo, $requestData); } diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductCustomAttributeWrongTypeTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductCustomAttributeWrongTypeTest.php index 2dc8d19777898..19b0757439077 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductCustomAttributeWrongTypeTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductCustomAttributeWrongTypeTest.php @@ -43,9 +43,11 @@ public function testCustomAttributeWrongType() ]; if (TESTS_WEB_API_ADAPTER == self::ADAPTER_SOAP) { - $this->expectException('Exception', 'Attribute "meta_title" has invalid value.'); + $this->expectException('Exception'); + $this->expectExceptionMessage('Attribute "meta_title" has invalid value.'); } else { - $this->expectException('Exception', 'Attribute \"meta_title\" has invalid value.'); + $this->expectException('Exception'); + $this->expectExceptionMessage('Attribute \"meta_title\" has invalid value.'); } $this->_webApiCall($serviceInfo, $this->getRequestData()); diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductCustomOptionRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductCustomOptionRepositoryTest.php index a152167a345fa..b0dd2702f89be 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductCustomOptionRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductCustomOptionRepositoryTest.php @@ -211,12 +211,15 @@ public function testAddNegative($optionData) if (TESTS_WEB_API_ADAPTER == self::ADAPTER_SOAP) { if (isset($optionDataPost['title']) && empty($optionDataPost['title'])) { - $this->expectException('SoapFault', 'Missed values for option required fields'); + $this->expectException('SoapFault'); + $this->expectExceptionMessage('Missed values for option required fields'); } else { - $this->expectException('SoapFault', 'Invalid option'); + $this->expectException('SoapFault'); + $this->expectExceptionMessage('Invalid option'); } } else { - $this->expectException('Exception', '', 400); + $this->expectException('Exception'); + $this->expectExceptionMessage('', 400); } $this->_webApiCall($serviceInfo, ['option' => $optionDataPost]); } @@ -406,7 +409,9 @@ public function testUpdateNegative($optionData, $message) ], ]; - $this->expectException('Exception', $message, 400); + $this->expectException('Exception'); + $this->expectExceptionMessage($message); + $this->expectExceptionCode(400); $this->_webApiCall($serviceInfo, ['option' => $optionData]); } diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php index cd9aaa1d95294..cb33edce3af39 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php @@ -313,7 +313,8 @@ public function testDeleteAllStoreCode($fixtureProduct) { $sku = $fixtureProduct[ProductInterface::SKU]; $this->saveProduct($fixtureProduct); - $this->expectException('Exception', 'Requested product doesn\'t exist'); + $this->expectException('Exception'); + $this->expectExceptionMessage('Requested product doesn\'t exist'); // Delete all with 'all' store code $this->deleteProduct($sku); diff --git a/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/CoreRoutingTest.php b/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/CoreRoutingTest.php index 89533a0a62474..23b889c7c1251 100644 --- a/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/CoreRoutingTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/CoreRoutingTest.php @@ -73,7 +73,8 @@ public function testExceptionSoapInternalError() 'operation' => 'testModule3ErrorV1ServiceException', ], ]; - $this->expectException('SoapFault', 'Generic service exception'); + $this->expectException('SoapFault'); + $this->expectExceptionMessage('Generic service exception'); $this->_webApiCall($serviceInfo); } diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Bootstrap/SettingsTest.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Bootstrap/SettingsTest.php index aefe51f6ab37c..26e6b59ede06d 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Bootstrap/SettingsTest.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Bootstrap/SettingsTest.php @@ -199,7 +199,8 @@ public function getAsConfigFileDataProvider() */ public function testGetAsConfigFileException($settingName, $expectedExceptionMsg) { - $this->expectException(\Magento\Framework\Exception\LocalizedException::class, $expectedExceptionMsg); + $this->expectException(\Magento\Framework\Exception\LocalizedException::class); + $this->expectExceptionMessage($expectedExceptionMsg); $this->_object->getAsConfigFile($settingName); } diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Design/Fallback/RulePoolTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/Design/Fallback/RulePoolTest.php index 1500c91478a4a..c586c68b74573 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/Design/Fallback/RulePoolTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/Design/Fallback/RulePoolTest.php @@ -74,7 +74,8 @@ public function testGetRuleUnsupportedType() */ public function testGetPatternDirsException($type, array $overriddenParams, $expectedErrorMessage) { - $this->expectException('InvalidArgumentException', $expectedErrorMessage); + $this->expectException('InvalidArgumentException'); + $this->expectExceptionMessage($expectedErrorMessage); $params = $overriddenParams + $this->defaultParams; $this->model->getRule($type)->getPatternDirs($params); } diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTest.php index c014b517f6463..66e8eb3e453f9 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTest.php @@ -275,7 +275,8 @@ public function testAddContainerInvalidHtmlTag() $msg = 'Html tag "span" is forbidden for usage in containers. ' . 'Consider to use one of the allowed: aside, dd, div, dl, fieldset, main, nav, ' . 'header, footer, ol, p, section, table, tfoot, ul.'; - $this->expectException(\Magento\Framework\Exception\LocalizedException::class, $msg); + $this->expectException(\Magento\Framework\Exception\LocalizedException::class); + $this->expectExceptionMessage($msg); $this->_layout->addContainer('container', 'Container', ['htmlTag' => 'span']); } diff --git a/dev/tests/integration/testsuite/Magento/Review/Model/ResourceModel/RatingTest.php b/dev/tests/integration/testsuite/Magento/Review/Model/ResourceModel/RatingTest.php index c88bd5ed7cf77..7801cb2c78c24 100644 --- a/dev/tests/integration/testsuite/Magento/Review/Model/ResourceModel/RatingTest.php +++ b/dev/tests/integration/testsuite/Magento/Review/Model/ResourceModel/RatingTest.php @@ -77,7 +77,8 @@ public function testRatingEdit() */ public function testRatingSaveWithError() { - $this->expectException('Exception', 'Rolled back transaction has not been completed correctly'); + $this->expectException('Exception'); + $this->expectExceptionMessage('Rolled back transaction has not been completed correctly'); $rating = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( \Magento\Review\Model\Rating::class );