diff --git a/app/code/Magento/Analytics/Model/Config/Backend/CollectionTime.php b/app/code/Magento/Analytics/Model/Config/Backend/CollectionTime.php index e26ad01fc74bf..524062eec35c6 100644 --- a/app/code/Magento/Analytics/Model/Config/Backend/CollectionTime.php +++ b/app/code/Magento/Analytics/Model/Config/Backend/CollectionTime.php @@ -66,7 +66,9 @@ public function afterSave() $result = preg_match('#(?\d{2}),(?\d{2}),(?\d{2})#', $this->getValue(), $time); if (!$result) { - throw new LocalizedException(__('Time value has an unsupported format')); + throw new LocalizedException( + __('The time value is using an unsupported format. Enter a supported format and try again.') + ); } $cronExprArray = [ diff --git a/app/code/Magento/Analytics/Model/Cryptographer.php b/app/code/Magento/Analytics/Model/Cryptographer.php index 6905eee372ae2..665d564814b14 100644 --- a/app/code/Magento/Analytics/Model/Cryptographer.php +++ b/app/code/Magento/Analytics/Model/Cryptographer.php @@ -56,13 +56,18 @@ public function encode($source) try { $source = (string)$source; } catch (\Exception $e) { - throw new LocalizedException(__('Input data must be string or convertible into string.')); + throw new LocalizedException( + __( + 'The data is invalid. ' + . 'Enter the data as a string or data that can be converted into a string and try again.' + ) + ); } } elseif (!$source) { - throw new LocalizedException(__('Input data must be non-empty string.')); + throw new LocalizedException(__('The data is invalid. Enter the data as a string and try again.')); } if (!$this->validateCipherMethod($this->cipherMethod)) { - throw new LocalizedException(__('Not valid cipher method.')); + throw new LocalizedException(__('The data is invalid. Use a valid cipher method and try again.')); } $initializationVector = $this->getInitializationVector(); @@ -90,7 +95,7 @@ private function getKey() { $token = $this->analyticsToken->getToken(); if (!$token) { - throw new LocalizedException(__('Encryption key can\'t be empty.')); + throw new LocalizedException(__('Enter the encryption key and try again.')); } return hash('sha256', $token); } diff --git a/app/code/Magento/Analytics/Model/ExportDataHandler.php b/app/code/Magento/Analytics/Model/ExportDataHandler.php index b9d3b6340184b..dc17a548763eb 100644 --- a/app/code/Magento/Analytics/Model/ExportDataHandler.php +++ b/app/code/Magento/Analytics/Model/ExportDataHandler.php @@ -195,7 +195,7 @@ private function pack($source, $destination) private function validateSource(WriteInterface $directory, $path) { if (!$directory->isExist($path)) { - throw new LocalizedException(__('Source "%1" is not exist', $directory->getAbsolutePath($path))); + throw new LocalizedException(__('The "%1" source doesn\'t exist.', $directory->getAbsolutePath($path))); } return $directory->getAbsolutePath($path); diff --git a/app/code/Magento/Authorization/Model/Acl/AclRetriever.php b/app/code/Magento/Authorization/Model/Acl/AclRetriever.php index f22cbaf46332b..904c8d0ea7794 100644 --- a/app/code/Magento/Authorization/Model/Acl/AclRetriever.php +++ b/app/code/Magento/Authorization/Model/Acl/AclRetriever.php @@ -84,7 +84,7 @@ public function getAllowedResourcesByUser($userType, $userId) $role = $this->_getUserRole($userType, $userId); if (!$role) { throw new AuthorizationException( - __('We can\'t find the role for the user you wanted.') + __("The role wasn't found for the user. Verify the role and try again.") ); } $allowedResources = $this->getAllowedResourcesByRole($role->getId()); diff --git a/app/code/Magento/Authorization/Test/Unit/Model/Acl/AclRetrieverTest.php b/app/code/Magento/Authorization/Test/Unit/Model/Acl/AclRetrieverTest.php index bd1a3616a746e..c214cfc832597 100644 --- a/app/code/Magento/Authorization/Test/Unit/Model/Acl/AclRetrieverTest.php +++ b/app/code/Magento/Authorization/Test/Unit/Model/Acl/AclRetrieverTest.php @@ -60,7 +60,7 @@ public function testGetAllowedResourcesByUserTypeCustomer() /** * @expectedException \Magento\Framework\Exception\AuthorizationException - * @expectedExceptionMessage We can't find the role for the user you wanted. + * @expectedExceptionMessage The role wasn't found for the user. Verify the role and try again. */ public function testGetAllowedResourcesByUserRoleNotFound() { diff --git a/app/code/Magento/Authorizenet/Controller/Directpost/Payment/Place.php b/app/code/Magento/Authorizenet/Controller/Directpost/Payment/Place.php index ea73b4b734569..92957481b9290 100644 --- a/app/code/Magento/Authorizenet/Controller/Directpost/Payment/Place.php +++ b/app/code/Magento/Authorizenet/Controller/Directpost/Payment/Place.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Authorizenet\Controller\Directpost\Payment; use Magento\Authorizenet\Controller\Directpost\Payment; @@ -147,7 +148,7 @@ protected function placeCheckoutOrder() $result->setData('error', true); $result->setData( 'error_messages', - __('An error occurred on the server. Please try to place the order again.') + __('A server error stopped your order from being placed. Please try to place your order again.') ); } if ($response instanceof Http) { diff --git a/app/code/Magento/Authorizenet/Model/TransactionService.php b/app/code/Magento/Authorizenet/Model/TransactionService.php index fef22d6c913c0..693a5b890faba 100644 --- a/app/code/Magento/Authorizenet/Model/TransactionService.php +++ b/app/code/Magento/Authorizenet/Model/TransactionService.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Authorizenet\Model; use Magento\Framework\Exception\LocalizedException; @@ -124,7 +125,7 @@ protected function loadTransactionDetails(Authorizenet $context, $transactionId) $responseXmlDocument = new Element($responseBody); libxml_use_internal_errors(false); } catch (\Exception $e) { - throw new LocalizedException(__('Unable to get transaction details. Try again later.')); + throw new LocalizedException(__('The transaction details are unavailable. Please try again later.')); } finally { $context->debugData($debugData); } @@ -132,7 +133,7 @@ protected function loadTransactionDetails(Authorizenet $context, $transactionId) if (!isset($responseXmlDocument->messages->resultCode) || $responseXmlDocument->messages->resultCode != static::PAYMENT_UPDATE_STATUS_CODE_SUCCESS ) { - throw new LocalizedException(__('Unable to get transaction details. Try again later.')); + throw new LocalizedException(__('The transaction details are unavailable. Please try again later.')); } $this->transactionDetails[$transactionId] = $responseXmlDocument; diff --git a/app/code/Magento/Authorizenet/Test/Unit/Controller/Directpost/Payment/PlaceTest.php b/app/code/Magento/Authorizenet/Test/Unit/Controller/Directpost/Payment/PlaceTest.php index 95ceed1ee11e7..c0a50e66759ba 100644 --- a/app/code/Magento/Authorizenet/Test/Unit/Controller/Directpost/Payment/PlaceTest.php +++ b/app/code/Magento/Authorizenet/Test/Unit/Controller/Directpost/Payment/PlaceTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Authorizenet\Test\Unit\Controller\Directpost\Payment; use Magento\Authorizenet\Controller\Directpost\Payment\Place; @@ -297,7 +298,9 @@ public function textExecuteFailedPlaceOrderDataProvider() $objectFailed1 = new \Magento\Framework\DataObject( [ 'error' => true, - 'error_messages' => __('An error occurred on the server. Please try to place the order again.') + 'error_messages' => __( + 'A server error stopped your order from being placed. Please try to place your order again.' + ) ] ); $generalException = new \Exception('Exception logging will save the world!'); diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php index 8252ed1a1e2f8..dfddef6a11f81 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Backend\Block\Widget\Grid\Massaction; use Magento\Backend\Block\Widget\Grid\Massaction\VisibilityCheckerInterface as VisibilityChecker; @@ -57,7 +58,7 @@ protected function _construct() { parent::_construct(); - $this->setErrorText($this->escapeHtml(__('Please select items.'))); + $this->setErrorText($this->escapeHtml(__('An item needs to be selected. Select and try again.'))); if (null !== $this->getOptions()) { foreach ($this->getOptions() as $optionId => $option) { diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Extended.php b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Extended.php index 42f5e61bf5fa8..e90d49847ee36 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Extended.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Extended.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Backend\Block\Widget\Grid\Massaction; /** @@ -69,7 +70,7 @@ public function __construct( public function _construct() { parent::_construct(); - $this->setErrorText($this->escapeHtml(__('Please select items.'))); + $this->setErrorText($this->escapeHtml(__('An item needs to be selected. Select and try again.'))); } /** diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Cache.php b/app/code/Magento/Backend/Controller/Adminhtml/Cache.php index daaa2a9aaeced..4fcd5993fb504 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Cache.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Cache.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Backend\Controller\Adminhtml; use Magento\Backend\App\Action; @@ -73,7 +74,7 @@ protected function _validateTypes(array $types) $allTypes = array_keys($this->_cacheTypeList->getTypes()); $invalidTypes = array_diff($types, $allTypes); if (count($invalidTypes) > 0) { - throw new LocalizedException(__('Specified cache type(s) don\'t exist: %1', join(', ', $invalidTypes))); + throw new LocalizedException(__('These cache type(s) don\'t exist: %1', join(', ', $invalidTypes))); } } } diff --git a/app/code/Magento/Backend/Model/Auth.php b/app/code/Magento/Backend/Model/Auth.php index 08921d1615f87..02bf64fef07ed 100644 --- a/app/code/Magento/Backend/Model/Auth.php +++ b/app/code/Magento/Backend/Model/Auth.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Backend\Model; use Magento\Framework\Exception\AuthenticationException; @@ -148,7 +149,12 @@ public function getCredentialStorage() public function login($username, $password) { if (empty($username) || empty($password)) { - self::throwException(__('You did not sign in correctly or your account is temporarily disabled.')); + self::throwException( + __( + 'The account sign-in was incorrect or your account is disabled temporarily. ' + . 'Please wait and try again later.' + ) + ); } try { @@ -165,7 +171,12 @@ public function login($username, $password) } if (!$this->getAuthStorage()->getUser()) { - self::throwException(__('You did not sign in correctly or your account is temporarily disabled.')); + self::throwException( + __( + 'The account sign-in was incorrect or your account is disabled temporarily. ' + . 'Please wait and try again later.' + ) + ); } } catch (PluginAuthenticationException $e) { $this->_eventManager->dispatch( @@ -179,7 +190,10 @@ public function login($username, $password) ['user_name' => $username, 'exception' => $e] ); self::throwException( - __($e->getMessage()? : 'You did not sign in correctly or your account is temporarily disabled.') + __( + $e->getMessage()? : 'The account sign-in was incorrect or your account is disabled temporarily. ' + . 'Please wait and try again later.' + ) ); } } @@ -215,7 +229,7 @@ public function isLoggedIn() public static function throwException(Phrase $msg = null) { if ($msg === null) { - $msg = __('Authentication error occurred.'); + $msg = __('An authentication error occurred. Verify and try again.'); } throw new AuthenticationException($msg); } diff --git a/app/code/Magento/Backend/Model/Config/SessionLifetime/BackendModel.php b/app/code/Magento/Backend/Model/Config/SessionLifetime/BackendModel.php index 09f33abd0d44d..c106afb90a09d 100644 --- a/app/code/Magento/Backend/Model/Config/SessionLifetime/BackendModel.php +++ b/app/code/Magento/Backend/Model/Config/SessionLifetime/BackendModel.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Backend\Model\Config\SessionLifetime; use Magento\Framework\App\Config\Value; @@ -26,14 +27,17 @@ class BackendModel extends Value */ public function beforeSave() { - $value = (int) $this->getValue(); + $value = (int)$this->getValue(); if ($value > self::MAX_LIFETIME) { throw new LocalizedException( - __('Admin session lifetime must be less than or equal to 31536000 seconds (one year)') + __( + 'The Admin session lifetime is invalid. ' + . 'Set the lifetime to 31536000 seconds (one year) or shorter and try again.' + ) ); } elseif ($value < self::MIN_LIFETIME) { throw new LocalizedException( - __('Admin session lifetime must be greater than or equal to 60 seconds') + __('The Admin session lifetime is invalid. Set the lifetime to 60 seconds or longer and try again.') ); } return parent::beforeSave(); diff --git a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/MassDisableTest.php b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/MassDisableTest.php index 556db311748bd..197b46acc61bc 100644 --- a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/MassDisableTest.php +++ b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/MassDisableTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Backend\Test\Unit\Controller\Adminhtml\Cache; use PHPUnit_Framework_MockObject_MockObject as MockObject; @@ -156,7 +157,7 @@ public function testExecuteInvalidTypeCache() $this->messageManagerMock->expects($this->once()) ->method('addError') - ->with('Specified cache type(s) don\'t exist: someCache') + ->with('These cache type(s) don\'t exist: someCache') ->willReturnSelf(); $this->assertSame($this->redirectMock, $this->controller->execute()); diff --git a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/MassEnableTest.php b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/MassEnableTest.php index ad622ca69757a..9b3640193154a 100644 --- a/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/MassEnableTest.php +++ b/app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/Cache/MassEnableTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Backend\Test\Unit\Controller\Adminhtml\Cache; use PHPUnit_Framework_MockObject_MockObject as MockObject; @@ -156,7 +157,7 @@ public function testExecuteInvalidTypeCache() $this->messageManagerMock->expects($this->once()) ->method('addError') - ->with('Specified cache type(s) don\'t exist: someCache') + ->with('These cache type(s) don\'t exist: someCache') ->willReturnSelf(); $this->assertSame($this->redirectMock, $this->controller->execute()); diff --git a/app/code/Magento/Backend/Test/Unit/Model/AuthTest.php b/app/code/Magento/Backend/Test/Unit/Model/AuthTest.php index 4b79d504dad91..4af060b157ed4 100644 --- a/app/code/Magento/Backend/Test/Unit/Model/AuthTest.php +++ b/app/code/Magento/Backend/Test/Unit/Model/AuthTest.php @@ -54,7 +54,6 @@ protected function setUp() /** * @expectedException \Magento\Framework\Exception\AuthenticationException - * @expectedExceptionMessage You did not sign in correctly or your account is temporarily disabled. */ public function testLoginFailed() { @@ -64,7 +63,10 @@ public function testLoginFailed() ->with(\Magento\Backend\Model\Auth\Credential\StorageInterface::class) ->will($this->returnValue($this->_credentialStorage)); $exceptionMock = new \Magento\Framework\Exception\LocalizedException( - __('You did not sign in correctly or your account is temporarily disabled.') + __( + 'The account sign-in was incorrect or your account is disabled temporarily. ' + . 'Please wait and try again later.' + ) ); $this->_credentialStorage ->expects($this->once()) @@ -74,5 +76,10 @@ public function testLoginFailed() $this->_credentialStorage->expects($this->never())->method('getId'); $this->_eventManagerMock->expects($this->once())->method('dispatch')->with('backend_auth_user_login_failed'); $this->_model->login('username', 'password'); + + $this->expectExceptionMessage( + 'The account sign-in was incorrect or your account is disabled temporarily. ' + . 'Please wait and try again later.' + ); } } diff --git a/app/code/Magento/Backend/Test/Unit/Model/Config/SessionLifetime/BackendModelTest.php b/app/code/Magento/Backend/Test/Unit/Model/Config/SessionLifetime/BackendModelTest.php index 31a13191750a3..92c549c3edfef 100755 --- a/app/code/Magento/Backend/Test/Unit/Model/Config/SessionLifetime/BackendModelTest.php +++ b/app/code/Magento/Backend/Test/Unit/Model/Config/SessionLifetime/BackendModelTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Backend\Test\Unit\Model\Config\SessionLifetime; use Magento\Backend\Model\Config\SessionLifetime\BackendModel; @@ -32,11 +33,12 @@ public function adminSessionLifetimeDataProvider() return [ [ BackendModel::MIN_LIFETIME - 1, - 'Admin session lifetime must be greater than or equal to 60 seconds' + 'The Admin session lifetime is invalid. Set the lifetime to 60 seconds or longer and try again.' ], [ BackendModel::MAX_LIFETIME + 1, - 'Admin session lifetime must be less than or equal to 31536000 seconds (one year)' + 'The Admin session lifetime is invalid. ' + . 'Set the lifetime to 31536000 seconds (one year) or shorter and try again.' ], [ 900 diff --git a/app/code/Magento/Braintree/Controller/Paypal/AbstractAction.php b/app/code/Magento/Braintree/Controller/Paypal/AbstractAction.php index d6a81eefc6fdb..e0ed996019576 100644 --- a/app/code/Magento/Braintree/Controller/Paypal/AbstractAction.php +++ b/app/code/Magento/Braintree/Controller/Paypal/AbstractAction.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Braintree\Controller\Paypal; use Magento\Checkout\Model\Session; @@ -73,7 +74,7 @@ public function dispatch(RequestInterface $request) protected function validateQuote($quote) { if (!$quote || !$quote->getItemsCount()) { - throw new \InvalidArgumentException(__('We can\'t initialize checkout.')); + throw new \InvalidArgumentException(__('Checkout failed to initialize. Verify and try again.')); } } } diff --git a/app/code/Magento/Braintree/Controller/Paypal/Review.php b/app/code/Magento/Braintree/Controller/Paypal/Review.php index 4576e3b033df8..ca252aabe54a9 100644 --- a/app/code/Magento/Braintree/Controller/Paypal/Review.php +++ b/app/code/Magento/Braintree/Controller/Paypal/Review.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Braintree\Controller\Paypal; use Magento\Checkout\Model\Session; @@ -66,7 +67,7 @@ public function execute() $quote ); } elseif (!$quote->getPayment()->getAdditionalInformation(self::$paymentMethodNonce)) { - throw new LocalizedException(__('We can\'t initialize checkout.')); + throw new LocalizedException(__('Checkout failed to initialize. Verify and try again.')); } /** @var \Magento\Framework\View\Result\Page $resultPage */ diff --git a/app/code/Magento/Braintree/Gateway/Command/GetPaymentNonceCommand.php b/app/code/Magento/Braintree/Gateway/Command/GetPaymentNonceCommand.php index 91c9f6c14bb5d..13a1762d5cbeb 100644 --- a/app/code/Magento/Braintree/Gateway/Command/GetPaymentNonceCommand.php +++ b/app/code/Magento/Braintree/Gateway/Command/GetPaymentNonceCommand.php @@ -77,7 +77,7 @@ public function execute(array $commandSubject) $customerId = $this->subjectReader->readCustomerId($commandSubject); $paymentToken = $this->tokenManagement->getByPublicHash($publicHash, $customerId); if (!$paymentToken) { - throw new Exception('No available payment tokens'); + throw new Exception('No payment tokens are available.'); } $data = $this->adapter->createNonce($paymentToken->getGatewayToken()); diff --git a/app/code/Magento/Braintree/Model/Paypal/Helper/OrderPlace.php b/app/code/Magento/Braintree/Model/Paypal/Helper/OrderPlace.php index b833798eabf90..6c4332ef22a4c 100644 --- a/app/code/Magento/Braintree/Model/Paypal/Helper/OrderPlace.php +++ b/app/code/Magento/Braintree/Model/Paypal/Helper/OrderPlace.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Braintree\Model\Paypal\Helper; use Magento\Quote\Model\Quote; @@ -71,7 +72,9 @@ public function __construct( public function execute(Quote $quote, array $agreement) { if (!$this->agreementsValidator->isValid($agreement)) { - throw new LocalizedException(__('Please agree to all the terms and conditions before placing the order.')); + throw new LocalizedException(__( + "The order wasn't placed. First, agree to the terms and conditions, then try placing your order again." + )); } if ($this->getCheckoutMethod($quote) === Onepage::METHOD_GUEST) { diff --git a/app/code/Magento/Braintree/Test/Unit/Controller/Paypal/PlaceOrderTest.php b/app/code/Magento/Braintree/Test/Unit/Controller/Paypal/PlaceOrderTest.php index 5a10b4abb3fbc..4bea03153b93b 100644 --- a/app/code/Magento/Braintree/Test/Unit/Controller/Paypal/PlaceOrderTest.php +++ b/app/code/Magento/Braintree/Test/Unit/Controller/Paypal/PlaceOrderTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Braintree\Test\Unit\Controller\Paypal; use Magento\Braintree\Controller\Paypal\PlaceOrder; @@ -186,7 +187,7 @@ public function testExecuteException() ->method('addExceptionMessage') ->with( self::isInstanceOf('\InvalidArgumentException'), - 'We can\'t initialize checkout.' + 'Checkout failed to initialize. Verify and try again.' ); self::assertEquals($this->placeOrder->execute(), $resultMock); diff --git a/app/code/Magento/Braintree/Test/Unit/Controller/Paypal/ReviewTest.php b/app/code/Magento/Braintree/Test/Unit/Controller/Paypal/ReviewTest.php index cb911a8396b36..609b7f21dbf87 100644 --- a/app/code/Magento/Braintree/Test/Unit/Controller/Paypal/ReviewTest.php +++ b/app/code/Magento/Braintree/Test/Unit/Controller/Paypal/ReviewTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Braintree\Test\Unit\Controller\Paypal; use Magento\Quote\Model\Quote; @@ -188,7 +189,7 @@ public function testExecuteException() ->method('addExceptionMessage') ->with( self::isInstanceOf('\InvalidArgumentException'), - 'We can\'t initialize checkout.' + 'Checkout failed to initialize. Verify and try again.' ); $this->resultFactoryMock->expects(self::once()) @@ -235,7 +236,7 @@ public function testExecuteExceptionPaymentWithoutNonce() ->method('addExceptionMessage') ->with( self::isInstanceOf(\Magento\Framework\Exception\LocalizedException::class), - 'We can\'t initialize checkout.' + 'Checkout failed to initialize. Verify and try again.' ); $this->resultFactoryMock->expects(self::once()) diff --git a/app/code/Magento/Braintree/Test/Unit/Controller/Paypal/SaveShippingMethodTest.php b/app/code/Magento/Braintree/Test/Unit/Controller/Paypal/SaveShippingMethodTest.php index 5be5df0e33c49..32ed698189fa7 100644 --- a/app/code/Magento/Braintree/Test/Unit/Controller/Paypal/SaveShippingMethodTest.php +++ b/app/code/Magento/Braintree/Test/Unit/Controller/Paypal/SaveShippingMethodTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Braintree\Test\Unit\Controller\Paypal; use Magento\Quote\Model\Quote; @@ -225,7 +226,10 @@ public function testExecuteAjaxException() $this->messageManagerMock->expects(self::once()) ->method('addExceptionMessage') - ->with(self::isInstanceOf('\InvalidArgumentException'), 'We can\'t initialize checkout.'); + ->with( + self::isInstanceOf('\InvalidArgumentException'), + 'Checkout failed to initialize. Verify and try again.' + ); $this->urlMock->expects(self::once()) ->method('getUrl') @@ -265,7 +269,10 @@ public function testExecuteException() $this->messageManagerMock->expects(self::once()) ->method('addExceptionMessage') - ->with(self::isInstanceOf('\InvalidArgumentException'), 'We can\'t initialize checkout.'); + ->with( + self::isInstanceOf('\InvalidArgumentException'), + 'Checkout failed to initialize. Verify and try again.' + ); $this->urlMock->expects(self::once()) ->method('getUrl') diff --git a/app/code/Magento/Braintree/Test/Unit/Gateway/Command/GetPaymentNonceCommandTest.php b/app/code/Magento/Braintree/Test/Unit/Gateway/Command/GetPaymentNonceCommandTest.php index 333f29eb29136..6debedf0a0e5f 100644 --- a/app/code/Magento/Braintree/Test/Unit/Gateway/Command/GetPaymentNonceCommandTest.php +++ b/app/code/Magento/Braintree/Test/Unit/Gateway/Command/GetPaymentNonceCommandTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Braintree\Test\Unit\Gateway\Command; use Magento\Braintree\Gateway\Command\GetPaymentNonceCommand; @@ -154,7 +155,7 @@ public function testExecuteWithExceptionForCustomerId() /** * @covers \Magento\Braintree\Gateway\Command\GetPaymentNonceCommand::execute * @expectedException \Exception - * @expectedExceptionMessage No available payment tokens + * @expectedExceptionMessage No payment tokens are available. */ public function testExecuteWithExceptionForTokenManagement() { @@ -169,7 +170,7 @@ public function testExecuteWithExceptionForTokenManagement() ->method('readCustomerId') ->willReturn($customerId); - $exception = new \Exception('No available payment tokens'); + $exception = new \Exception('No payment tokens are available.'); $this->tokenManagement->expects(static::once()) ->method('getByPublicHash') ->willThrowException($exception); diff --git a/app/code/Magento/Bundle/Model/LinkManagement.php b/app/code/Magento/Bundle/Model/LinkManagement.php index 1a533f5d24990..8c85c06c7342d 100644 --- a/app/code/Magento/Bundle/Model/LinkManagement.php +++ b/app/code/Magento/Bundle/Model/LinkManagement.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Bundle\Model; use Magento\Catalog\Api\Data\ProductInterface; @@ -87,7 +88,7 @@ public function getChildren($productSku, $optionId = null) { $product = $this->productRepository->get($productSku, true); if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) { - throw new InputException(__('Only implemented for bundle product')); + throw new InputException(__('This is implemented for bundle products only.')); } $childrenList = []; @@ -125,25 +126,30 @@ public function saveChild( $product = $this->productRepository->get($sku, true); if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) { throw new InputException( - __('Product with specified sku: "%1" is not a bundle product', [$product->getSku()]) + __('The product with the "%1" SKU isn\'t a bundle product.', [$product->getSku()]) ); } /** @var \Magento\Catalog\Model\Product $linkProductModel */ $linkProductModel = $this->productRepository->get($linkedProduct->getSku()); if ($linkProductModel->isComposite()) { - throw new InputException(__('Bundle product could not contain another composite product')); + throw new InputException(__('The bundle product can\'t contain another composite product.')); } if (!$linkedProduct->getId()) { - throw new InputException(__('Id field of product link is required')); + throw new InputException(__('The product link needs an ID field entered. Enter and try again.')); } /** @var \Magento\Bundle\Model\Selection $selectionModel */ $selectionModel = $this->bundleSelection->create(); $selectionModel->load($linkedProduct->getId()); if (!$selectionModel->getId()) { - throw new InputException(__('Can not find product link with id "%1"', [$linkedProduct->getId()])); + throw new InputException( + __( + 'The product link with the "%1" ID field wasn\'t found. Verify the ID and try again.', + [$linkedProduct->getId()] + ) + ); } $linkField = $this->getMetadataPool()->getMetadata(ProductInterface::class)->getLinkField(); $selectionModel = $this->mapProductLinkToSelectionModel( @@ -218,7 +224,7 @@ public function addChild( ) { if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) { throw new InputException( - __('Product with specified sku: "%1" is not a bundle product', $product->getSku()) + __('The product with the "%1" SKU isn\'t a bundle product.', $product->getSku()) ); } @@ -246,7 +252,7 @@ public function addChild( /** @var \Magento\Catalog\Model\Product $linkProductModel */ $linkProductModel = $this->productRepository->get($linkedProduct->getSku()); if ($linkProductModel->isComposite()) { - throw new InputException(__('Bundle product could not contain another composite product')); + throw new InputException(__('The bundle product can\'t contain another composite product.')); } if ($selections) { @@ -295,7 +301,7 @@ public function removeChild($sku, $optionId, $childSku) $product = $this->productRepository->get($sku, true); if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) { - throw new InputException(__('Product with specified sku: %1 is not a bundle product', $sku)); + throw new InputException(__('The product with the "%1" SKU isn\'t a bundle product.', $sku)); } $excludeSelectionIds = []; @@ -314,7 +320,7 @@ public function removeChild($sku, $optionId, $childSku) } if (empty($removeSelectionIds)) { throw new \Magento\Framework\Exception\NoSuchEntityException( - __('Requested bundle option product doesn\'t exist') + __("The bundle product doesn't exist. Review your request and try again.") ); } $linkField = $this->getMetadataPool()->getMetadata(ProductInterface::class)->getLinkField(); diff --git a/app/code/Magento/Bundle/Model/Option/Validator.php b/app/code/Magento/Bundle/Model/Option/Validator.php index 1a82e27114924..3eb574c1751f7 100644 --- a/app/code/Magento/Bundle/Model/Option/Validator.php +++ b/app/code/Magento/Bundle/Model/Option/Validator.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Bundle\Model\Option; use Magento\Framework\Validator\NotEmpty; @@ -51,7 +52,8 @@ protected function validateRequiredFields($value) ]; foreach ($requiredFields as $requiredField => $requiredValue) { if (!$this->notEmpty->isValid(trim($requiredValue))) { - $messages[$requiredField] = __('%fieldName is a required field.', ['fieldName' => $requiredField]); + $messages[$requiredField] = + __('"%fieldName" is required. Enter and try again.', ['fieldName' => $requiredField]); } } $this->_addMessages($messages); diff --git a/app/code/Magento/Bundle/Model/OptionManagement.php b/app/code/Magento/Bundle/Model/OptionManagement.php index dd20487b7f78f..3e8efcc7bbb7b 100644 --- a/app/code/Magento/Bundle/Model/OptionManagement.php +++ b/app/code/Magento/Bundle/Model/OptionManagement.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Bundle\Model; use Magento\Framework\Exception\InputException; @@ -39,7 +40,7 @@ public function save(\Magento\Bundle\Api\Data\OptionInterface $option) { $product = $this->productRepository->get($option->getSku(), true); if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) { - throw new InputException(__('Only implemented for bundle product')); + throw new InputException(__('This is implemented for bundle products only.')); } return $this->optionRepository->save($product, $option); } diff --git a/app/code/Magento/Bundle/Model/OptionRepository.php b/app/code/Magento/Bundle/Model/OptionRepository.php index 9940344b5b61c..b4b3c84b88ef3 100644 --- a/app/code/Magento/Bundle/Model/OptionRepository.php +++ b/app/code/Magento/Bundle/Model/OptionRepository.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Bundle\Model; use Magento\Catalog\Api\Data\ProductInterface; @@ -112,7 +113,9 @@ public function get($sku, $optionId) /** @var \Magento\Bundle\Model\Option $option */ $option = $this->type->getOptionsCollection($product)->getItemById($optionId); if (!$option || !$option->getId()) { - throw new NoSuchEntityException(__('Requested option doesn\'t exist')); + throw new NoSuchEntityException( + __("The option that was requested doesn't exist. Verify the entity and try again.") + ); } $productLinks = $this->linkList->getItems($product, $optionId); @@ -159,7 +162,7 @@ public function delete(\Magento\Bundle\Api\Data\OptionInterface $option) $this->optionResource->delete($option); } catch (\Exception $exception) { throw new \Magento\Framework\Exception\StateException( - __('Cannot delete option with id %1', $option->getOptionId()), + __('The option with "%1" ID can\'t be deleted.', $option->getOptionId()), $exception ); } @@ -208,7 +211,9 @@ public function save( } } else { if (!$existingOption->getOptionId()) { - throw new NoSuchEntityException(__('Requested option doesn\'t exist')); + throw new NoSuchEntityException( + __("The option that was requested doesn't exist. Verify the entity and try again.") + ); } $option->setData(array_merge($existingOption->getData(), $option->getData())); @@ -218,7 +223,7 @@ public function save( try { $this->optionResource->save($option); } catch (\Exception $e) { - throw new CouldNotSaveException(__('Could not save option'), $e); + throw new CouldNotSaveException(__("The option couldn't be saved."), $e); } /** @var \Magento\Bundle\Api\Data\LinkInterface $linkedProduct */ @@ -282,7 +287,7 @@ private function getProduct($sku) { $product = $this->productRepository->get($sku, true); if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) { - throw new InputException(__('Only implemented for bundle product')); + throw new InputException(__('This is implemented for bundle products only.')); } return $product; } diff --git a/app/code/Magento/Bundle/Test/Unit/Model/LinkManagementTest.php b/app/code/Magento/Bundle/Test/Unit/Model/LinkManagementTest.php index d1292146f6662..ccc8c52d5022f 100644 --- a/app/code/Magento/Bundle/Test/Unit/Model/LinkManagementTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Model/LinkManagementTest.php @@ -339,7 +339,7 @@ public function testAddChildNonExistingOption() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Bundle product could not contain another composite product + * @expectedExceptionMessage The bundle product can't contain another composite product. */ public function testAddChildLinkedProductIsComposite() { @@ -797,7 +797,7 @@ public function testSaveChildWithoutId() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Can not find product link with id "12345" + * @expectedExceptionMessage The product link with the "12345" ID field wasn't found. Verify the ID and try again. */ public function testSaveChildWithInvalidId() { diff --git a/app/code/Magento/Bundle/Test/Unit/Model/Option/ValidatorTest.php b/app/code/Magento/Bundle/Test/Unit/Model/Option/ValidatorTest.php index f47c978190a2c..791126a9c1742 100644 --- a/app/code/Magento/Bundle/Test/Unit/Model/Option/ValidatorTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Model/Option/ValidatorTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Bundle\Test\Unit\Model\Option; use Magento\Framework\Validator\NotEmpty; @@ -71,9 +72,17 @@ public function providerIsValid() { return [ ['title', 'select', true, []], - ['title', null, false, ['type' => 'type is a required field.']], - [null, 'select', false, ['title' => 'title is a required field.']], - [null, null, false, ['type' => 'type is a required field.', 'title' => 'title is a required field.']] + ['title', null, false, ['type' => '"type" is required. Enter and try again.']], + [null, 'select', false, ['title' => '"title" is required. Enter and try again.']], + [ + null, + null, + false, + [ + 'type' => '"type" is required. Enter and try again.', + 'title' => '"title" is required. Enter and try again.' + ] + ] ]; } } diff --git a/app/code/Magento/Bundle/Test/Unit/Model/OptionManagementTest.php b/app/code/Magento/Bundle/Test/Unit/Model/OptionManagementTest.php index f0a69bd4fb28b..8e309e48872c7 100644 --- a/app/code/Magento/Bundle/Test/Unit/Model/OptionManagementTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Model/OptionManagementTest.php @@ -67,7 +67,7 @@ public function testSave() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Only implemented for bundle product + * @expectedExceptionMessage This is implemented for bundle products only. */ public function testSaveWithException() { diff --git a/app/code/Magento/Bundle/Test/Unit/Model/OptionRepositoryTest.php b/app/code/Magento/Bundle/Test/Unit/Model/OptionRepositoryTest.php index d438dc2e9b216..7549d402a57ff 100644 --- a/app/code/Magento/Bundle/Test/Unit/Model/OptionRepositoryTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Model/OptionRepositoryTest.php @@ -116,7 +116,7 @@ protected function setUp() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Only implemented for bundle product + * @expectedExceptionMessage This is implemented for bundle products only. */ public function testGetThrowsExceptionIfProductIsSimple() { @@ -134,7 +134,7 @@ public function testGetThrowsExceptionIfProductIsSimple() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Requested option doesn't exist + * @expectedExceptionMessage The option that was requested doesn't exist. Verify the entity and try again. */ public function testGetThrowsExceptionIfOptionDoesNotExist() { @@ -226,7 +226,7 @@ public function testDelete() /** * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Cannot delete option with id 1 + * @expectedExceptionMessage The option with "1" ID can't be deleted. */ public function testDeleteThrowsExceptionIfCannotDelete() { @@ -382,7 +382,7 @@ public function testSaveNewOption() /** * @expectedException \Magento\Framework\Exception\CouldNotSaveException - * @expectedExceptionMessage Could not save option + * @expectedExceptionMessage The option couldn't be saved. */ public function testSaveCanNotSave() { @@ -456,7 +456,7 @@ public function testGetList() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Only implemented for bundle product + * @expectedExceptionMessage This is implemented for bundle products only. */ public function testGetListException() { diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Category/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Save.php index d1ec3be1a8895..6ba0348b45986 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Category/Save.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Save.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Controller\Adminhtml\Category; use Magento\Catalog\Api\Data\CategoryAttributeInterface; @@ -202,7 +203,7 @@ public function execute() if ($error === true) { $attribute = $categoryResource->getAttribute($code)->getFrontend()->getLabel(); throw new \Magento\Framework\Exception\LocalizedException( - __('Attribute "%1" is required.', $attribute) + __('The "%1" attribute is required. Enter and try again.', $attribute) ); } else { throw new \Exception($error); diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/AddAttributeToTemplate.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/AddAttributeToTemplate.php index 174f06c2ea030..bbef1de28e5b6 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/AddAttributeToTemplate.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/AddAttributeToTemplate.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Controller\Adminhtml\Product; use Magento\Catalog\Api\AttributeSetRepositoryInterface; @@ -182,7 +183,7 @@ private function getBasicAttributeSearchCriteriaBuilder() $attributeIds = (array)$this->getRequest()->getParam('attributeIds', []); if (empty($attributeIds['selected'])) { - throw new LocalizedException(__('Please, specify attributes')); + throw new LocalizedException(__('Attributes were missing and must be specified.')); } return $this->getSearchCriteriaBuilder() diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php index 5335837a4d3c4..f0ba9b518fa5e 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php @@ -139,7 +139,9 @@ public function execute() ->setName($name) ->getAttributeSet(); } catch (AlreadyExistsException $alreadyExists) { - $this->messageManager->addErrorMessage(__('An attribute set named \'%1\' already exists.', $name)); + $this->messageManager->addErrorMessage( + __('A "%1" attribute set name already exists. Create a new name and try again.', $name) + ); $this->_session->setAttributeData($data); return $this->returnResult('catalog/*/edit', ['_current' => true], ['error' => true]); } catch (LocalizedException $e) { diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php index 4dd406a5d14db..8e11a57f96d71 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Controller\Adminhtml\Product\Attribute; use Magento\Framework\DataObject; @@ -91,7 +92,9 @@ public function execute() $attributeSet->setEntityTypeId($this->_entityTypeId)->load($setName, 'attribute_set_name'); if ($attributeSet->getId()) { $setName = $this->_objectManager->get(\Magento\Framework\Escaper::class)->escapeHtml($setName); - $this->messageManager->addError(__('An attribute set named \'%1\' already exists.', $setName)); + $this->messageManager->addError( + __('A "%1" attribute set name already exists. Create a new name and try again.', $setName) + ); $layout = $this->layoutFactory->create(); $layout->initMessages(); diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Save.php index d34f4bedd80e4..1481687205ddb 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Save.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Save.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Controller\Adminhtml\Product; use Magento\Backend\App\Action; @@ -103,7 +104,9 @@ public function execute() $this->productTypeManager->processProduct($product); if (isset($data['product'][$product->getIdFieldName()])) { - throw new \Magento\Framework\Exception\LocalizedException(__('Unable to save product')); + throw new \Magento\Framework\Exception\LocalizedException( + __('The product was unable to be saved. Please try again.') + ); } $originalSku = $product->getSku(); diff --git a/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php b/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php index b6653b73aee8d..057933c55e6de 100644 --- a/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php +++ b/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Model\Category\Attribute\Backend; /** @@ -58,7 +59,7 @@ public function validate($object) if (!$this->getAttribute()->getEntity()->checkAttributeUniqueValue($this->getAttribute(), $object)) { $label = $this->getAttribute()->getFrontend()->getLabel(); throw new \Magento\Framework\Exception\LocalizedException( - __('The value of attribute "%1" must be unique.', $label) + __('The value of the "%1" attribute isn\'t unique. Set a unique value and try again.', $label) ); } } diff --git a/app/code/Magento/Catalog/Model/CategoryLinkRepository.php b/app/code/Magento/Catalog/Model/CategoryLinkRepository.php index 6c3d84d5f5eb4..fb0ea680569a8 100644 --- a/app/code/Magento/Catalog/Model/CategoryLinkRepository.php +++ b/app/code/Magento/Catalog/Model/CategoryLinkRepository.php @@ -78,7 +78,7 @@ public function deleteByIds($categoryId, $sku) $productID = $product->getId(); if (!isset($productPositions[$productID])) { - throw new InputException(__('Category does not contain specified product')); + throw new InputException(__("The category doesn't contain the specified product.")); } $backupPosition = $productPositions[$productID]; unset($productPositions[$productID]); diff --git a/app/code/Magento/Catalog/Model/CategoryRepository.php b/app/code/Magento/Catalog/Model/CategoryRepository.php index 505c729ac1001..8cb11c4306d52 100644 --- a/app/code/Magento/Catalog/Model/CategoryRepository.php +++ b/app/code/Magento/Catalog/Model/CategoryRepository.php @@ -197,7 +197,7 @@ protected function validateCategory(Category $category) if ($error === true) { $attribute = $this->categoryResource->getAttribute($code)->getFrontend()->getLabel(); throw new \Magento\Framework\Exception\LocalizedException( - __('Attribute "%1" is required.', $attribute) + __('The "%1" attribute is required. Enter and try again.', $attribute) ); } else { throw new \Magento\Framework\Exception\LocalizedException(__($error)); diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Dynamic/AlgorithmFactory.php b/app/code/Magento/Catalog/Model/Layer/Filter/Dynamic/AlgorithmFactory.php index 6a9c37e06a7e2..b0467c98907da 100644 --- a/app/code/Magento/Catalog/Model/Layer/Filter/Dynamic/AlgorithmFactory.php +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Dynamic/AlgorithmFactory.php @@ -71,7 +71,7 @@ public function create(array $data = []) ); if (!isset($this->algorithms[$calculationType])) { - throw new LocalizedException(__('%1 was not found in algorithms', $calculationType)); + throw new LocalizedException(__("The %1 value wasn't found in the algorithms.", $calculationType)); } $className = $this->algorithms[$calculationType]; diff --git a/app/code/Magento/Catalog/Model/Layer/State.php b/app/code/Magento/Catalog/Model/Layer/State.php index 25f0caddd987b..c404e5539d209 100644 --- a/app/code/Magento/Catalog/Model/Layer/State.php +++ b/app/code/Magento/Catalog/Model/Layer/State.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Model\Layer; use Magento\Catalog\Model\Layer\Filter\Item; @@ -42,7 +43,7 @@ public function addFilter($filter) public function setFilters($filters) { if (!is_array($filters)) { - throw new LocalizedException(__('The filters must be an array.')); + throw new LocalizedException(__('The filters are invalid. Set them in an array and try again.')); } $this->setData('filters', $filters); return $this; diff --git a/app/code/Magento/Catalog/Model/Locator/RegistryLocator.php b/app/code/Magento/Catalog/Model/Locator/RegistryLocator.php index 9770c8b39398c..700fd4b0b8997 100644 --- a/app/code/Magento/Catalog/Model/Locator/RegistryLocator.php +++ b/app/code/Magento/Catalog/Model/Locator/RegistryLocator.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Model\Locator; use Magento\Catalog\Api\Data\ProductInterface; @@ -52,7 +53,7 @@ public function getProduct() return $this->product = $product; } - throw new NotFoundException(__('Product was not registered')); + throw new NotFoundException(__("The product wasn't registered.")); } /** @@ -69,7 +70,7 @@ public function getStore() return $this->store = $store; } - throw new NotFoundException(__('Store was not registered')); + throw new NotFoundException(__("The store wasn't registered. Verify the store and try again.")); } /** diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php index a312f00b26bbb..a652d0ef90213 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php @@ -51,7 +51,7 @@ public function validate($object) $value = $object->getData($attrCode); if ($this->getAttribute()->getIsRequired() && strlen($value) === 0) { throw new \Magento\Framework\Exception\LocalizedException( - __('The value of attribute "%1" must be set', $attrCode) + __('The "%1" attribute value is empty. Set the attribute and try again.', $attrCode) ); } diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/SetManagement.php b/app/code/Magento/Catalog/Model/Product/Attribute/SetManagement.php index fb52e83a51c58..19cb71e4231dd 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/SetManagement.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/SetManagement.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Model\Product\Attribute; use Magento\Framework\Exception\StateException; @@ -65,12 +66,12 @@ protected function validateSkeletonSet($skeletonId) $productEntityId = $this->eavConfig->getEntityType(\Magento\Catalog\Model\Product::ENTITY)->getId(); if ($skeletonSet->getEntityTypeId() != $productEntityId) { throw new StateException( - __('Can not create attribute set based on non product attribute set.') + __("The attribute set couldn't be created because it's based on a non-product attribute set.") ); } } catch (\Magento\Framework\Exception\NoSuchEntityException $exception) { throw new StateException( - __('Can not create attribute set based on not existing attribute set') + __("The attribute set couldn't be created because it's based on a non-existing attribute set.") ); } } diff --git a/app/code/Magento/Catalog/Model/Product/Gallery/GalleryManagement.php b/app/code/Magento/Catalog/Model/Product/Gallery/GalleryManagement.php index 1b5f96baeaf9f..4d274a071d087 100644 --- a/app/code/Magento/Catalog/Model/Product/Gallery/GalleryManagement.php +++ b/app/code/Magento/Catalog/Model/Product/Gallery/GalleryManagement.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Model\Product\Gallery; use Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface; @@ -51,7 +52,7 @@ public function create($sku, ProductAttributeMediaGalleryEntryInterface $entry) $entryContent = $entry->getContent(); if (!$this->contentValidator->isValid($entryContent)) { - throw new InputException(__('The image content is not valid.')); + throw new InputException(__('The image content is invalid. Verify the content and try again.')); } $product = $this->productRepository->get($sku); @@ -71,7 +72,7 @@ public function create($sku, ProductAttributeMediaGalleryEntryInterface $entry) } catch (InputException $inputException) { throw $inputException; } catch (\Exception $e) { - throw new StateException(__('Cannot save product.')); + throw new StateException(__("The product can't be saved.")); } foreach ($product->getMediaGalleryEntries() as $entry) { @@ -79,7 +80,7 @@ public function create($sku, ProductAttributeMediaGalleryEntryInterface $entry) return $entry->getId(); } } - throw new StateException(__('Failed to save new media gallery entry.')); + throw new StateException(__('The new media gallery entry failed to save.')); } /** @@ -90,7 +91,9 @@ public function update($sku, ProductAttributeMediaGalleryEntryInterface $entry) $product = $this->productRepository->get($sku); $existingMediaGalleryEntries = $product->getMediaGalleryEntries(); if ($existingMediaGalleryEntries == null) { - throw new NoSuchEntityException(__('There is no image with provided ID.')); + throw new NoSuchEntityException( + __('No image with the provided ID was found. Verify the ID and try again.') + ); } $found = false; foreach ($existingMediaGalleryEntries as $key => $existingEntry) { @@ -107,14 +110,16 @@ public function update($sku, ProductAttributeMediaGalleryEntryInterface $entry) } } if (!$found) { - throw new NoSuchEntityException(__('There is no image with provided ID.')); + throw new NoSuchEntityException( + __('No image with the provided ID was found. Verify the ID and try again.') + ); } $product->setMediaGalleryEntries($existingMediaGalleryEntries); try { $this->productRepository->save($product); } catch (\Exception $exception) { - throw new StateException(__('Cannot save product.')); + throw new StateException(__("The product can't be saved.")); } return true; } @@ -127,7 +132,9 @@ public function remove($sku, $entryId) $product = $this->productRepository->get($sku); $existingMediaGalleryEntries = $product->getMediaGalleryEntries(); if ($existingMediaGalleryEntries == null) { - throw new NoSuchEntityException(__('There is no image with provided ID.')); + throw new NoSuchEntityException( + __('No image with the provided ID was found. Verify the ID and try again.') + ); } $found = false; foreach ($existingMediaGalleryEntries as $key => $entry) { @@ -138,7 +145,9 @@ public function remove($sku, $entryId) } } if (!$found) { - throw new NoSuchEntityException(__('There is no image with provided ID.')); + throw new NoSuchEntityException( + __('No image with the provided ID was found. Verify the ID and try again.') + ); } $product->setMediaGalleryEntries($existingMediaGalleryEntries); $this->productRepository->save($product); @@ -153,7 +162,7 @@ public function get($sku, $entryId) try { $product = $this->productRepository->get($sku); } catch (\Exception $exception) { - throw new NoSuchEntityException(__('Such product doesn\'t exist')); + throw new NoSuchEntityException(__("The product doesn't exist. Verify and try again.")); } $mediaGalleryEntries = $product->getMediaGalleryEntries(); @@ -163,7 +172,7 @@ public function get($sku, $entryId) } } - throw new NoSuchEntityException(__('Such image doesn\'t exist')); + throw new NoSuchEntityException(__("The image doesn't exist. Verify and try again.")); } /** diff --git a/app/code/Magento/Catalog/Model/Product/Gallery/Processor.php b/app/code/Magento/Catalog/Model/Product/Gallery/Processor.php index 73d0f1fa6795b..c6c7fbda7e9ec 100644 --- a/app/code/Magento/Catalog/Model/Product/Gallery/Processor.php +++ b/app/code/Magento/Catalog/Model/Product/Gallery/Processor.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Model\Product\Gallery; use Magento\Framework\App\Filesystem\DirectoryList; @@ -108,7 +109,9 @@ public function validate($object) if ($this->getAttribute()->getIsUnique()) { if (!$this->getAttribute()->getEntity()->checkAttributeUniqueValue($this->getAttribute(), $object)) { $label = $this->getAttribute()->getFrontend()->getLabel(); - throw new LocalizedException(__('The value of attribute "%1" must be unique.', $label)); + throw new LocalizedException( + __('The value of the "%1" attribute isn\'t unique. Set a unique value and try again.', $label) + ); } } @@ -139,13 +142,15 @@ public function addImage( ) { $file = $this->mediaDirectory->getRelativePath($file); if (!$this->mediaDirectory->isFile($file)) { - throw new LocalizedException(__('The image does not exist.')); + throw new LocalizedException(__("The image doesn't exist.")); } $pathinfo = pathinfo($file); $imgExtensions = ['jpg', 'jpeg', 'gif', 'png']; if (!isset($pathinfo['extension']) || !in_array(strtolower($pathinfo['extension']), $imgExtensions)) { - throw new LocalizedException(__('Please correct the image file type.')); + throw new LocalizedException( + __('The image type for the file is invalid. Enter the correct image type and try again.') + ); } $fileName = \Magento\MediaStorage\Model\File\Uploader::getCorrectFileName($pathinfo['basename']); @@ -170,7 +175,7 @@ public function addImage( $storageHelper->saveFile($this->mediaConfig->getTmpMediaShortUrl($fileName)); } } catch (\Exception $e) { - throw new LocalizedException(__('We couldn\'t move this file: %1.', $e->getMessage())); + throw new LocalizedException(__('The "%1" file couldn\'t be moved.', $e->getMessage())); } $fileName = str_replace('\\', '/', $fileName); diff --git a/app/code/Magento/Catalog/Model/Product/Option/Repository.php b/app/code/Magento/Catalog/Model/Product/Option/Repository.php index c2d7781b37ad8..9dc9695daffd1 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Repository.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Repository.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Model\Product\Option; use Magento\Catalog\Api\Data\ProductInterface; @@ -147,7 +148,7 @@ public function save(\Magento\Catalog\Api\Data\ProductCustomOptionInterface $opt { $productSku = $option->getProductSku(); if (!$productSku) { - throw new CouldNotSaveException(__('ProductSku should be specified')); + throw new CouldNotSaveException(__('The ProductSku is empty. Set the ProductSku and try again.')); } /** @var \Magento\Catalog\Model\Product $product */ $product = $this->productRepository->get($productSku); @@ -200,7 +201,7 @@ public function deleteByIdentifier($sku, $optionId) $this->productRepository->save($product); } } catch (\Exception $e) { - throw new CouldNotSaveException(__('Could not remove custom option')); + throw new CouldNotSaveException(__("The custom option couldn't be removed.")); } return true; } diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/Date.php b/app/code/Magento/Catalog/Model/Product/Option/Type/Date.php index cb6e76aebaadb..7517459da650f 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Date.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Date.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Model\Product\Option\Type; use Magento\Catalog\Api\Data\ProductCustomOptionInterface; @@ -122,7 +123,10 @@ public function validateUserValue($values) ); } else { throw new \Magento\Framework\Exception\LocalizedException( - __('Please specify product\'s required option(s).') + __( + "The product's required option(s) weren't entered. " + . "Make sure the options are entered and try again." + ) ); } } else { diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php b/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php index 6b1b42b305bf9..51480e849d9f3 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php @@ -212,7 +212,9 @@ public function validateUserValue($values) $option = $this->getOption(); if (!isset($values[$option->getId()]) && $option->getIsRequire() && !$this->getSkipCheckRequiredOption()) { - throw new LocalizedException(__('Please specify product\'s required option(s).')); + throw new LocalizedException( + __("The product's required option(s) weren't entered. Make sure the options are entered and try again.") + ); } elseif (isset($values[$option->getId()])) { $this->setUserValue($values[$option->getId()]); $this->setIsValid(true); diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php index a7304c9b67bb2..aecb8525915d7 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Model\Product\Option\Type; use Magento\Framework\App\Filesystem\DirectoryList; @@ -255,7 +256,12 @@ public function validateUserValue($values) } catch (ProductException $e) { switch ($this->getProcessMode()) { case \Magento\Catalog\Model\Product\Type\AbstractType::PROCESS_MODE_FULL: - throw new LocalizedException(__('Please specify product\'s required option(s).')); + throw new LocalizedException( + __( + "The product's required option(s) weren't entered. " + . "Make sure the options are entered and try again." + ) + ); break; default: $this->setUserValue(null); @@ -367,7 +373,7 @@ protected function _getOptionHtml($optionValue) $sizes ); } catch (\Exception $e) { - throw new LocalizedException(__('The file options format is not valid.')); + throw new LocalizedException(__('The file options format is invalid. Use a correct format and try again.')); } } diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/File/Validator.php b/app/code/Magento/Catalog/Model/Product/Option/Type/File/Validator.php index 2c4b76d637d53..860010c3db08c 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/File/Validator.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File/Validator.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Model\Product\Option\Type\File; use Magento\Framework\App\Filesystem\DirectoryList; @@ -102,7 +103,7 @@ protected function getValidatorErrors($errors, $fileInfo, $option) break; case \Zend_Validate_File_ImageSize::NOT_DETECTED: $result[] = __( - "The file '%1' is empty. Please choose another one", + 'The file "%1" is empty. Select another file and try again.', $fileInfo['title'] ); break; diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php b/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php index b54c66d75a058..d6a5cb1cbc29d 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php @@ -115,7 +115,10 @@ public function validate($processingParams, $option) $runValidation = $option->getIsRequire() || $upload->isUploaded($file); if (!$runValidation) { throw new \Magento\Framework\Validator\Exception( - __('Validation failed. Required options were not filled or the file was not uploaded.') + __( + 'The validation failed. ' + . 'Make sure the required options are entered and the file is uploaded, then try again.' + ) ); } @@ -128,10 +131,14 @@ public function validate($processingParams, $option) if ($this->validateContentLength()) { $value = $this->fileSize->getMaxFileSizeInMb(); throw new LocalizedException( - __('The file you uploaded is larger than %1 Megabytes allowed by server', $value) + __( + "The file was too big and couldn't be uploaded. " + . "Use a file smaller than %1 MBs and try to upload again.", + $value + ) ); } else { - throw new ProductException(__('Option required.')); + throw new ProductException(__("The required option wasn't entered. Enter the option and try again.")); } } @@ -182,7 +189,7 @@ public function validate($processingParams, $option) $imageSize = getimagesize($fileInfo['tmp_name']); } } else { - throw new LocalizedException(__('The file is empty. Please choose another one')); + throw new LocalizedException(__('The file is empty. Select another file and try again.')); } if (!empty($imageSize)) { @@ -209,7 +216,9 @@ public function validate($processingParams, $option) throw new LocalizedException(__(implode("\n", $errors))); } } else { - throw new LocalizedException(__('Please specify product\'s required option(s).')); + throw new LocalizedException( + __("The product's required option(s) weren't entered. Make sure the options are entered and try again.") + ); } return $userValue; } diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorInfo.php b/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorInfo.php index 30c3de932c3e6..37e4c7b310a81 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorInfo.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorInfo.php @@ -102,7 +102,7 @@ public function validate($optionValue, $option) } } else { throw new \Magento\Framework\Exception\LocalizedException( - __('Please specify product\'s required option(s).') + __("The product's required option(s) weren't entered. Make sure the options are entered and try again.") ); } return $result; diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php b/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php index 78cce7bd76163..08e1a3e327d2f 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Model\Product\Option\Type; use Magento\Framework\Exception\LocalizedException; @@ -64,13 +65,20 @@ public function validateUserValue($values) if (empty($value) && $option->getIsRequire() && !$this->getSkipCheckRequiredOption()) { $this->setIsValid(false); - throw new LocalizedException(__('Please specify product\'s required option(s).')); + throw new LocalizedException( + __("The product's required option(s) weren't entered. Make sure the options are entered and try again.") + ); } if (!$this->_isSingleSelection()) { $valuesCollection = $option->getOptionValuesByOptionId($value, $this->getProduct()->getStoreId())->load(); if ($valuesCollection->count() != count($value)) { $this->setIsValid(false); - throw new LocalizedException(__('Please specify product\'s required option(s).')); + throw new LocalizedException( + __( + "The product's required option(s) weren't entered. " + . "Make sure the options are entered and try again." + ) + ); } } return $this; diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php b/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php index 79ee37c51671d..fd0eae188fea9 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Model\Product\Option\Type; use Magento\Framework\Exception\LocalizedException; @@ -60,14 +61,16 @@ public function validateUserValue($values) // Check requires option to have some value if (strlen($value) == 0 && $option->getIsRequire() && !$this->getSkipCheckRequiredOption()) { $this->setIsValid(false); - throw new LocalizedException(__('Please specify product\'s required option(s).')); + throw new LocalizedException( + __("The product's required option(s) weren't entered. Make sure the options are entered and try again.") + ); } // Check maximal length limit $maxCharacters = $option->getMaxCharacters(); if ($maxCharacters > 0 && $this->string->strlen($value) > $maxCharacters) { $this->setIsValid(false); - throw new LocalizedException(__('The text is too long.')); + throw new LocalizedException(__('The text is too long. Shorten the text and try again.')); } $this->setUserValue($value); diff --git a/app/code/Magento/Catalog/Model/Product/Price/SpecialPriceStorage.php b/app/code/Magento/Catalog/Model/Product/Price/SpecialPriceStorage.php index 8f1e64e1b7a3a..83a2d1340794c 100644 --- a/app/code/Magento/Catalog/Model/Product/Price/SpecialPriceStorage.php +++ b/app/code/Magento/Catalog/Model/Product/Price/SpecialPriceStorage.php @@ -143,7 +143,7 @@ private function retrieveValidPrices(array $prices) $this->validationResult->addFailedItem( $key, __( - 'Requested product doesn\'t exist. ' + 'The product that was requested doesn\'t exist. Verify the product and try again. ' . 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.', [ 'SKU' => $price->getSku(), diff --git a/app/code/Magento/Catalog/Model/Product/PriceModifier.php b/app/code/Magento/Catalog/Model/Product/PriceModifier.php index 4d81000501cff..48d53b4614527 100644 --- a/app/code/Magento/Catalog/Model/Product/PriceModifier.php +++ b/app/code/Magento/Catalog/Model/Product/PriceModifier.php @@ -40,7 +40,7 @@ public function removeTierPrice(\Magento\Catalog\Model\Product $product, $custom $prices = $product->getData('tier_price'); // verify if price exist if ($prices === null) { - throw new NoSuchEntityException(__('This product doesn\'t have tier price')); + throw new NoSuchEntityException(__('Tier price is unavailable for this product.')); } $tierPricesQty = count($prices); @@ -69,7 +69,7 @@ public function removeTierPrice(\Magento\Catalog\Model\Product $product, $custom try { $this->productRepository->save($product); } catch (\Exception $exception) { - throw new CouldNotSaveException(__('Invalid data provided for tier_price')); + throw new CouldNotSaveException(__('The tier_price data is invalid. Verify the data and try again.')); } } } diff --git a/app/code/Magento/Catalog/Model/Product/ScopedTierPriceManagement.php b/app/code/Magento/Catalog/Model/Product/ScopedTierPriceManagement.php index 9e2a79c05fee1..ca5b8038b327d 100644 --- a/app/code/Magento/Catalog/Model/Product/ScopedTierPriceManagement.php +++ b/app/code/Magento/Catalog/Model/Product/ScopedTierPriceManagement.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Model\Product; use Magento\Catalog\Api\Data\ProductTierPriceInterface; @@ -69,7 +70,7 @@ public function add($sku, ProductTierPriceInterface $tierPrice) try { $this->productRepository->save($product); } catch (\Exception $e) { - throw new \Magento\Framework\Exception\CouldNotSaveException(__('Could not save group price')); + throw new \Magento\Framework\Exception\CouldNotSaveException(__("The group price couldn't be saved.")); } return true; } @@ -126,7 +127,9 @@ private function validate(ProductTierPriceInterface $tierPrice) $data = ['qty' => $tierPrice->getQty(), 'price' => $tierPrice->getValue()]; foreach ($data as $value) { if (!is_float($value) || $value <= 0) { - throw new \Magento\Framework\Exception\InputException(__('Please provide valid data')); + throw new \Magento\Framework\Exception\InputException( + __('The data was invalid. Verify the data and try again.') + ); } } } diff --git a/app/code/Magento/Catalog/Model/Product/TierPriceManagement.php b/app/code/Magento/Catalog/Model/Product/TierPriceManagement.php index 7cecd2f37bb84..822959bfc8519 100644 --- a/app/code/Magento/Catalog/Model/Product/TierPriceManagement.php +++ b/app/code/Magento/Catalog/Model/Product/TierPriceManagement.php @@ -89,7 +89,7 @@ public function __construct( public function add($sku, $customerGroupId, $price, $qty) { if (!\Zend_Validate::is($price, 'Float') || $price <= 0 || !\Zend_Validate::is($qty, 'Float') || $qty <= 0) { - throw new InputException(__('Please provide valid data')); + throw new InputException(__('The data was invalid. Verify the data and try again.')); } $product = $this->productRepository->get($sku, ['edit_mode' => true]); $tierPrices = $product->getData('tier_price'); @@ -132,7 +132,7 @@ public function add($sku, $customerGroupId, $price, $qty) if (is_array($errors) && count($errors)) { $errorAttributeCodes = implode(', ', array_keys($errors)); throw new InputException( - __('Values of following attributes are invalid: %1', $errorAttributeCodes) + __('Values in the %1 attributes are invalid. Verify the values and try again.', $errorAttributeCodes) ); } try { @@ -142,7 +142,7 @@ public function add($sku, $customerGroupId, $price, $qty) // temporary state exception must be already localized throw $e; } - throw new CouldNotSaveException(__('Could not save group price')); + throw new CouldNotSaveException(__("The group price couldn't be saved.")); } return true; } diff --git a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php index 33ff3ecccd4dd..0ab1fbab471e6 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php +++ b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Model\Product\Type; use Magento\Catalog\Api\ProductRepositoryInterface; @@ -506,7 +507,7 @@ public function processFileQueue() $rootDir->create($rootDir->getRelativePath($path)); } catch (\Magento\Framework\Exception\FileSystemException $e) { throw new \Magento\Framework\Exception\LocalizedException( - __('We can\'t create writeable directory "%1".', $path) + __('We can\'t create the "%1" writeable directory.', $path) ); } @@ -519,7 +520,9 @@ public function processFileQueue() if (isset($queueOptions['option'])) { $queueOptions['option']->setIsValid(false); } - throw new \Magento\Framework\Exception\LocalizedException(__('The file upload failed.')); + throw new \Magento\Framework\Exception\LocalizedException( + __('The file upload failed. Try to upload again.') + ); } $this->_fileStorageDb->saveFile($dst); break; @@ -535,7 +538,7 @@ public function processFileQueue() /** * Add file to File Queue - * @param array $queueOptions Array of File Queue + * @param array $queueOptions Array of File Queue * (eg. ['operation'=>'move', * 'src_name'=>'filename', * 'dst_name'=>'filename2']) @@ -564,7 +567,7 @@ protected function _isStrictProcessMode($processMode) */ public function getSpecifyOptionMessage() { - return __('Please specify product\'s required option(s).'); + return __("The product's required option(s) weren't entered. Make sure the options are entered and try again."); } /** @@ -635,7 +638,7 @@ public function checkProductBuyState($product) if (!$customOption || strlen($customOption->getValue()) == 0) { $product->setSkipCheckRequiredOption(true); throw new \Magento\Framework\Exception\LocalizedException( - __('The product has required options.') + __('The product has required options. Enter the options and try again.') ); } } @@ -974,7 +977,7 @@ public function setConfig($config) } if (isset($config['can_use_qty_decimals'])) { - $this->_canUseQtyDecimals = (bool) $config['can_use_qty_decimals']; + $this->_canUseQtyDecimals = (bool)$config['can_use_qty_decimals']; } return $this; diff --git a/app/code/Magento/Catalog/Model/ProductAttributeGroupRepository.php b/app/code/Magento/Catalog/Model/ProductAttributeGroupRepository.php index ad1ea248916fb..f43ff45b93efa 100644 --- a/app/code/Magento/Catalog/Model/ProductAttributeGroupRepository.php +++ b/app/code/Magento/Catalog/Model/ProductAttributeGroupRepository.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Model; use Magento\Framework\Exception\NoSuchEntityException; @@ -66,7 +67,9 @@ public function get($groupId) $group = $this->groupFactory->create(); $this->groupResource->load($group, $groupId); if (!$group->getId()) { - throw new NoSuchEntityException(__('Group with id "%1" does not exist.', $groupId)); + throw new NoSuchEntityException( + __('The group with the "%1" ID doesn\'t exist. Verify the ID and try again.', $groupId) + ); } return $group; } @@ -90,7 +93,7 @@ public function delete(\Magento\Eav\Api\Data\AttributeGroupInterface $group) /** @var \Magento\Catalog\Model\Product\Attribute\Group $group */ if ($group->hasSystemAttributes()) { throw new StateException( - __('Attribute group that contains system attributes can not be deleted') + __("The attribute group can't be deleted because it contains system attributes.") ); } return $this->groupRepository->delete($group); diff --git a/app/code/Magento/Catalog/Model/ProductLink/CollectionProvider.php b/app/code/Magento/Catalog/Model/ProductLink/CollectionProvider.php index b635d854c9e2b..bc212adae2c32 100644 --- a/app/code/Magento/Catalog/Model/ProductLink/CollectionProvider.php +++ b/app/code/Magento/Catalog/Model/ProductLink/CollectionProvider.php @@ -42,7 +42,7 @@ public function __construct(ConverterPool $converterPool, array $providers = []) public function getCollection(\Magento\Catalog\Model\Product $product, $type) { if (!isset($this->providers[$type])) { - throw new NoSuchEntityException(__('Collection provider is not registered')); + throw new NoSuchEntityException(__("The collection provider isn't registered.")); } $products = $this->providers[$type]->getLinkedProducts($product); diff --git a/app/code/Magento/Catalog/Model/ProductLink/Management.php b/app/code/Magento/Catalog/Model/ProductLink/Management.php index 18950b74eca65..066549274b07c 100644 --- a/app/code/Magento/Catalog/Model/ProductLink/Management.php +++ b/app/code/Magento/Catalog/Model/ProductLink/Management.php @@ -45,7 +45,9 @@ public function getLinkedItemsByType($sku, $type) $linkTypes = $this->linkTypeProvider->getLinkTypes(); if (!isset($linkTypes[$type])) { - throw new NoSuchEntityException(__('Unknown link type: %1', (string)$type)); + throw new NoSuchEntityException( + __('The "%1" link type is unknown. Verify the type and try again.', (string)$type) + ); } $product = $this->productRepository->get($sku); $links = $product->getProductLinks(); @@ -76,7 +78,7 @@ public function setProductLinks($sku, array $items) } if (!isset($linkTypes[$type])) { throw new NoSuchEntityException( - __('Provided link type "%1" does not exist', $type) + __('The "%1" link type wasn\'t found. Verify the type and try again.', $type) ); } } @@ -101,7 +103,7 @@ public function setProductLinks($sku, array $items) try { $this->productRepository->save($product); } catch (\Exception $exception) { - throw new CouldNotSaveException(__('Invalid data provided for linked products')); + throw new CouldNotSaveException(__('The linked products data is invalid. Verify the data and try again.')); } return true; diff --git a/app/code/Magento/Catalog/Model/ProductLink/Repository.php b/app/code/Magento/Catalog/Model/ProductLink/Repository.php index f8dee9216ddcf..5bac99dbebbb4 100644 --- a/app/code/Magento/Catalog/Model/ProductLink/Repository.php +++ b/app/code/Magento/Catalog/Model/ProductLink/Repository.php @@ -137,7 +137,7 @@ public function save(\Magento\Catalog\Api\Data\ProductLinkInterface $entity) $linkTypesToId[$entity->getLinkType()] ); } catch (\Exception $exception) { - throw new CouldNotSaveException(__('Invalid data provided for linked products')); + throw new CouldNotSaveException(__('The linked products data is invalid. Verify the data and try again.')); } return true; } @@ -212,7 +212,7 @@ public function delete(\Magento\Catalog\Api\Data\ProductLinkInterface $entity) try { $this->getLinkResource()->deleteProductLink($linkId); } catch (\Exception $exception) { - throw new CouldNotSaveException(__('Invalid data provided for linked products')); + throw new CouldNotSaveException(__('The linked products data is invalid. Verify the data and try again.')); } return true; } diff --git a/app/code/Magento/Catalog/Model/ProductRepository.php b/app/code/Magento/Catalog/Model/ProductRepository.php index e814dc03cf37f..e3329832e134a 100644 --- a/app/code/Magento/Catalog/Model/ProductRepository.php +++ b/app/code/Magento/Catalog/Model/ProductRepository.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Model; use Magento\Catalog\Api\Data\ProductInterface; @@ -237,7 +238,9 @@ public function get($sku, $editMode = false, $storeId = null, $forceReload = fal $productId = $this->resourceModel->getIdBySku($sku); if (!$productId) { - throw new NoSuchEntityException(__('Requested product doesn\'t exist')); + throw new NoSuchEntityException( + __("The product that was requested doesn't exist. Verify the product and try again.") + ); } if ($editMode) { $product->setData('_edit_mode', true); @@ -270,7 +273,9 @@ public function getById($productId, $editMode = false, $storeId = null, $forceRe } $product->load($productId); if (!$product->getId()) { - throw new NoSuchEntityException(__('Requested product doesn\'t exist')); + throw new NoSuchEntityException( + __("The product that was requested doesn't exist. Verify the product and try again.") + ); } $this->cacheProduct($cacheKey, $product); } @@ -393,7 +398,9 @@ protected function processNewMediaGalleryEntry( $tmpFilePath = $mediaConfig->getTmpMediaShortUrl($relativeFilePath); if (!$product->hasGalleryAttribute()) { - throw new StateException(__('Requested product does not support images.')); + throw new StateException( + __("The product that was requested doesn't exist. Verify the product and try again.") + ); } $imageFileUri = $this->getMediaGalleryProcessor()->addImage( @@ -460,7 +467,7 @@ private function processLinks(\Magento\Catalog\Api\Data\ProductInterface $produc $linkedSku = $link->getLinkedProductSku(); if (!isset($linkedProductIds[$linkedSku])) { throw new NoSuchEntityException( - __('Product with SKU "%1" does not exist', $linkedSku) + __('The Product with the "%1" SKU doesn\'t exist.', $linkedSku) ); } $linkDataArray['product_id'] = $linkedProductIds[$linkedSku]; @@ -532,7 +539,7 @@ protected function processMediaGallery(ProductInterface $product, $mediaGalleryE foreach ($newEntries as $newEntry) { if (!isset($newEntry['content'])) { - throw new InputException(__('The image content is not valid.')); + throw new InputException(__('The image content is invalid. Verify the content and try again.')); } /** @var ImageContentInterface $contentDataObject */ $contentDataObject = $this->contentFactory->create() @@ -638,7 +645,10 @@ public function save(\Magento\Catalog\Api\Data\ProductInterface $product, $saveO } catch (LocalizedException $e) { throw $e; } catch (\Exception $e) { - throw new \Magento\Framework\Exception\CouldNotSaveException(__('Unable to save product'), $e); + throw new \Magento\Framework\Exception\CouldNotSaveException( + __('The product was unable to be saved. Please try again.'), + $e + ); } unset($this->instances[$product->getSku()]); unset($this->instancesById[$product->getId()]); @@ -660,7 +670,7 @@ public function delete(\Magento\Catalog\Api\Data\ProductInterface $product) throw new CouldNotSaveException(__($e->getMessage())); } catch (\Exception $e) { throw new \Magento\Framework\Exception\StateException( - __('Unable to remove product %1', $sku) + __('The "%1" product couldn\'t be removed.', $sku) ); } unset($this->instances[$sku]); diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/DeleteHandler.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/DeleteHandler.php index 1204c66b956f2..024c87c9fc886 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/DeleteHandler.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/DeleteHandler.php @@ -93,7 +93,9 @@ public function execute($entityType, $entity) try { $this->linkResource->deleteProductLink($linkId); } catch (\Exception $exception) { - throw new CouldNotDeleteException(__('Invalid data provided for linked products')); + throw new CouldNotDeleteException( + __('The linked products data is invalid. Verify the data and try again.') + ); } } } diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/SaveHandler.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/SaveHandler.php index d1372feb77796..c40872ed64bed 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/SaveHandler.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/SaveHandler.php @@ -105,7 +105,7 @@ public function execute($entityType, $entity) $linkTypesToId[$entity->getLinkType()] ); } catch (\Exception $exception) { - throw new CouldNotSaveException(__('Invalid data provided for linked products')); + throw new CouldNotSaveException(__('The linked products data is invalid. Verify the data and try again.')); } return $entity; } diff --git a/app/code/Magento/Catalog/Test/Unit/Model/CategoryLinkRepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/CategoryLinkRepositoryTest.php index 6c8951c3ca672..b42262f1f0384 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/CategoryLinkRepositoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/CategoryLinkRepositoryTest.php @@ -145,7 +145,7 @@ public function testDeleteByIdsWithCouldNotSaveException() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Category does not contain specified product + * @expectedExceptionMessage The category doesn't contain the specified product. */ public function testDeleteWithInputException() { diff --git a/app/code/Magento/Catalog/Test/Unit/Model/CollectionProviderTest.php b/app/code/Magento/Catalog/Test/Unit/Model/CollectionProviderTest.php index 9df0a6bc1eac0..d8931cbbfcf73 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/CollectionProviderTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/CollectionProviderTest.php @@ -101,7 +101,7 @@ public function testGetCollection() * Test exception when collection provider is not configured for product link type. * * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Collection provider is not registered + * @expectedExceptionMessage The collection provider isn't registered. */ public function testGetCollectionWithMissingProviders() { diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Locator/RegistryLocatorTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Locator/RegistryLocatorTest.php index fceb29295b6e1..b2810ddea2413 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Locator/RegistryLocatorTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Locator/RegistryLocatorTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Test\Unit\Model\Locator; use Magento\Catalog\Api\Data\ProductInterface; @@ -83,7 +84,7 @@ public function testGetStore() /** * @expectedException \Magento\Framework\Exception\NotFoundException - * @expectedExceptionMessage Product was not registered + * @expectedExceptionMessage The product wasn't registered. */ public function testGetProductWithException() { @@ -92,7 +93,7 @@ public function testGetProductWithException() /** * @expectedException \Magento\Framework\Exception\NotFoundException - * @expectedExceptionMessage Store was not registered + * @expectedExceptionMessage The store wasn't registered. Verify the store and try again. */ public function testGetStoreWithException() { diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/RepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/RepositoryTest.php index 03bac570c36ad..3cc6f94d58c29 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/RepositoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/RepositoryTest.php @@ -207,7 +207,7 @@ public function testSaveNoSuchEntityException() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage frontend_label is a required field. + * @expectedExceptionMessage "frontend_label" is required. Enter and try again. */ public function testSaveInputExceptionRequiredField() { diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/SetManagementTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/SetManagementTest.php index 57168f2c1270c..1f4c4dd378206 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/SetManagementTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/SetManagementTest.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Test\Unit\Model\Product\Attribute; class SetManagementTest extends \PHPUnit\Framework\TestCase @@ -71,7 +72,6 @@ public function testCreate() /** * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Can not create attribute set based on non product attribute set. */ public function testCreateNonProductAttributeSet() { @@ -91,5 +91,9 @@ public function testCreateNonProductAttributeSet() ->willReturn($typeMock); $skeletonSetMock->expects($this->once())->method('getEntityTypeId')->willReturn(3); $this->model->create($attributeSetMock, $skeletonId); + + $this->expectExceptionMessage( + "The attribute set couldn't be created because it's based on a non-product attribute set." + ); } } diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Gallery/GalleryManagementTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Gallery/GalleryManagementTest.php index cf49d10416d82..9fafbc9d9675b 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Gallery/GalleryManagementTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Gallery/GalleryManagementTest.php @@ -65,7 +65,7 @@ protected function setUp() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage The image content is not valid. + * @expectedExceptionMessage The image content is invalid. Verify the content and try again. */ public function testCreateWithInvalidImageException() { @@ -82,7 +82,7 @@ public function testCreateWithInvalidImageException() /** * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Cannot save product. + * @expectedExceptionMessage The product can't be saved. */ public function testCreateWithCannotSaveException() { @@ -136,7 +136,7 @@ public function testCreate() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage There is no image with provided ID. + * @expectedExceptionMessage No image with the provided ID was found. Verify the ID and try again. */ public function testUpdateWithNonExistingImage() { @@ -157,7 +157,7 @@ public function testUpdateWithNonExistingImage() /** * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Cannot save product. + * @expectedExceptionMessage The product can't be saved. */ public function testUpdateWithCannotSaveException() { @@ -216,7 +216,7 @@ public function testUpdate() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage There is no image with provided ID. + * @expectedExceptionMessage No image with the provided ID was found. Verify the ID and try again. */ public function testRemoveWithNonExistingImage() { @@ -253,7 +253,7 @@ public function testRemove() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Such product doesn't exist + * @expectedExceptionMessage The product doesn't exist. Verify and try again. */ public function testGetWithNonExistingProduct() { @@ -266,7 +266,7 @@ public function testGetWithNonExistingProduct() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionText Such image doesn't exist + * @expectedExceptionText The image doesn't exist. Verify and try again. */ public function testGetWithNonExistingImage() { diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Option/RepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Option/RepositoryTest.php index ec6aa9d8db83a..fd7283903869d 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Option/RepositoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Option/RepositoryTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Test\Unit\Model\Product\Option; use \Magento\Catalog\Model\Product\Option\Repository; @@ -199,7 +200,7 @@ public function testDeleteByIdentifierWhenCannotRemoveOption() /** * @expectedException \Magento\Framework\Exception\CouldNotSaveException - * @expectedExceptionMessage ProductSku should be specified + * @expectedExceptionMessage The ProductSku is empty. Set the ProductSku and try again. */ public function testSaveCouldNotSaveException() { diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Price/SpecialPriceStorageTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Price/SpecialPriceStorageTest.php index c2337d1abdb6a..e2bd4e9c10b97 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Price/SpecialPriceStorageTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Price/SpecialPriceStorageTest.php @@ -178,7 +178,7 @@ public function testUpdateWithInvalidSku() ->with( 1, __( - 'Requested product doesn\'t exist. ' + 'The product that was requested doesn\'t exist. Verify the product and try again. ' . 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.', [ 'SKU' => 'sku_1', diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/PriceModifierTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/PriceModifierTest.php index 1d0f89f320772..754d80302d410 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/PriceModifierTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/PriceModifierTest.php @@ -54,7 +54,7 @@ protected function setUp() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedMessage This product doesn't have tier price + * @expectedMessage Tier price is unavailable for this product. */ public function testRemoveWhenTierPricesNotExists() { diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/TierPriceManagementTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/TierPriceManagementTest.php index c57040f24266d..371696d08d00e 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/TierPriceManagementTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/TierPriceManagementTest.php @@ -192,7 +192,7 @@ public function testSuccessDeleteTierPrice() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @message Such product doesn't exist + * @message The product doesn't exist. Verify and try again. */ public function testDeleteTierPriceFromNonExistingProduct() { @@ -328,7 +328,7 @@ public function testSetUpdatedPriceWithGlobalPriceScope() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Values of following attributes are invalid: attr1, attr2 + * @expectedExceptionMessage Values in the attr1, attr2 attributes are invalid. Verify the values and try again. */ public function testSetThrowsExceptionIfDoesntValidate() { diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductAttributeGroupRepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductAttributeGroupRepositoryTest.php index 14f0cbdf9ab68..5c3e9a429317c 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductAttributeGroupRepositoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductAttributeGroupRepositoryTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Test\Unit\Model; class ProductAttributeGroupRepositoryTest extends \PHPUnit\Framework\TestCase @@ -121,7 +122,7 @@ public function testDelete() /** * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Attribute group that contains system attributes can not be deleted + * @expectedExceptionMessage The attribute group can't be deleted because it contains system attributes. */ public function testDeleteThrowsExceptionIfGroupHasSystemAttributes() { diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/ManagementTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/ManagementTest.php index f9b3af4c7a3bc..ab52d87f56291 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/ManagementTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/ManagementTest.php @@ -79,7 +79,7 @@ public function testGetLinkedItemsByType() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Unknown link type: bad type + * @expectedExceptionMessage The "bad type" link type is unknown. Verify the type and try again. */ public function testGetLinkedItemsByTypeWithWrongType() { @@ -132,7 +132,7 @@ public function testSetProductLinks() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage linkType is a required field. + * @expectedExceptionMessage "linkType" is required. Enter and try again. */ public function testSetProductLinksWithoutLinkTypeInLink() { @@ -154,7 +154,7 @@ public function testSetProductLinksWithoutLinkTypeInLink() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Provided link type "bad type" does not exist + * @expectedExceptionMessage The "bad type" link type wasn't found. Verify the type and try again. */ public function testSetProductLinksThrowExceptionIfProductLinkTypeDoesNotExist() { @@ -181,7 +181,7 @@ public function testSetProductLinksThrowExceptionIfProductLinkTypeDoesNotExist() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Requested product doesn't exist + * @expectedExceptionMessage The product that was requested doesn't exist. Verify the product and try again. */ public function testSetProductLinksNoProductException() { @@ -205,7 +205,9 @@ public function testSetProductLinksNoProductException() ->method('get') ->will( $this->throwException( - new \Magento\Framework\Exception\NoSuchEntityException(__('Requested product doesn\'t exist')) + new \Magento\Framework\Exception\NoSuchEntityException( + __("The product that was requested doesn't exist. Verify the product and try again.") + ) ) ); $this->model->setProductLinks($productSku, $links); @@ -213,7 +215,7 @@ public function testSetProductLinksNoProductException() /** * @expectedException \Magento\Framework\Exception\CouldNotSaveException - * @expectedExceptionMessage Invalid data provided for linked products + * @expectedExceptionMessage The linked products data is invalid. Verify the data and try again. */ public function testSetProductLinksInvalidDataException() { diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/RepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/RepositoryTest.php index 56aca8d205302..88815f562b5fe 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/RepositoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/RepositoryTest.php @@ -137,7 +137,7 @@ public function testSave() /** * @expectedException \Magento\Framework\Exception\CouldNotSaveException - * @expectedExceptionMessage Invalid data provided for linked products + * @expectedExceptionMessage The linked products data is invalid. Verify the data and try again. */ public function testSaveWithException() { @@ -208,7 +208,7 @@ public function testDelete() /** * @expectedException \Magento\Framework\Exception\CouldNotSaveException - * @expectedExceptionMessage Invalid data provided for linked products + * @expectedExceptionMessage The linked products data is invalid. Verify the data and try again. */ public function testDeleteWithInvalidDataException() { diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php index 7470f1fc71c8e..8d65153d7ba20 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php @@ -301,7 +301,7 @@ function ($value) { /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Requested product doesn't exist + * @expectedExceptionMessage The product that was requested doesn't exist. Verify the product and try again. */ public function testGetAbsentProduct() { @@ -367,7 +367,7 @@ public function testGetWithSetStoreId() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Requested product doesn't exist + * @expectedExceptionMessage The product that was requested doesn't exist. Verify the product and try again. */ public function testGetByIdAbsentProduct() { @@ -592,7 +592,7 @@ public function testSaveNew() /** * @expectedException \Magento\Framework\Exception\CouldNotSaveException - * @expectedExceptionMessage Unable to save product + * @expectedExceptionMessage The product was unable to be saved. Please try again. */ public function testSaveUnableToSaveException() { @@ -707,7 +707,7 @@ public function testDelete() /** * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Unable to remove product product-42 + * @expectedExceptionMessage The "product-42" product couldn't be removed. */ public function testDeleteException() { diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml index 57474f835125e..9096cb1458bf9 100644 --- a/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml +++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml @@ -176,7 +176,7 @@ - + diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options.js b/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options.js index 5aa0a163c0d41..4d0448f8f2a1e 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options.js @@ -166,7 +166,7 @@ define([ if (request.length === 0) { if (!massActionTrigger) { alert({ - content: $.mage.__('Please select items.') + content: $.mage.__('An item needs to be selected. Select and try again.') }); } diff --git a/app/code/Magento/Catalog/view/adminhtml/web/template/field-wysiwyg.html b/app/code/Magento/Catalog/view/adminhtml/web/template/field-wysiwyg.html new file mode 100644 index 0000000000000..c9340eab2f2e6 --- /dev/null +++ b/app/code/Magento/Catalog/view/adminhtml/web/template/field-wysiwyg.html @@ -0,0 +1,46 @@ + +
+ +
+ + +
+ + + + +
+ + + + + +
+
+ + diff --git a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php index 3fb0790640ffc..8e0c749be2d1d 100644 --- a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php +++ b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php @@ -5,6 +5,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CatalogInventory\Model\Quote\Item; use Magento\CatalogInventory\Api\Data\StockItemInterface; @@ -114,7 +115,7 @@ public function validate(Observer $observer) /* @var \Magento\CatalogInventory\Model\Stock\Item $stockItem */ $stockItem = $this->stockRegistry->getStockItem($product->getId(), $product->getStore()->getWebsiteId()); if (!$stockItem instanceof StockItemInterface) { - throw new LocalizedException(__('The stock item for Product is not valid.')); + throw new LocalizedException(__('The Product stock item is invalid. Verify the stock item and try again.')); } /* @var \Magento\CatalogInventory\Api\Data\StockStatusInterface $stockStatus */ diff --git a/app/code/Magento/CatalogInventory/Model/Stock/StockItemRepository.php b/app/code/Magento/CatalogInventory/Model/Stock/StockItemRepository.php index e5154a10f0a19..6928ab9947059 100644 --- a/app/code/Magento/CatalogInventory/Model/Stock/StockItemRepository.php +++ b/app/code/Magento/CatalogInventory/Model/Stock/StockItemRepository.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CatalogInventory\Model\Stock; use Magento\Catalog\Model\ProductFactory; @@ -183,7 +184,7 @@ public function save(\Magento\CatalogInventory\Api\Data\StockItemInterface $stoc $this->resource->save($stockItem); } catch (\Exception $exception) { - throw new CouldNotSaveException(__('Unable to save Stock Item'), $exception); + throw new CouldNotSaveException(__('The stock item was unable to be saved. Please try again.'), $exception); } return $stockItem; } @@ -196,7 +197,9 @@ public function get($stockItemId) $stockItem = $this->stockItemFactory->create(); $this->resource->load($stockItem, $stockItemId); if (!$stockItem->getItemId()) { - throw new NoSuchEntityException(__('Stock Item with id "%1" does not exist.', $stockItemId)); + throw new NoSuchEntityException( + __('The stock item with the "%1" ID wasn\'t found. Verify the ID and try again.', $stockItemId) + ); } return $stockItem; } @@ -225,7 +228,10 @@ public function delete(StockItemInterface $stockItem) $this->getStockRegistryStorage()->removeStockStatus($stockItem->getProductId()); } catch (\Exception $exception) { throw new CouldNotDeleteException( - __('Unable to remove Stock Item with id "%1"', $stockItem->getItemId()), + __( + 'The stock item with the "%1" ID wasn\'t found. Verify the ID and try again.', + $stockItem->getItemId() + ), $exception ); } @@ -242,7 +248,7 @@ public function deleteById($id) $this->delete($stockItem); } catch (\Exception $exception) { throw new CouldNotDeleteException( - __('Unable to remove Stock Item with id "%1"', $id), + __('The stock item with the "%1" ID wasn\'t found. Verify the ID and try again.', $id), $exception ); } diff --git a/app/code/Magento/CatalogInventory/Model/Stock/StockRepository.php b/app/code/Magento/CatalogInventory/Model/Stock/StockRepository.php index 0e7add8a95181..d4d82dd35ee2b 100644 --- a/app/code/Magento/CatalogInventory/Model/Stock/StockRepository.php +++ b/app/code/Magento/CatalogInventory/Model/Stock/StockRepository.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CatalogInventory\Model\Stock; use Magento\CatalogInventory\Api\Data\StockCollectionInterfaceFactory; @@ -84,7 +85,7 @@ public function save(StockInterface $stock) try { $this->resource->save($stock); } catch (\Exception $exception) { - throw new CouldNotSaveException(__('Unable to save Stock'), $exception); + throw new CouldNotSaveException(__('The stock was unable to be saved. Please try again.'), $exception); } return $stock; } @@ -99,7 +100,9 @@ public function get($stockId) $stock = $this->stockFactory->create(); $this->resource->load($stock, $stockId); if (!$stock->getId()) { - throw new NoSuchEntityException(__('Stock with id "%1" does not exist.', $stockId)); + throw new NoSuchEntityException( + __('The stock with the "%1" ID wasn\'t found. Verify the ID and try again.', $stockId) + ); } return $stock; } diff --git a/app/code/Magento/CatalogInventory/Model/Stock/StockStatusRepository.php b/app/code/Magento/CatalogInventory/Model/Stock/StockStatusRepository.php index 3dfc4c49a5d63..4db1b07ea517d 100644 --- a/app/code/Magento/CatalogInventory/Model/Stock/StockStatusRepository.php +++ b/app/code/Magento/CatalogInventory/Model/Stock/StockStatusRepository.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CatalogInventory\Model\Stock; use Magento\CatalogInventory\Api\Data\StockStatusCollectionInterfaceFactory; @@ -82,7 +83,10 @@ public function save(StockStatusInterface $stockStatus) try { $this->resource->save($stockStatus); } catch (\Exception $exception) { - throw new CouldNotSaveException(__('Unable to save Stock Status'), $exception); + throw new CouldNotSaveException( + __('The stock status was unable to be saved. Please try again.'), + $exception + ); } return $stockStatus; } diff --git a/app/code/Magento/CatalogInventory/Model/StockItemValidator.php b/app/code/Magento/CatalogInventory/Model/StockItemValidator.php index 2cc4832159d55..5d218a4f06516 100644 --- a/app/code/Magento/CatalogInventory/Model/StockItemValidator.php +++ b/app/code/Magento/CatalogInventory/Model/StockItemValidator.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CatalogInventory\Model; use Magento\Catalog\Api\Data\ProductInterface; @@ -53,21 +54,34 @@ public function validate(ProductInterface $product, StockItemInterface $stockIte $stockId = $stockItem->getStockId(); if ($stockId !== null && $stockId != $defaultStockId) { throw new LocalizedException( - __('Invalid stock id: %1. Only default stock with id %2 allowed', $stockId, $defaultStockId) + __( + 'The "%1" value is invalid for stock ID. Enter stock with a default value of %2 to try again.', + $stockId, + $defaultStockId + ) ); } $stockItemId = $stockItem->getItemId(); if ($stockItemId !== null && (!is_numeric($stockItemId) || $stockItemId <= 0)) { throw new LocalizedException( - __('Invalid stock item id: %1. Should be null or numeric value greater than 0', $stockItemId) + __( + 'The "%1" value is invalid for stock item ID. ' + . 'Enter either zero or a number than zero to try again.', + $stockItemId + ) ); } $defaultStockItemId = $this->stockRegistry->getStockItem($product->getId())->getItemId(); if ($defaultStockItemId && $stockItemId !== null && $defaultStockItemId != $stockItemId) { throw new LocalizedException( - __('Invalid stock item id: %1. Assigned stock item id is %2', $stockItemId, $defaultStockItemId) + __( + 'The "%1" value is invalid for stock item ID. ' + . 'Use the stock item ID\'s assigned "%2" value and try again.', + $stockItemId, + $defaultStockItemId + ) ); } } diff --git a/app/code/Magento/CatalogInventory/Model/StockRegistry.php b/app/code/Magento/CatalogInventory/Model/StockRegistry.php index d688132fdb916..f60edee330195 100644 --- a/app/code/Magento/CatalogInventory/Model/StockRegistry.php +++ b/app/code/Magento/CatalogInventory/Model/StockRegistry.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CatalogInventory\Model; use Magento\Catalog\Model\ProductFactory; @@ -192,7 +193,7 @@ protected function resolveProductId($productSku) if (!$productId) { throw new \Magento\Framework\Exception\NoSuchEntityException( __( - 'Product with SKU "%1" does not exist', + 'The Product with the "%1" SKU doesn\'t exist.', $productSku ) ); diff --git a/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Qtyincrements.php b/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Qtyincrements.php index f34d765b0e5f0..3c4586c9eddd1 100644 --- a/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Qtyincrements.php +++ b/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Qtyincrements.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CatalogInventory\Model\System\Config\Backend; use Magento\Framework\Exception\LocalizedException; @@ -22,7 +23,9 @@ public function beforeSave() { $value = $this->getValue(); if (floor($value) != $value) { - throw new LocalizedException(__('Decimal qty increments is not allowed.')); + throw new LocalizedException( + __("Quantity increments can't use decimals. Enter a new increment and try again.") + ); } } } diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockItemRepositoryTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockItemRepositoryTest.php index 293874bb32b9f..089f6c42a1736 100644 --- a/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockItemRepositoryTest.php +++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockItemRepositoryTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CatalogInventory\Test\Unit\Model\Stock; use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory; @@ -251,7 +252,7 @@ public function testDeleteById() /** * @expectedException \Magento\Framework\Exception\CouldNotDeleteException - * @expectedExceptionMessage Unable to remove Stock Item with id "1" + * @expectedExceptionMessage The stock item with the "1" ID wasn't found. Verify the ID and try again. */ public function testDeleteByIdException() { diff --git a/app/code/Magento/CatalogRule/Model/CatalogRuleRepository.php b/app/code/Magento/CatalogRule/Model/CatalogRuleRepository.php index a3fa9a8f67ab2..2655c0fa9646a 100644 --- a/app/code/Magento/CatalogRule/Model/CatalogRuleRepository.php +++ b/app/code/Magento/CatalogRule/Model/CatalogRuleRepository.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CatalogRule\Model; use Magento\CatalogRule\Api\Data; @@ -55,7 +56,9 @@ public function save(Data\RuleInterface $rule) } catch (ValidatorException $e) { throw new CouldNotSaveException(__($e->getMessage())); } catch (\Exception $e) { - throw new CouldNotSaveException(__('Unable to save rule %1', $rule->getRuleId())); + throw new CouldNotSaveException( + __('The "%1" rule was unable to be saved. Please try again.', $rule->getRuleId()) + ); } return $rule; } @@ -72,7 +75,9 @@ public function get($ruleId) /* TODO: change to resource model after entity manager will be fixed */ $rule->load($ruleId); if (!$rule->getRuleId()) { - throw new NoSuchEntityException(__('Rule with specified ID "%1" not found.', $ruleId)); + throw new NoSuchEntityException( + __('The rule with the "%1" ID wasn\'t found. Verify the ID and try again.', $ruleId) + ); } $this->rules[$ruleId] = $rule; } @@ -90,7 +95,7 @@ public function delete(Data\RuleInterface $rule) } catch (ValidatorException $e) { throw new CouldNotSaveException(__($e->getMessage())); } catch (\Exception $e) { - throw new CouldNotDeleteException(__('Unable to remove rule %1', $rule->getRuleId())); + throw new CouldNotDeleteException(__('The "%1" rule couldn\'t be removed.', $rule->getRuleId())); } return true; } diff --git a/app/code/Magento/CatalogRule/Test/Unit/Model/CatalogRuleRepositoryTest.php b/app/code/Magento/CatalogRule/Test/Unit/Model/CatalogRuleRepositoryTest.php index 32c6896625a1f..7db805908ae72 100644 --- a/app/code/Magento/CatalogRule/Test/Unit/Model/CatalogRuleRepositoryTest.php +++ b/app/code/Magento/CatalogRule/Test/Unit/Model/CatalogRuleRepositoryTest.php @@ -65,7 +65,7 @@ public function testEditRule() /** * @expectedException \Magento\Framework\Exception\CouldNotSaveException - * @expectedExceptionMessage Unable to save rule 1 + * @expectedExceptionMessage The "1" rule was unable to be saved. Please try again. */ public function testEnableSaveRule() { @@ -106,7 +106,7 @@ public function testDeleteRuleById() /** * @expectedException \Magento\Framework\Exception\CouldNotDeleteException - * @expectedExceptionMessage Unable to remove rule 1 + * @expectedExceptionMessage The "1" rule couldn't be removed. */ public function testUnableDeleteRule() { @@ -132,7 +132,7 @@ public function testGetRule() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Rule with specified ID "1" not found. + * @expectedExceptionMessage The rule with the "1" ID wasn't found. Verify the ID and try again. */ public function testGetNonExistentRule() { diff --git a/app/code/Magento/CatalogSearch/Model/Advanced.php b/app/code/Magento/CatalogSearch/Model/Advanced.php index d158bdf40b421..28f67a7829e7e 100644 --- a/app/code/Magento/CatalogSearch/Model/Advanced.php +++ b/app/code/Magento/CatalogSearch/Model/Advanced.php @@ -226,7 +226,7 @@ public function addFilters($values) $this->_registry->register('advanced_search_conditions', $allConditions); $this->getProductCollection()->addFieldsToFilter($allConditions); } else { - throw new LocalizedException(__('Please specify at least one search term.')); + throw new LocalizedException(__('Enter a search term and try again.')); } return $this; diff --git a/app/code/Magento/CatalogSearch/Model/ResourceModel/Advanced/Collection.php b/app/code/Magento/CatalogSearch/Model/ResourceModel/Advanced/Collection.php index 02bc3e2bc2400..57896ba5a79fd 100644 --- a/app/code/Magento/CatalogSearch/Model/ResourceModel/Advanced/Collection.php +++ b/app/code/Magento/CatalogSearch/Model/ResourceModel/Advanced/Collection.php @@ -187,7 +187,7 @@ protected function _renderFiltersBefore() } catch (NonExistingRequestNameException $e) { $this->_logger->error($e->getMessage()); throw new LocalizedException( - __('Sorry, something went wrong. You can find out more in the error log.') + __('An error occurred. For details, see the error log.') ); } $temporaryStorage = $this->temporaryStorageFactory->create(); diff --git a/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php b/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php index 68274ee5043f5..0408957e511b9 100644 --- a/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php +++ b/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php @@ -347,7 +347,7 @@ protected function _renderFiltersBefore() $this->searchResult = $this->searchResultFactory->create()->setItems([]); } catch (NonExistingRequestNameException $e) { $this->_logger->error($e->getMessage()); - throw new LocalizedException(__('Sorry, something went wrong. You can find out more in the error log.')); + throw new LocalizedException(__('An error occurred. For details, see the error log.')); } $temporaryStorage = $this->temporaryStorageFactory->create(); @@ -441,7 +441,7 @@ public function getFacetedData($field) $result[$metrics['value']] = $metrics; } } else { - throw new StateException(__('Bucket does not exist')); + throw new StateException(__("The bucket doesn't exist.")); } } return $result; diff --git a/app/code/Magento/Checkout/Controller/Cart/Configure.php b/app/code/Magento/Checkout/Controller/Cart/Configure.php index 132fbf7d199a0..6d409144ff66d 100644 --- a/app/code/Magento/Checkout/Controller/Cart/Configure.php +++ b/app/code/Magento/Checkout/Controller/Cart/Configure.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Checkout\Controller\Cart; use Magento\Framework; @@ -63,7 +64,7 @@ public function execute() try { if (!$quoteItem || $productId != $quoteItem->getProduct()->getId()) { - $this->messageManager->addError(__("We can't find the quote item.")); + $this->messageManager->addError(__("The quote item isn't found. Verify the item and try again.")); return $this->resultFactory->create(ResultFactory::TYPE_REDIRECT)->setPath('checkout/cart'); } diff --git a/app/code/Magento/Checkout/Controller/Cart/UpdateItemOptions.php b/app/code/Magento/Checkout/Controller/Cart/UpdateItemOptions.php index 118611263220b..d7cb94f3da673 100644 --- a/app/code/Magento/Checkout/Controller/Cart/UpdateItemOptions.php +++ b/app/code/Magento/Checkout/Controller/Cart/UpdateItemOptions.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Checkout\Controller\Cart; class UpdateItemOptions extends \Magento\Checkout\Controller\Cart @@ -35,7 +36,9 @@ public function execute() $quoteItem = $this->cart->getQuote()->getItemById($id); if (!$quoteItem) { - throw new \Magento\Framework\Exception\LocalizedException(__('We can\'t find the quote item.')); + throw new \Magento\Framework\Exception\LocalizedException( + __("The quote item isn't found. Verify the item and try again.") + ); } $item = $this->cart->updateItem($id, new \Magento\Framework\DataObject($params)); diff --git a/app/code/Magento/Checkout/Controller/Onepage/SaveOrder.php b/app/code/Magento/Checkout/Controller/Onepage/SaveOrder.php index 3597962b83831..12b725a8f6df9 100644 --- a/app/code/Magento/Checkout/Controller/Onepage/SaveOrder.php +++ b/app/code/Magento/Checkout/Controller/Onepage/SaveOrder.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Checkout\Controller\Onepage; use Magento\Framework\DataObject; @@ -37,7 +38,10 @@ public function execute() $result->setData('error', true); $result->setData( 'error_messages', - __('Please agree to all the terms and conditions before placing the order.') + __( + "The order wasn't placed. " + . "First, agree to the terms and conditions, then try placing your order again." + ) ); return $this->resultJsonFactory->create()->setData($result->getData()); } diff --git a/app/code/Magento/Checkout/Model/Cart.php b/app/code/Magento/Checkout/Model/Cart.php index f7072ab97432d..d1a55aee4db93 100644 --- a/app/code/Magento/Checkout/Model/Cart.php +++ b/app/code/Magento/Checkout/Model/Cart.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Checkout\Model; use Magento\Catalog\Api\ProductRepositoryInterface; @@ -299,21 +300,30 @@ protected function _getProduct($productInfo) if ($productInfo instanceof Product) { $product = $productInfo; if (!$product->getId()) { - throw new \Magento\Framework\Exception\LocalizedException(__('We can\'t find the product.')); + throw new \Magento\Framework\Exception\LocalizedException( + __("The product wasn't found. Verify the product and try again.") + ); } } elseif (is_int($productInfo) || is_string($productInfo)) { $storeId = $this->_storeManager->getStore()->getId(); try { $product = $this->productRepository->getById($productInfo, false, $storeId); } catch (NoSuchEntityException $e) { - throw new \Magento\Framework\Exception\LocalizedException(__('We can\'t find the product.'), $e); + throw new \Magento\Framework\Exception\LocalizedException( + __("The product wasn't found. Verify the product and try again."), + $e + ); } } else { - throw new \Magento\Framework\Exception\LocalizedException(__('We can\'t find the product.')); + throw new \Magento\Framework\Exception\LocalizedException( + __("The product wasn't found. Verify the product and try again.") + ); } $currentWebsiteId = $this->_storeManager->getStore()->getWebsiteId(); if (!is_array($product->getWebsiteIds()) || !in_array($currentWebsiteId, $product->getWebsiteIds())) { - throw new \Magento\Framework\Exception\LocalizedException(__('We can\'t find the product.')); + throw new \Magento\Framework\Exception\LocalizedException( + __("The product wasn't found. Verify the product and try again.") + ); } return $product; } diff --git a/app/code/Magento/Checkout/Model/GuestPaymentInformationManagement.php b/app/code/Magento/Checkout/Model/GuestPaymentInformationManagement.php index 6779da354faf8..e18940626a338 100644 --- a/app/code/Magento/Checkout/Model/GuestPaymentInformationManagement.php +++ b/app/code/Magento/Checkout/Model/GuestPaymentInformationManagement.php @@ -95,7 +95,7 @@ public function savePaymentInformationAndPlaceOrder( } catch (\Exception $e) { $this->getLogger()->critical($e); throw new CouldNotSaveException( - __('An error occurred on the server. Please try to place the order again.'), + __('A server error stopped your order from being placed. Please try to place your order again.'), $e ); } diff --git a/app/code/Magento/Checkout/Model/PaymentInformationManagement.php b/app/code/Magento/Checkout/Model/PaymentInformationManagement.php index 3d6b0aa0cdc12..164109177d4e9 100644 --- a/app/code/Magento/Checkout/Model/PaymentInformationManagement.php +++ b/app/code/Magento/Checkout/Model/PaymentInformationManagement.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Checkout\Model; use Magento\Framework\Exception\CouldNotSaveException; @@ -89,7 +90,7 @@ public function savePaymentInformationAndPlaceOrder( } catch (\Exception $e) { $this->getLogger()->critical($e); throw new CouldNotSaveException( - __('An error occurred on the server. Please try to place the order again.'), + __('A server error stopped your order from being placed. Please try to place your order again.'), $e ); } diff --git a/app/code/Magento/Checkout/Model/ShippingInformationManagement.php b/app/code/Magento/Checkout/Model/ShippingInformationManagement.php index d8142d033f78c..381ee2b9015c9 100644 --- a/app/code/Magento/Checkout/Model/ShippingInformationManagement.php +++ b/app/code/Magento/Checkout/Model/ShippingInformationManagement.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Checkout\Model; use Magento\Framework\Exception\InputException; @@ -151,7 +152,7 @@ public function saveAddressInformation( } if (!$address->getCountryId()) { - throw new StateException(__('Shipping address is not set')); + throw new StateException(__('The shipping address is missing. Set the address and try again.')); } /** @var \Magento\Quote\Model\Quote $quote */ @@ -169,7 +170,9 @@ public function saveAddressInformation( $this->quoteRepository->save($quote); } catch (\Exception $e) { $this->logger->critical($e); - throw new InputException(__('Unable to save shipping information. Please check input data.')); + throw new InputException( + __('The shipping information was unable to be saved. Verify the input data and try again.') + ); } $shippingAddress = $quote->getShippingAddress(); @@ -198,7 +201,9 @@ public function saveAddressInformation( protected function validateQuote(\Magento\Quote\Model\Quote $quote) { if (0 == $quote->getItemsCount()) { - throw new InputException(__('Shipping method is not applicable for empty cart')); + throw new InputException( + __("The shipping method can't be set for an empty cart. Add an item to cart and try again.") + ); } } diff --git a/app/code/Magento/Checkout/Model/Sidebar.php b/app/code/Magento/Checkout/Model/Sidebar.php index 1a0e3aa818351..6f6655508f1b4 100644 --- a/app/code/Magento/Checkout/Model/Sidebar.php +++ b/app/code/Magento/Checkout/Model/Sidebar.php @@ -85,7 +85,7 @@ public function checkQuoteItem($itemId) { $item = $this->cart->getQuote()->getItemById($itemId); if (!$item instanceof CartItemInterface) { - throw new LocalizedException(__('We can\'t find the quote item.')); + throw new LocalizedException(__("The quote item isn't found. Verify the item and try again.")); } return $this; } diff --git a/app/code/Magento/Checkout/Test/Unit/Model/GuestPaymentInformationManagementTest.php b/app/code/Magento/Checkout/Test/Unit/Model/GuestPaymentInformationManagementTest.php index 5fa12521fc3e6..ba6bba6d6333d 100644 --- a/app/code/Magento/Checkout/Test/Unit/Model/GuestPaymentInformationManagementTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Model/GuestPaymentInformationManagementTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Checkout\Test\Unit\Model; /** @@ -98,7 +99,6 @@ public function testSavePaymentInformationAndPlaceOrder() } /** - * @expectedExceptionMessage An error occurred on the server. Please try to place the order again. * @expectedException \Magento\Framework\Exception\CouldNotSaveException */ public function testSavePaymentInformationAndPlaceOrderException() @@ -118,6 +118,10 @@ public function testSavePaymentInformationAndPlaceOrderException() $this->cartManagementMock->expects($this->once())->method('placeOrder')->willThrowException($exception); $this->model->savePaymentInformationAndPlaceOrder($cartId, $email, $paymentMock, $billingAddressMock); + + $this->expectExceptionMessage( + 'A server error stopped your order from being placed. Please try to place your order again.' + ); } public function testSavePaymentInformation() diff --git a/app/code/Magento/Checkout/Test/Unit/Model/PaymentInformationManagementTest.php b/app/code/Magento/Checkout/Test/Unit/Model/PaymentInformationManagementTest.php index b40b2b244ac4c..77c15fccfa8ae 100644 --- a/app/code/Magento/Checkout/Test/Unit/Model/PaymentInformationManagementTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Model/PaymentInformationManagementTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Checkout\Test\Unit\Model; /** @@ -83,7 +84,6 @@ public function testSavePaymentInformationAndPlaceOrder() } /** - * @expectedExceptionMessage An error occurred on the server. Please try to place the order again. * @expectedException \Magento\Framework\Exception\CouldNotSaveException */ public function testSavePaymentInformationAndPlaceOrderException() @@ -99,6 +99,10 @@ public function testSavePaymentInformationAndPlaceOrderException() $this->cartManagementMock->expects($this->once())->method('placeOrder')->willThrowException($exception); $this->model->savePaymentInformationAndPlaceOrder($cartId, $paymentMock, $billingAddressMock); + + $this->expectExceptionMessage( + 'A server error stopped your order from being placed. Please try to place your order again.' + ); } public function testSavePaymentInformationAndPlaceOrderIfBillingAddressNotExist() diff --git a/app/code/Magento/Checkout/Test/Unit/Model/ShippingInformationManagementTest.php b/app/code/Magento/Checkout/Test/Unit/Model/ShippingInformationManagementTest.php index 5c6314b2a35c8..dd88b7161acdf 100644 --- a/app/code/Magento/Checkout/Test/Unit/Model/ShippingInformationManagementTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Model/ShippingInformationManagementTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Checkout\Test\Unit\Model; /** @@ -157,7 +158,7 @@ protected function setUp() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Shipping method is not applicable for empty cart + * @expectedExceptionMessage The shipping method can't be set for an empty cart. Add an item to cart and try again. */ public function testSaveAddressInformationIfCartIsEmpty() { @@ -238,7 +239,7 @@ private function setShippingAssignmentsMocks($shippingMethod) /** * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Shipping address is not set + * @expectedExceptionMessage The shipping address is missing. Set the address and try again. */ public function testSaveAddressInformationIfShippingAddressNotSet() { @@ -263,7 +264,7 @@ public function testSaveAddressInformationIfShippingAddressNotSet() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Unable to save shipping information. Please check input data. + * @expectedExceptionMessage The shipping information was unable to be saved. Verify the input data and try again. */ public function testSaveAddressInformationIfCanNotSaveQuote() { diff --git a/app/code/Magento/Checkout/Test/Unit/Model/SidebarTest.php b/app/code/Magento/Checkout/Test/Unit/Model/SidebarTest.php index 29537e8ec0526..c07413c8611d0 100644 --- a/app/code/Magento/Checkout/Test/Unit/Model/SidebarTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Model/SidebarTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Checkout\Test\Unit\Model; use Magento\Checkout\Model\Sidebar; @@ -94,7 +95,7 @@ public function testCheckQuoteItem() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @exceptedExceptionMessage We can't find the quote item. + * @exceptedExceptionMessage The quote item isn't found. Verify the item and try again. */ public function testCheckQuoteItemWithException() { diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/item/configure/updatecart.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/item/configure/updatecart.phtml index b41d548e95b99..c1db2f7775ca8 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/item/configure/updatecart.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/item/configure/updatecart.phtml @@ -23,7 +23,7 @@ value="" title="" class="input-text qty" - data-validate="{'required-number':true,digits:true}"/> + data-validate="escapeHtml(json_encode($block->getQuantityValidators())) ?>"/> diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js index 619de95e467f0..a7cb7f7e7de84 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js @@ -266,7 +266,9 @@ define([ field; if (!quote.shippingMethod()) { - this.errorValidationMessage($t('Please specify a shipping method.')); + this.errorValidationMessage( + $t('The shipping method is missing. Select the shipping method and try again.') + ); return false; } diff --git a/app/code/Magento/CheckoutAgreements/Model/Checkout/Plugin/GuestValidation.php b/app/code/Magento/CheckoutAgreements/Model/Checkout/Plugin/GuestValidation.php index 4176334bb4a3e..fbceca0906702 100644 --- a/app/code/Magento/CheckoutAgreements/Model/Checkout/Plugin/GuestValidation.php +++ b/app/code/Magento/CheckoutAgreements/Model/Checkout/Plugin/GuestValidation.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CheckoutAgreements\Model\Checkout\Plugin; use Magento\CheckoutAgreements\Model\AgreementsProvider; @@ -113,7 +114,10 @@ private function validateAgreements(\Magento\Quote\Api\Data\PaymentInterface $pa if (!$this->agreementsValidator->isValid($agreements)) { throw new \Magento\Framework\Exception\CouldNotSaveException( - __('Please agree to all the terms and conditions before placing the order.') + __( + "The order wasn't placed. " + . "First, agree to the terms and conditions, then try placing your order again." + ) ); } } diff --git a/app/code/Magento/CheckoutAgreements/Model/Checkout/Plugin/Validation.php b/app/code/Magento/CheckoutAgreements/Model/Checkout/Plugin/Validation.php index b8a6afff4fced..67e2a6c9ec334 100644 --- a/app/code/Magento/CheckoutAgreements/Model/Checkout/Plugin/Validation.php +++ b/app/code/Magento/CheckoutAgreements/Model/Checkout/Plugin/Validation.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CheckoutAgreements\Model\Checkout\Plugin; use Magento\CheckoutAgreements\Model\AgreementsProvider; @@ -105,7 +106,10 @@ protected function validateAgreements(\Magento\Quote\Api\Data\PaymentInterface $ if (!$this->agreementsValidator->isValid($agreements)) { throw new \Magento\Framework\Exception\CouldNotSaveException( - __('Please agree to all the terms and conditions before placing the order.') + __( + "The order wasn't placed. " + . "First, agree to the terms and conditions, then try placing your order again." + ) ); } } diff --git a/app/code/Magento/CheckoutAgreements/Model/CheckoutAgreementsRepository.php b/app/code/Magento/CheckoutAgreements/Model/CheckoutAgreementsRepository.php index 9379b73a1b964..60cc1f98264aa 100644 --- a/app/code/Magento/CheckoutAgreements/Model/CheckoutAgreementsRepository.php +++ b/app/code/Magento/CheckoutAgreements/Model/CheckoutAgreementsRepository.php @@ -138,7 +138,7 @@ public function save(\Magento\CheckoutAgreements\Api\Data\AgreementInterface $da $this->resourceModel->save($data); } catch (\Exception $e) { throw new \Magento\Framework\Exception\CouldNotSaveException( - __('Unable to save checkout agreement %1', $data->getAgreementId()) + __('The "%1" checkout agreement couldn\'t be saved.', $data->getAgreementId()) ); } return $data; @@ -153,7 +153,7 @@ public function delete(\Magento\CheckoutAgreements\Api\Data\AgreementInterface $ $this->resourceModel->delete($data); } catch (\Exception $e) { throw new \Magento\Framework\Exception\CouldNotDeleteException( - __('Unable to remove checkout agreement %1', $data->getAgreementId()) + __('The "%1" checkout agreement couldn\'t be removed.', $data->getAgreementId()) ); } return true; @@ -178,7 +178,9 @@ public function get($id, $storeId = null) $agreement = $this->agreementFactory->create(); $this->resourceModel->load($agreement, $id); if (!$agreement->getId()) { - throw new NoSuchEntityException(__('Checkout agreement with specified ID "%1" not found.', $id)); + throw new NoSuchEntityException( + __('A checkout agreement with the "%1" specified ID wasn\'t found. Verify the ID and try again.', $id) + ); } return $agreement; } diff --git a/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/GuestValidationTest.php b/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/GuestValidationTest.php index baaaad1bb6aff..3d7b910c7abc5 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/GuestValidationTest.php +++ b/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/GuestValidationTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CheckoutAgreements\Test\Unit\Model\Checkout\Plugin; use Magento\CheckoutAgreements\Model\AgreementsProvider; @@ -119,7 +120,6 @@ public function testBeforeSavePaymentInformationAndPlaceOrder() /** * @expectedException \Magento\Framework\Exception\CouldNotSaveException - * @expectedExceptionMessage Please agree to all the terms and conditions before placing the order. */ public function testBeforeSavePaymentInformationAndPlaceOrderIfAgreementsNotValid() { @@ -151,6 +151,10 @@ public function testBeforeSavePaymentInformationAndPlaceOrderIfAgreementsNotVali $this->paymentMock, $this->addressMock ); + + $this->expectExceptionMessage( + "The order wasn't placed. First, agree to the terms and conditions, then try placing your order again." + ); } public function testBeforeSavePaymentInformation() diff --git a/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/ValidationTest.php b/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/ValidationTest.php index b77cab203eb6b..7f11fad202401 100644 --- a/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/ValidationTest.php +++ b/app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/ValidationTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CheckoutAgreements\Test\Unit\Model\Checkout\Plugin; use Magento\CheckoutAgreements\Model\AgreementsProvider; @@ -112,7 +113,6 @@ public function testBeforeSavePaymentInformationAndPlaceOrder() /** * @expectedException \Magento\Framework\Exception\CouldNotSaveException - * @expectedExceptionMessage Please agree to all the terms and conditions before placing the order. */ public function testBeforeSavePaymentInformationAndPlaceOrderIfAgreementsNotValid() { @@ -137,6 +137,10 @@ public function testBeforeSavePaymentInformationAndPlaceOrderIfAgreementsNotVali ->method('getExtensionAttributes') ->willReturn($this->extensionAttributesMock); $this->model->beforeSavePaymentInformation($this->subjectMock, $cartId, $this->paymentMock, $this->addressMock); + + $this->expectExceptionMessage( + "The order wasn't placed. First, agree to the terms and conditions, then try placing your order again." + ); } public function testBeforeSavePaymentInformation() diff --git a/app/code/Magento/Cms/Model/BlockRepository.php b/app/code/Magento/Cms/Model/BlockRepository.php index e724c1581e8f5..fa29cc9ff7631 100644 --- a/app/code/Magento/Cms/Model/BlockRepository.php +++ b/app/code/Magento/Cms/Model/BlockRepository.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Cms\Model; use Magento\Cms\Api\BlockRepositoryInterface; @@ -134,7 +135,7 @@ public function getById($blockId) $block = $this->blockFactory->create(); $this->resource->load($block, $blockId); if (!$block->getId()) { - throw new NoSuchEntityException(__('CMS Block with id "%1" does not exist.', $blockId)); + throw new NoSuchEntityException(__('The CMS block with the "%1" ID doesn\'t exist.', $blockId)); } return $block; } diff --git a/app/code/Magento/Cms/Model/GetBlockByIdentifier.php b/app/code/Magento/Cms/Model/GetBlockByIdentifier.php index 587785ce3d842..071e6225c82a2 100644 --- a/app/code/Magento/Cms/Model/GetBlockByIdentifier.php +++ b/app/code/Magento/Cms/Model/GetBlockByIdentifier.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Cms\Model; use Magento\Cms\Api\GetBlockByIdentifierInterface; @@ -46,7 +47,7 @@ public function execute(string $identifier, int $storeId) : BlockInterface $this->blockResource->load($block, $identifier, BlockInterface::IDENTIFIER); if (!$block->getId()) { - throw new NoSuchEntityException(__('CMS Block with identifier "%1" does not exist.', $identifier)); + throw new NoSuchEntityException(__('The CMS block with the "%1" ID doesn\'t exist.', $identifier)); } return $block; diff --git a/app/code/Magento/Cms/Model/GetPageByIdentifier.php b/app/code/Magento/Cms/Model/GetPageByIdentifier.php index d12e7749f7d7a..d3ad65fb01183 100644 --- a/app/code/Magento/Cms/Model/GetPageByIdentifier.php +++ b/app/code/Magento/Cms/Model/GetPageByIdentifier.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Cms\Model; use Magento\Cms\Api\Data\PageInterface; @@ -46,7 +47,7 @@ public function execute(string $identifier, int $storeId) : PageInterface $this->pageResource->load($page, $identifier, PageInterface::IDENTIFIER); if (!$page->getId()) { - throw new NoSuchEntityException(__('CMS Page with identifier "%1" does not exist.', $identifier)); + throw new NoSuchEntityException(__('The CMS page with the "%1" ID doesn\'t exist.', $identifier)); } return $page; diff --git a/app/code/Magento/Cms/Model/PageRepository.php b/app/code/Magento/Cms/Model/PageRepository.php index 9c9e18211aa86..65b23bce7e94c 100644 --- a/app/code/Magento/Cms/Model/PageRepository.php +++ b/app/code/Magento/Cms/Model/PageRepository.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Cms\Model; use Magento\Cms\Api\Data; @@ -137,7 +138,7 @@ public function getById($pageId) $page = $this->pageFactory->create(); $page->load($pageId); if (!$page->getId()) { - throw new NoSuchEntityException(__('CMS Page with id "%1" does not exist.', $pageId)); + throw new NoSuchEntityException(__('The CMS page with the "%1" ID doesn\'t exist.', $pageId)); } return $page; } diff --git a/app/code/Magento/Cms/Model/ResourceModel/Page.php b/app/code/Magento/Cms/Model/ResourceModel/Page.php index b836cf199632d..079d64d2882a5 100644 --- a/app/code/Magento/Cms/Model/ResourceModel/Page.php +++ b/app/code/Magento/Cms/Model/ResourceModel/Page.php @@ -117,13 +117,16 @@ protected function _beforeSave(AbstractModel $object) if (!$this->isValidPageIdentifier($object)) { throw new LocalizedException( - __('The page URL key contains capital letters or disallowed symbols.') + __( + "The page URL key can't use capital letters or disallowed symbols. " + . "Remove the letters and symbols and try again." + ) ); } if ($this->isNumericPageIdentifier($object)) { throw new LocalizedException( - __('The page URL key cannot be made of only numbers.') + __("The page URL key can't use only numbers. Add letters or words and try again.") ); } return parent::_beforeSave($object); diff --git a/app/code/Magento/Cms/Model/Wysiwyg/CompositeConfigProvider.php b/app/code/Magento/Cms/Model/Wysiwyg/CompositeConfigProvider.php index b2f32132ad3a4..a97529a7d4e45 100644 --- a/app/code/Magento/Cms/Model/Wysiwyg/CompositeConfigProvider.php +++ b/app/code/Magento/Cms/Model/Wysiwyg/CompositeConfigProvider.php @@ -130,12 +130,16 @@ public function processWysiwygConfig($config) /** * Returns active editor path * + * @param \Magento\Framework\DataObject $config * @return string */ - private function getActiveEditorPath() + private function getActiveEditorPath($config) { - if (!isset($this->activeEditorPath)) { - $this->activeEditorPath = $this->activeEditor->getWysiwygAdapterPath(); + if (!isset($this->activeEditorPath) || $this->activeEditorPath !== $config->getData('activeEditorPath')) { + $this->activeEditorPath = $config->getData('activeEditorPath') + ? $config->getData('activeEditorPath') + : $this->activeEditor->getWysiwygAdapterPath(); + $config->setData('activeEditorPath', $this->activeEditorPath); } return $this->activeEditorPath; } @@ -149,7 +153,7 @@ private function getActiveEditorPath() */ private function updateConfig($config, array $configProviders) { - $adapterType = $this->getActiveEditorPath(); + $adapterType = $this->getActiveEditorPath($config); //Extension point to update plugin settings by adapter type $providerClass = isset($configProviders[$adapterType]) ? $configProviders[$adapterType] diff --git a/app/code/Magento/Cms/Model/Wysiwyg/Config.php b/app/code/Magento/Cms/Model/Wysiwyg/Config.php index 9fdb27f0f02ef..5db3933dd1169 100644 --- a/app/code/Magento/Cms/Model/Wysiwyg/Config.php +++ b/app/code/Magento/Cms/Model/Wysiwyg/Config.php @@ -201,13 +201,13 @@ public function getConfig($data = []) $config->setData('directives_url_quoted', preg_quote($config->getData('directives_url'))); - if ($this->_authorization->isAllowed('Magento_Cms::media_gallery')) { - $this->configProvider->processGalleryConfig($config); - } - if (is_array($data)) { $config->addData($data); } + + if ($this->_authorization->isAllowed('Magento_Cms::media_gallery')) { + $this->configProvider->processGalleryConfig($config); + } if ($config->getData('add_widgets')) { $this->configProvider->processWidgetConfig($config); } diff --git a/app/code/Magento/Config/Console/Command/ConfigSet/ConfigSetProcessorFactory.php b/app/code/Magento/Config/Console/Command/ConfigSet/ConfigSetProcessorFactory.php index e005747ea5ed5..b884fc2d91f3b 100644 --- a/app/code/Magento/Config/Console/Command/ConfigSet/ConfigSetProcessorFactory.php +++ b/app/code/Magento/Config/Console/Command/ConfigSet/ConfigSetProcessorFactory.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Config\Console\Command\ConfigSet; use Magento\Config\Console\Command\ConfigSetCommand; @@ -65,7 +66,9 @@ public function __construct( public function create($processorName) { if (!isset($this->processors[$processorName])) { - throw new ConfigurationMismatchException(__('Class for type "%1" was not declared', $processorName)); + throw new ConfigurationMismatchException( + __('The class for "%1" type wasn\'t declared. Enter the class and try again.', $processorName) + ); } $object = $this->objectManager->create($this->processors[$processorName]); diff --git a/app/code/Magento/Config/Model/Config/Backend/Email/Address.php b/app/code/Magento/Config/Model/Config/Backend/Email/Address.php index 77fa787bcadc5..2d12884e7bc70 100644 --- a/app/code/Magento/Config/Model/Config/Backend/Email/Address.php +++ b/app/code/Magento/Config/Model/Config/Backend/Email/Address.php @@ -25,7 +25,9 @@ public function beforeSave() { $value = $this->getValue(); if (!\Zend_Validate::is($value, \Magento\Framework\Validator\EmailAddress::class)) { - throw new LocalizedException(__('Please correct the email address: "%1".', $value)); + throw new LocalizedException( + __('The "%1" email address is incorrect. Verify the email address and try again.', $value) + ); } return $this; } diff --git a/app/code/Magento/Config/Model/Config/Backend/Locale/Timezone.php b/app/code/Magento/Config/Model/Config/Backend/Locale/Timezone.php index 4e8be3623f399..cac4da2b52621 100644 --- a/app/code/Magento/Config/Model/Config/Backend/Locale/Timezone.php +++ b/app/code/Magento/Config/Model/Config/Backend/Locale/Timezone.php @@ -24,7 +24,7 @@ class Timezone extends \Magento\Framework\App\Config\Value public function beforeSave() { if (!in_array($this->getValue(), \DateTimeZone::listIdentifiers(\DateTimeZone::ALL))) { - throw new LocalizedException(__('Please correct the timezone.')); + throw new LocalizedException(__('The time zone is incorrect. Verify the time zone and try again.')); } return $this; } diff --git a/app/code/Magento/Config/Model/Config/Compiler/IncludeElement.php b/app/code/Magento/Config/Model/Config/Compiler/IncludeElement.php index 961931d6d28c1..5fc54fa1a8d1e 100644 --- a/app/code/Magento/Config/Model/Config/Compiler/IncludeElement.php +++ b/app/code/Magento/Config/Model/Config/Compiler/IncludeElement.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Config\Model\Config\Compiler; use Magento\Framework\DataObject; @@ -114,6 +115,6 @@ protected function getContent($includePath) return $directoryRead->readFile($path); } - throw new LocalizedException(__('The file "%1" does not exist', $path)); + throw new LocalizedException(__('The "%1" file doesn\'t exist.', $path)); } } diff --git a/app/code/Magento/Config/Model/Config/PathValidator.php b/app/code/Magento/Config/Model/Config/PathValidator.php index c7edbf51b7d36..68363bef69d91 100644 --- a/app/code/Magento/Config/Model/Config/PathValidator.php +++ b/app/code/Magento/Config/Model/Config/PathValidator.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Config\Model\Config; use Magento\Framework\Exception\ValidatorException; @@ -42,7 +43,7 @@ public function validate($path) $allPaths = $this->structure->getFieldPaths(); if (!array_key_exists($path, $allPaths)) { - throw new ValidatorException(__('The "%1" path does not exist', $path)); + throw new ValidatorException(__('The "%1" path doesn\'t exist. Verify and try again.', $path)); } return true; diff --git a/app/code/Magento/Config/Model/Config/Structure/Reader.php b/app/code/Magento/Config/Model/Config/Structure/Reader.php index 6c53991fcc372..d59f6dd7a40fd 100644 --- a/app/code/Magento/Config/Model/Config/Structure/Reader.php +++ b/app/code/Magento/Config/Model/Config/Structure/Reader.php @@ -6,6 +6,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Config\Model\Config\Structure; use Magento\Framework\DataObject; @@ -97,7 +98,10 @@ protected function _readFiles($fileList) } } catch (\Magento\Framework\Config\Dom\ValidationException $e) { throw new LocalizedException( - new \Magento\Framework\Phrase("Invalid XML in file %1:\n%2", [$key, $e->getMessage()]) + new \Magento\Framework\Phrase( + 'The XML in file "%1" is invalid:' . "\n%2\nVerify the XML and try again.", + [$key, $e->getMessage()] + ) ); } } diff --git a/app/code/Magento/Config/Test/Unit/Console/Command/ConfigSet/ConfigSetProcessorFactoryTest.php b/app/code/Magento/Config/Test/Unit/Console/Command/ConfigSet/ConfigSetProcessorFactoryTest.php index 1fa0310ca62eb..decb7d52a5e0c 100644 --- a/app/code/Magento/Config/Test/Unit/Console/Command/ConfigSet/ConfigSetProcessorFactoryTest.php +++ b/app/code/Magento/Config/Test/Unit/Console/Command/ConfigSet/ConfigSetProcessorFactoryTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Config\Test\Unit\Console\Command\ConfigSet; use Magento\Config\Console\Command\ConfigSet\ConfigSetProcessorFactory; @@ -64,7 +65,7 @@ public function testCreate() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Class for type "dummyType" was not declared + * @expectedExceptionMessage The class for "dummyType" type wasn't declared. Enter the class and try again. */ public function testCreateNonExisted() { diff --git a/app/code/Magento/Config/Test/Unit/Console/Command/ConfigSetCommandTest.php b/app/code/Magento/Config/Test/Unit/Console/Command/ConfigSetCommandTest.php index 39f9c47361352..0271de0da81f4 100644 --- a/app/code/Magento/Config/Test/Unit/Console/Command/ConfigSetCommandTest.php +++ b/app/code/Magento/Config/Test/Unit/Console/Command/ConfigSetCommandTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Config\Test\Unit\Console\Command; use Magento\Config\Console\Command\ConfigSet\ProcessorFacadeFactory; @@ -170,7 +171,9 @@ public function testExecuteWithException() ->willReturn(false); $this->emulatedAreProcessorMock->expects($this->once()) ->method('process') - ->willThrowException(new ValidatorException(__('The "test/test/test" path does not exists'))); + ->willThrowException( + new ValidatorException(__('The "test/test/test" path doesn\'t exist. Verify and try again.')) + ); $tester = new CommandTester($this->command); $tester->execute([ @@ -179,7 +182,7 @@ public function testExecuteWithException() ]); $this->assertContains( - __('The "test/test/test" path does not exists')->render(), + __('The "test/test/test" path doesn\'t exist. Verify and try again.')->render(), $tester->getDisplay() ); $this->assertSame(Cli::RETURN_FAILURE, $tester->getStatusCode()); diff --git a/app/code/Magento/Config/Test/Unit/Model/Compiler/IncludeElementTest.php b/app/code/Magento/Config/Test/Unit/Model/Compiler/IncludeElementTest.php index 451c73319d5bc..3197c04b12312 100644 --- a/app/code/Magento/Config/Test/Unit/Model/Compiler/IncludeElementTest.php +++ b/app/code/Magento/Config/Test/Unit/Model/Compiler/IncludeElementTest.php @@ -82,7 +82,7 @@ public function testCompileSuccess() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage The file "adminhtml/path/to/file.xml" does not exist + * @expectedExceptionMessage The "adminhtml/path/to/file.xml" file doesn't exist. */ public function testCompileException() { diff --git a/app/code/Magento/Config/Test/Unit/Model/Config/PathValidatorTest.php b/app/code/Magento/Config/Test/Unit/Model/Config/PathValidatorTest.php index b1d712a29cb5f..5a8ea95eff2b9 100644 --- a/app/code/Magento/Config/Test/Unit/Model/Config/PathValidatorTest.php +++ b/app/code/Magento/Config/Test/Unit/Model/Config/PathValidatorTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Config\Test\Unit\Model\Config; use Magento\Config\Model\Config\PathValidator; @@ -55,7 +56,7 @@ public function testValidate() /** * @expectedException \Magento\Framework\Exception\ValidatorException - * @expectedExceptionMessage The "test/test/test" path does not exist + * @expectedExceptionMessage The "test/test/test" path doesn't exist. Verify and try again. */ public function testValidateWithException() { diff --git a/app/code/Magento/Config/Test/Unit/Model/Config/Structure/ReaderTest.php b/app/code/Magento/Config/Test/Unit/Model/Config/Structure/ReaderTest.php index 7329fa82b73f6..9e107a545d76f 100644 --- a/app/code/Magento/Config/Test/Unit/Model/Config/Structure/ReaderTest.php +++ b/app/code/Magento/Config/Test/Unit/Model/Config/Structure/ReaderTest.php @@ -105,7 +105,7 @@ public function testReadSuccessNotValidatedCase() * Test the execution with the Validation exception of the 'read' method * * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Invalid XML in file file: + * @expectedExceptionMessage Verify the XML and try again. */ public function testReadWithValidationException() { diff --git a/app/code/Magento/ConfigurableProduct/Model/LinkManagement.php b/app/code/Magento/ConfigurableProduct/Model/LinkManagement.php index 01981b5dae9db..79c2dd812acf1 100644 --- a/app/code/Magento/ConfigurableProduct/Model/LinkManagement.php +++ b/app/code/Magento/ConfigurableProduct/Model/LinkManagement.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\ConfigurableProduct\Model; use Magento\Framework\Exception\InputException; @@ -115,19 +116,24 @@ public function addChild($sku, $childSku) $childrenIds = array_values($this->configurableType->getChildrenIds($product->getId())[0]); if (in_array($child->getId(), $childrenIds)) { - throw new StateException(__('Product has been already attached')); + throw new StateException(__('The product is already attached.')); } $configurableProductOptions = $product->getExtensionAttributes()->getConfigurableProductOptions(); if (empty($configurableProductOptions)) { - throw new StateException(__('Parent product does not have configurable product options')); + throw new StateException(__("The parent product doesn't have configurable product options.")); } $attributeIds = []; foreach ($configurableProductOptions as $configurableProductOption) { $attributeCode = $configurableProductOption->getProductAttribute()->getAttributeCode(); if (!$child->getData($attributeCode)) { - throw new StateException(__('Child product does not have attribute value %1', $attributeCode)); + throw new StateException( + __( + 'The child product doesn\'t have the "%1" attribute value. Verify the value and try again.', + $attributeCode + ) + ); } $attributeIds[] = $configurableProductOption->getAttributeId(); } @@ -152,7 +158,7 @@ public function removeChild($sku, $childSku) if ($product->getTypeId() != \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE) { throw new InputException( - __('Product with specified sku: %1 is not a configurable product', $sku) + __('The product with the "%1" SKU isn\'t a configurable product.', $sku) ); } @@ -165,7 +171,9 @@ public function removeChild($sku, $childSku) $ids[] = $option->getId(); } if (count($options) == count($ids)) { - throw new NoSuchEntityException(__('Requested option doesn\'t exist')); + throw new NoSuchEntityException( + __("The option that was requested doesn't exist. Verify the entity and try again.") + ); } $product->getExtensionAttributes()->setConfigurableProductLinks($ids); $this->productRepository->save($product); diff --git a/app/code/Magento/ConfigurableProduct/Model/OptionRepository.php b/app/code/Magento/ConfigurableProduct/Model/OptionRepository.php index bdf4a3678524e..b4db0a4db5fcd 100644 --- a/app/code/Magento/ConfigurableProduct/Model/OptionRepository.php +++ b/app/code/Magento/ConfigurableProduct/Model/OptionRepository.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\ConfigurableProduct\Model; use Magento\Catalog\Api\Data\ProductInterface; @@ -124,7 +125,9 @@ public function get($sku, $id) } } - throw new NoSuchEntityException(__('Requested option doesn\'t exist: %1', $id)); + throw new NoSuchEntityException( + __('The "%1" entity that was requested doesn\'t exist. Verify the entity and try again.', $id) + ); } /** @@ -150,14 +153,14 @@ public function delete(OptionInterface $option) $this->configurableType->resetConfigurableAttributes($product); } catch (\Exception $exception) { throw new StateException( - __('Cannot delete variations from product: %1', $entityId) + __('The variations from the "%1" product can\'t be deleted.', $entityId) ); } try { $this->optionResource->delete($option); } catch (\Exception $exception) { throw new StateException( - __('Cannot delete option with id: %1', $option->getId()) + __('The option with "%1" ID can\'t be deleted.', $option->getId()) ); } return true; @@ -173,7 +176,9 @@ public function deleteById($sku, $id) /** @var \Magento\ConfigurableProduct\Model\Product\Type\Configurable\Attribute $option */ $option = $attributeCollection->getItemById($id); if ($option === null) { - throw new NoSuchEntityException(__('Requested option doesn\'t exist')); + throw new NoSuchEntityException( + __("The option that was requested doesn't exist. Verify the entity and try again.") + ); } return $this->delete($option); } @@ -213,11 +218,11 @@ public function save($sku, OptionInterface $option) try { $option->save(); } catch (\Exception $e) { - throw new CouldNotSaveException(__('Something went wrong while saving option.')); + throw new CouldNotSaveException(__('An error occurred while saving the option. Please try to save again.')); } if (!$option->getId()) { - throw new CouldNotSaveException(__('Something went wrong while saving option.')); + throw new CouldNotSaveException(__('An error occurred while saving the option. Please try to save again.')); } return $option->getId(); } @@ -234,7 +239,7 @@ private function getProduct($sku) $product = $this->productRepository->get($sku); if (\Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE !== $product->getTypeId()) { throw new InputException( - __('Only implemented for configurable product: %1', $sku) + __('This is implemented for the "%1" configurable product only.', $sku) ); } return $product; @@ -252,7 +257,7 @@ private function getProductById($id) $product = $this->productRepository->getById($id); if (\Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE !== $product->getTypeId()) { throw new InputException( - __('Only implemented for configurable product: %1', $id) + __('This is implemented for the "%1" configurable product only.', $id) ); } return $product; diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/VariationHandler.php b/app/code/Magento/ConfigurableProduct/Model/Product/VariationHandler.php index a462a5ffd9edd..73e7f9053fa4a 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Product/VariationHandler.php +++ b/app/code/Magento/ConfigurableProduct/Model/Product/VariationHandler.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\ConfigurableProduct\Model\Product; use Magento\Catalog\Model\Product\Type as ProductType; @@ -96,7 +97,9 @@ public function generateSimpleProducts($parentProduct, $productsData) $configurableAttribute = json_decode($simpleProductData['configurable_attribute'], true); unset($simpleProductData['configurable_attribute']); } else { - throw new LocalizedException(__('Configuration must have specified attributes')); + throw new LocalizedException( + __('Contribution must have attributes specified. Enter attributes and try again.') + ); } $this->fillSimpleProductData( diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/LinkManagementTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/LinkManagementTest.php index acbb976318b3b..ad2fcd1e59360 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/LinkManagementTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/LinkManagementTest.php @@ -235,7 +235,7 @@ public function testAddChild() /** * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Product has been already attached + * @expectedExceptionMessage The product is already attached. */ public function testAddChildStateException() { diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/OptionRepositoryTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/OptionRepositoryTest.php index 2d824e52c7244..8f3f3979b8669 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/OptionRepositoryTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/OptionRepositoryTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\ConfigurableProduct\Test\Unit\Model; use Magento\Catalog\Api\ProductRepositoryInterface; @@ -113,7 +114,7 @@ public function testGet() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Only implemented for configurable product: configurable + * @expectedExceptionMessage This is implemented for the "configurable" configurable product only. */ public function testGetNotConfigurableProduct() { @@ -141,7 +142,7 @@ public function testGetNotConfigurableProduct() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Only implemented for configurable product: 3 + * @expectedExceptionMessage This is implemented for the "3" configurable product only. */ public function testGetNotProductById() { @@ -168,7 +169,7 @@ public function testGetNotProductById() /** * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Cannot delete variations from product: 3 + * @expectedExceptionMessage The variations from the "3" product can't be deleted. */ public function testDeleteCantSaveProducts() { @@ -200,7 +201,7 @@ public function testDeleteCantSaveProducts() /** * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Cannot delete option with id: 33 + * @expectedExceptionMessage The option with "33" ID can't be deleted. */ public function testDeleteCantDeleteOption() { @@ -276,7 +277,7 @@ public function testDelete() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Requested option doesn't exist: 3 + * @expectedExceptionMessage The "3" entity that was requested doesn't exist. Verify the entity and try again. */ public function testGetEmptyExtensionAttribute() { @@ -329,7 +330,7 @@ public function testGetList() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Only implemented for configurable product: configurable + * @expectedExceptionMessage This is implemented for the "configurable" configurable product only. */ public function testGetListNotConfigurableProduct() { diff --git a/app/code/Magento/Contact/Controller/Index/Post.php b/app/code/Magento/Contact/Controller/Index/Post.php index ee2d23b74df24..b51e3c9189502 100644 --- a/app/code/Magento/Contact/Controller/Index/Post.php +++ b/app/code/Magento/Contact/Controller/Index/Post.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Contact\Controller\Index; use Magento\Contact\Model\ConfigInterface; @@ -119,13 +120,13 @@ private function validatedParams() { $request = $this->getRequest(); if (trim($request->getParam('name')) === '') { - throw new LocalizedException(__('Name is missing')); + throw new LocalizedException(__('Enter the Name and try again.')); } if (trim($request->getParam('comment')) === '') { - throw new LocalizedException(__('Comment is missing')); + throw new LocalizedException(__('Enter the comment and try again.')); } if (false === \strpos($request->getParam('email'), '@')) { - throw new LocalizedException(__('Invalid email address')); + throw new LocalizedException(__('The email address is invalid. Verify the email address and try again.')); } if (trim($request->getParam('hideit')) !== '') { throw new \Exception(); diff --git a/app/code/Magento/Cron/Model/Schedule.php b/app/code/Magento/Cron/Model/Schedule.php index 39a58ef360cb3..b127ecae6f98d 100644 --- a/app/code/Magento/Cron/Model/Schedule.php +++ b/app/code/Magento/Cron/Model/Schedule.php @@ -87,7 +87,7 @@ public function setCronExpr($expr) { $e = preg_split('#\s+#', $expr, null, PREG_SPLIT_NO_EMPTY); if (sizeof($e) < 5 || sizeof($e) > 6) { - throw new CronException(__('Invalid cron expression: %1', $expr)); + throw new CronException(__('The "%1" cron expression is invalid. Verify and try again.', $expr)); } $this->setCronExprArr($e); @@ -184,7 +184,7 @@ public function matchCronExpression($expr, $num) } if ($from === false || $to === false) { - throw new CronException(__('Invalid cron expression: %1', $expr)); + throw new CronException(__('The "%1" cron expression is invalid. Verify and try again.', $expr)); } return $num >= $from && $num <= $to && $num % $mod === 0; diff --git a/app/code/Magento/Cron/Test/Unit/Model/ScheduleTest.php b/app/code/Magento/Cron/Test/Unit/Model/ScheduleTest.php index e9f4c61c7f551..dd1fa0e79dc67 100644 --- a/app/code/Magento/Cron/Test/Unit/Model/ScheduleTest.php +++ b/app/code/Magento/Cron/Test/Unit/Model/ScheduleTest.php @@ -311,7 +311,7 @@ public function matchCronExpressionExceptionDataProvider() return [ ['1/2/3'], //Invalid cron expression, expecting 'match/modulus': 1/2/3 ['1/'], //Invalid cron expression, expecting numeric modulus: 1/ - ['-'], //Invalid cron expression + ['-'], //The "-" cron expression is invalid. Verify and try again. ['1-2-3'], //Invalid cron expression, expecting 'from-to' structure: 1-2-3 ]; } diff --git a/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency/FetchRates.php b/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency/FetchRates.php index b16330f1b3f98..38e20355b6699 100644 --- a/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency/FetchRates.php +++ b/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency/FetchRates.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CurrencySymbol\Controller\Adminhtml\System\Currency; use Magento\Framework\Exception\LocalizedException; @@ -24,14 +25,16 @@ public function execute() $service = $this->getRequest()->getParam('rate_services'); $this->_getSession()->setCurrencyRateService($service); if (!$service) { - throw new LocalizedException(__('Please specify a correct Import Service.')); + throw new LocalizedException(__('The Import Service is incorrect. Verify the service and try again.')); } try { /** @var \Magento\Directory\Model\Currency\Import\ImportInterface $importModel */ $importModel = $this->_objectManager->get(\Magento\Directory\Model\Currency\Import\Factory::class) ->create($service); } catch (\Exception $e) { - throw new LocalizedException(__('We can\'t initialize the import model.')); + throw new LocalizedException( + __("The import model can't be initialized. Verify the model and try again.") + ); } $rates = $importModel->fetchRates(); $errors = $importModel->getMessages(); diff --git a/app/code/Magento/Customer/Controller/Account/EditPost.php b/app/code/Magento/Customer/Controller/Account/EditPost.php index 3f895ad2f17ac..a10795533a2a5 100644 --- a/app/code/Magento/Customer/Controller/Account/EditPost.php +++ b/app/code/Magento/Customer/Controller/Account/EditPost.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Customer\Controller\Account; use Magento\Customer\Model\AuthenticationInterface; @@ -168,7 +169,8 @@ public function execute() $this->messageManager->addError($e->getMessage()); } catch (UserLockedException $e) { $message = __( - 'You did not sign in correctly or your account is temporarily disabled.' + 'The account sign-in was incorrect or your account is disabled temporarily. ' + . 'Please wait and try again later.' ); $this->session->logout(); $this->session->start(); @@ -287,7 +289,9 @@ private function processChangeEmailRequest(\Magento\Customer\Api\Data\CustomerIn $this->getRequest()->getPost('current_password') ); } catch (InvalidEmailOrPasswordException $e) { - throw new InvalidEmailOrPasswordException(__('The password doesn\'t match this account.')); + throw new InvalidEmailOrPasswordException( + __("The password doesn't match this account. Verify the password and try again.") + ); } } } diff --git a/app/code/Magento/Customer/Controller/Account/ForgotPasswordPost.php b/app/code/Magento/Customer/Controller/Account/ForgotPasswordPost.php index fe92032b1b75e..f302473873087 100644 --- a/app/code/Magento/Customer/Controller/Account/ForgotPasswordPost.php +++ b/app/code/Magento/Customer/Controller/Account/ForgotPasswordPost.php @@ -66,7 +66,9 @@ public function execute() if ($email) { if (!\Zend_Validate::is($email, \Magento\Framework\Validator\EmailAddress::class)) { $this->session->setForgottenEmail($email); - $this->messageManager->addErrorMessage(__('Please correct the email address.')); + $this->messageManager->addErrorMessage( + __('The email address is incorrect. Verify the email address and try again.') + ); return $resultRedirect->setPath('*/*/forgotpassword'); } diff --git a/app/code/Magento/Customer/Controller/Account/LoginPost.php b/app/code/Magento/Customer/Controller/Account/LoginPost.php index b55863a3b486a..31e2a3aeca9e3 100644 --- a/app/code/Magento/Customer/Controller/Account/LoginPost.php +++ b/app/code/Magento/Customer/Controller/Account/LoginPost.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Customer\Controller\Account; use Magento\Customer\Model\Account\Redirect as AccountRedirect; @@ -175,12 +176,16 @@ public function execute() $this->session->setUsername($login['username']); } catch (UserLockedException $e) { $message = __( - 'You did not sign in correctly or your account is temporarily disabled.' + 'The account sign-in was incorrect or your account is disabled temporarily. ' + . 'Please wait and try again later.' ); $this->messageManager->addError($message); $this->session->setUsername($login['username']); } catch (AuthenticationException $e) { - $message = __('You did not sign in correctly or your account is temporarily disabled.'); + $message = __( + 'The account sign-in was incorrect or your account is disabled temporarily. ' + . 'Please wait and try again later.' + ); $this->messageManager->addError($message); $this->session->setUsername($login['username']); } catch (LocalizedException $e) { diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart.php b/app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart.php index c0ea38de809db..2603ac193e007 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Customer\Controller\Adminhtml\Cart\Product\Composite; use Magento\Backend\App\Action; @@ -78,7 +79,7 @@ protected function _initData() { $this->_customerId = (int)$this->getRequest()->getParam('customer_id'); if (!$this->_customerId) { - throw new \Magento\Framework\Exception\LocalizedException(__('No customer ID defined.')); + throw new \Magento\Framework\Exception\LocalizedException(__("The customer ID isn't defined.")); } $quoteItemId = (int)$this->getRequest()->getParam('id'); @@ -95,7 +96,7 @@ protected function _initData() $this->_quoteItem = $this->_quote->getItemById($quoteItemId); if (!$this->_quoteItem) { - throw new LocalizedException(__('Please correct the quote items and try again.')); + throw new LocalizedException(__('The quote items are incorrect. Verify the quote items and try again.')); } return $this; diff --git a/app/code/Magento/Customer/CustomerData/SectionPool.php b/app/code/Magento/Customer/CustomerData/SectionPool.php index 26e9140c63df5..0e0d7b992e33a 100644 --- a/app/code/Magento/Customer/CustomerData/SectionPool.php +++ b/app/code/Magento/Customer/CustomerData/SectionPool.php @@ -74,7 +74,7 @@ protected function getSectionDataByNames($sectionNames) $data = []; foreach ($sectionNames as $sectionName) { if (!isset($this->sectionSourceMap[$sectionName])) { - throw new LocalizedException(__('"%1" section source is not supported', $sectionName)); + throw new LocalizedException(__('The "%1" section source isn\'t supported.', $sectionName)); } $data[$sectionName] = $this->get($this->sectionSourceMap[$sectionName])->getSectionData(); } diff --git a/app/code/Magento/Customer/Model/AccountManagement.php b/app/code/Magento/Customer/Model/AccountManagement.php index c48680f3cdb52..cd5fef7316999 100644 --- a/app/code/Magento/Customer/Model/AccountManagement.php +++ b/app/code/Magento/Customer/Model/AccountManagement.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Customer\Model; use Magento\Customer\Api\AccountManagementInterface; @@ -417,7 +418,7 @@ public function resendConfirmation($email, $websiteId = null, $redirectUrl = '') { $customer = $this->customerRepository->get($email, $websiteId); if (!$customer->getConfirmation()) { - throw new InvalidTransitionException(__('No confirmation needed.')); + throw new InvalidTransitionException(__("Confirmation isn't needed.")); } try { @@ -464,11 +465,11 @@ private function activateCustomer($customer, $confirmationKey) { // check if customer is inactive if (!$customer->getConfirmation()) { - throw new InvalidTransitionException(__('Account already active')); + throw new InvalidTransitionException(__('The account is already active.')); } if ($customer->getConfirmation() !== $confirmationKey) { - throw new InputMismatchException(__('Invalid confirmation token')); + throw new InputMismatchException(__('The confirmation token is invalid. Verify the token and try again.')); } $customer->setConfirmation(null); @@ -503,7 +504,7 @@ public function authenticate($username, $password) throw new InvalidEmailOrPasswordException(__('Invalid login or password.')); } if ($customer->getConfirmation() && $this->isConfirmationRequired($customer)) { - throw new EmailNotConfirmedException(__('This account is not confirmed.')); + throw new EmailNotConfirmedException(__("This account isn't confirmed. Verify and try again.")); } $customerModel = $this->customerFactory->create()->updateData($customer); @@ -619,13 +620,15 @@ protected function checkPasswordStrength($password) if ($length < $configMinPasswordLength) { throw new InputException( __( - 'Please enter a password with at least %1 characters.', + 'The password needs at least %1 characters. Create a new password and try again.', $configMinPasswordLength ) ); } if ($this->stringHelper->strlen(trim($password)) != $length) { - throw new InputException(__('The password can\'t begin or end with a space.')); + throw new InputException( + __("The password can't begin or end with a space. Verify the password and try again.") + ); } $requiredCharactersCheck = $this->makeRequiredCharactersCheck($password); @@ -709,7 +712,9 @@ public function createAccount(CustomerInterface $customer, $password = null, $re try { $this->credentialsValidator->checkPasswordDifferentFromEmail($customerEmail, $password); } catch (InputException $e) { - throw new LocalizedException(__('Password cannot be the same as email address.')); + throw new LocalizedException( + __("The password can't be the same as the email address. Create a new password and try again.") + ); } $hash = $this->createPasswordHash($password); } else { @@ -766,7 +771,7 @@ public function createAccountWithPasswordHash(CustomerInterface $customer, $hash $customer = $this->customerRepository->save($customer, $hash); } catch (AlreadyExistsException $e) { throw new InputMismatchException( - __('A customer with the same email already exists in an associated website.') + __('A customer with the same email address already exists in an associated website.') ); } catch (LocalizedException $e) { throw $e; @@ -880,7 +885,9 @@ private function changePasswordForCustomer($customer, $currentPassword, $newPass try { $this->getAuthentication()->authenticate($customer->getId(), $currentPassword); } catch (InvalidEmailOrPasswordException $e) { - throw new InvalidEmailOrPasswordException(__('The password doesn\'t match this account.')); + throw new InvalidEmailOrPasswordException( + __("The password doesn't match this account. Verify the password and try again.") + ); } $customerEmail = $customer->getEmail(); $this->credentialsValidator->checkPasswordDifferentFromEmail($customerEmail, $newPassword); @@ -996,7 +1003,7 @@ private function validateResetPasswordToken($customerId, $resetPasswordLinkToken } if (!is_string($resetPasswordLinkToken) || empty($resetPasswordLinkToken)) { $params = ['fieldName' => 'resetPasswordLinkToken']; - throw new InputException(__('%fieldName is a required field.', $params)); + throw new InputException(__('"%fieldName" is required. Enter and try again.', $params)); } $customerSecureData = $this->customerRegistry->retrieveSecureData($customerId); @@ -1004,9 +1011,9 @@ private function validateResetPasswordToken($customerId, $resetPasswordLinkToken $rpTokenCreatedAt = $customerSecureData->getRpTokenCreatedAt(); if (!Security::compareStrings($rpToken, $resetPasswordLinkToken)) { - throw new InputMismatchException(__('Reset password token mismatch.')); + throw new InputMismatchException(__('The password token is mismatched. Reset and try again.')); } elseif ($this->isResetPasswordLinkTokenExpired($rpToken, $rpTokenCreatedAt)) { - throw new ExpiredException(__('Reset password token expired.')); + throw new ExpiredException(__('The password token is expired. Reset and try again.')); } return true; @@ -1048,7 +1055,9 @@ protected function sendNewAccountEmail( $types = $this->getTemplateTypes(); if (!isset($types[$type])) { - throw new LocalizedException(__('Please correct the transactional account email type.')); + throw new LocalizedException( + __('The transactional account email type is incorrect. Verify and try again.') + ); } if (!$storeId) { diff --git a/app/code/Magento/Customer/Model/Address/AbstractAddress.php b/app/code/Magento/Customer/Model/Address/AbstractAddress.php index 521e233d9cfbb..aab9a811168f9 100644 --- a/app/code/Magento/Customer/Model/Address/AbstractAddress.php +++ b/app/code/Magento/Customer/Model/Address/AbstractAddress.php @@ -578,36 +578,36 @@ public function validate() $errors = []; if (!\Zend_Validate::is($this->getFirstname(), 'NotEmpty')) { - $errors[] = __('%fieldName is a required field.', ['fieldName' => 'firstname']); + $errors[] = __('"%fieldName" is required. Enter and try again.', ['fieldName' => 'firstname']); } if (!\Zend_Validate::is($this->getLastname(), 'NotEmpty')) { - $errors[] = __('%fieldName is a required field.', ['fieldName' => 'lastname']); + $errors[] = __('"%fieldName" is required. Enter and try again.', ['fieldName' => 'lastname']); } if (!\Zend_Validate::is($this->getStreetLine(1), 'NotEmpty')) { - $errors[] = __('%fieldName is a required field.', ['fieldName' => 'street']); + $errors[] = __('"%fieldName" is required. Enter and try again.', ['fieldName' => 'street']); } if (!\Zend_Validate::is($this->getCity(), 'NotEmpty')) { - $errors[] = __('%fieldName is a required field.', ['fieldName' => 'city']); + $errors[] = __('"%fieldName" is required. Enter and try again.', ['fieldName' => 'city']); } if ($this->isTelephoneRequired()) { if (!\Zend_Validate::is($this->getTelephone(), 'NotEmpty')) { - $errors[] = __('%fieldName is a required field.', ['fieldName' => 'telephone']); + $errors[] = __('"%fieldName" is required. Enter and try again.', ['fieldName' => 'telephone']); } } if ($this->isFaxRequired()) { if (!\Zend_Validate::is($this->getFax(), 'NotEmpty')) { - $errors[] = __('%fieldName is a required field.', ['fieldName' => 'fax']); + $errors[] = __('"%fieldName" is required. Enter and try again.', ['fieldName' => 'fax']); } } if ($this->isCompanyRequired()) { if (!\Zend_Validate::is($this->getCompany(), 'NotEmpty')) { - $errors[] = __('%fieldName is a required field.', ['fieldName' => 'company']); + $errors[] = __('"%fieldName" is required. Enter and try again.', ['fieldName' => 'company']); } } @@ -620,11 +620,11 @@ public function validate() 'NotEmpty' ) ) { - $errors[] = __('%fieldName is a required field.', ['fieldName' => 'postcode']); + $errors[] = __('"%fieldName" is required. Enter and try again.', ['fieldName' => 'postcode']); } if (!\Zend_Validate::is($this->getCountryId(), 'NotEmpty')) { - $errors[] = __('%fieldName is a required field.', ['fieldName' => 'countryId']); + $errors[] = __('"%fieldName" is required. Enter and try again.', ['fieldName' => 'countryId']); } if ($this->getCountryModel()->getRegionCollection()->getSize() && !\Zend_Validate::is( @@ -634,7 +634,7 @@ public function validate() $this->getCountryId() ) ) { - $errors[] = __('%fieldName is a required field.', ['fieldName' => 'regionId']); + $errors[] = __('"%fieldName" is required. Enter and try again.', ['fieldName' => 'regionId']); } if (empty($errors)) { diff --git a/app/code/Magento/Customer/Model/Customer.php b/app/code/Magento/Customer/Model/Customer.php index e0a7281776de9..6d1c1549216e8 100644 --- a/app/code/Magento/Customer/Model/Customer.php +++ b/app/code/Magento/Customer/Model/Customer.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Customer\Model; use Magento\Customer\Api\CustomerMetadataInterface; @@ -392,7 +393,7 @@ public function authenticate($login, $password) $this->loadByEmail($login); if ($this->getConfirmation() && $this->isConfirmationRequired()) { throw new EmailNotConfirmedException( - __('This account is not confirmed.') + __("This account isn't confirmed. Verify and try again.") ); } if (!$this->validatePassword($password)) { @@ -762,7 +763,7 @@ public function sendNewAccountEmail($type = 'registered', $backUrl = '', $storeI if (!isset($types[$type])) { throw new \Magento\Framework\Exception\LocalizedException( - __('Please correct the transactional account email type.') + __('The transactional account email type is incorrect. Verify and try again.') ); } @@ -1240,7 +1241,7 @@ public function changeResetPasswordLinkToken($passwordLinkToken) { if (!is_string($passwordLinkToken) || empty($passwordLinkToken)) { throw new AuthenticationException( - __('Please enter a valid password reset token.') + __('A valid password reset token is missing. Enter and try again.') ); } $this->_getResource()->changeResetPasswordLinkToken($this, $passwordLinkToken); diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php index abdec5535e86b..a74838a1a7812 100644 --- a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php +++ b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Customer\Model\Customer\Attribute\Backend; use Magento\Framework\Exception\LocalizedException; @@ -50,12 +51,17 @@ public function beforeSave($object) if ($length > 0) { if ($length < self::MIN_PASSWORD_LENGTH) { throw new LocalizedException( - __('Please enter a password with at least %1 characters.', self::MIN_PASSWORD_LENGTH) + __( + 'The password needs at least %1 characters. Create a new password and try again.', + self::MIN_PASSWORD_LENGTH + ) ); } if (trim($password) !== $password) { - throw new LocalizedException(__('The password can not begin or end with a space.')); + throw new LocalizedException( + __("The password can't begin or end with a space. Verify the password and try again.") + ); } $object->setPasswordHash($object->hashPassword($password)); diff --git a/app/code/Magento/Customer/Model/Customer/CredentialsValidator.php b/app/code/Magento/Customer/Model/Customer/CredentialsValidator.php index b8adeec2f8017..a7682bde905b6 100644 --- a/app/code/Magento/Customer/Model/Customer/CredentialsValidator.php +++ b/app/code/Magento/Customer/Model/Customer/CredentialsValidator.php @@ -25,7 +25,9 @@ class CredentialsValidator public function checkPasswordDifferentFromEmail($email, $password) { if (strcasecmp($password, $email) == 0) { - throw new InputException(__('Password cannot be the same as email address.')); + throw new InputException( + __("The password can't be the same as the email address. Create a new password and try again.") + ); } } } diff --git a/app/code/Magento/Customer/Model/EmailNotification.php b/app/code/Magento/Customer/Model/EmailNotification.php index 14ae9a885c7b1..53c16a4b37093 100644 --- a/app/code/Magento/Customer/Model/EmailNotification.php +++ b/app/code/Magento/Customer/Model/EmailNotification.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Customer\Model; use Magento\Framework\App\Config\ScopeConfigInterface; @@ -356,7 +357,9 @@ public function newAccount( $types = self::TEMPLATE_TYPES; if (!isset($types[$type])) { - throw new LocalizedException(__('Please correct the transactional account email type.')); + throw new LocalizedException( + __('The transactional account email type is incorrect. Verify and try again.') + ); } if (!$storeId) { diff --git a/app/code/Magento/Customer/Model/ResourceModel/Customer.php b/app/code/Magento/Customer/Model/ResourceModel/Customer.php index 7e5f9d51549ec..f510201559687 100644 --- a/app/code/Magento/Customer/Model/ResourceModel/Customer.php +++ b/app/code/Magento/Customer/Model/ResourceModel/Customer.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Customer\Model\ResourceModel; use Magento\Customer\Model\Customer\NotificationStorage; @@ -111,7 +112,7 @@ protected function _beforeSave(\Magento\Framework\DataObject $customer) parent::_beforeSave($customer); if (!$customer->getEmail()) { - throw new ValidatorException(__('Please enter a customer email.')); + throw new ValidatorException(__('The customer email is missing. Enter and try again.')); } $connection = $this->getConnection(); @@ -135,7 +136,7 @@ protected function _beforeSave(\Magento\Framework\DataObject $customer) $result = $connection->fetchOne($select, $bind); if ($result) { throw new AlreadyExistsException( - __('A customer with the same email already exists in an associated website.') + __('A customer with the same email address already exists in an associated website.') ); } @@ -242,7 +243,7 @@ public function loadByEmail(\Magento\Customer\Model\Customer $customer, $email) if ($customer->getSharingConfig()->isWebsiteScope()) { if (!$customer->hasData('website_id')) { throw new \Magento\Framework\Exception\LocalizedException( - __('A customer website ID must be specified when using the website scope.') + __("A customer website ID wasn't specified. The ID must be specified to use the website scope.") ); } $bind['website_id'] = (int)$customer->getWebsiteId(); diff --git a/app/code/Magento/Customer/Model/ResourceModel/GroupRepository.php b/app/code/Magento/Customer/Model/ResourceModel/GroupRepository.php index d004b99c5a3c9..cb73b7ee1cb36 100644 --- a/app/code/Magento/Customer/Model/ResourceModel/GroupRepository.php +++ b/app/code/Magento/Customer/Model/ResourceModel/GroupRepository.php @@ -305,7 +305,7 @@ private function _validate($group) { $exception = new InputException(); if (!\Zend_Validate::is($group->getCode(), 'NotEmpty')) { - $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'code'])); + $exception->addError(__('"%fieldName" is required. Enter and try again.', ['fieldName' => 'code'])); } if ($exception->wasErrorAdded()) { diff --git a/app/code/Magento/Customer/Test/Unit/Controller/Account/EditPostTest.php b/app/code/Magento/Customer/Test/Unit/Controller/Account/EditPostTest.php index f2860725dbbae..aaa1c17027928 100644 --- a/app/code/Magento/Customer/Test/Unit/Controller/Account/EditPostTest.php +++ b/app/code/Magento/Customer/Test/Unit/Controller/Account/EditPostTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Customer\Test\Unit\Controller\Account; use Magento\Customer\Api\CustomerRepositoryInterface; @@ -394,12 +395,13 @@ public function changeEmailExceptionDataProvider() [ 'testNumber' => 1, 'exceptionClass' => \Magento\Framework\Exception\InvalidEmailOrPasswordException::class, - 'errorMessage' => __('The password doesn\'t match this account.') + 'errorMessage' => __("The password doesn't match this account. Verify the password and try again.") ], [ 'testNumber' => 2, 'exceptionClass' => \Magento\Framework\Exception\State\UserLockedException::class, - 'errorMessage' => __('You did not sign in correctly or your account is temporarily disabled.') + 'errorMessage' => __('The account sign-in was incorrect or your account is disabled temporarily. ' + . 'Please wait and try again later.') ] ]; } diff --git a/app/code/Magento/Customer/Test/Unit/Controller/Account/LoginPostTest.php b/app/code/Magento/Customer/Test/Unit/Controller/Account/LoginPostTest.php index 8e07f41cff5a7..762c76b695dee 100644 --- a/app/code/Magento/Customer/Test/Unit/Controller/Account/LoginPostTest.php +++ b/app/code/Magento/Customer/Test/Unit/Controller/Account/LoginPostTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Customer\Test\Unit\Controller\Account; use Magento\Customer\Api\AccountManagementInterface; @@ -563,7 +564,12 @@ protected function mockExceptions($exception, $username) case \Magento\Framework\Exception\AuthenticationException::class: $this->messageManager->expects($this->once()) ->method('addError') - ->with(__('You did not sign in correctly or your account is temporarily disabled.')) + ->with( + __( + 'The account sign-in was incorrect or your account is disabled temporarily. ' + . 'Please wait and try again later.' + ) + ) ->willReturnSelf(); $this->session->expects($this->once()) @@ -581,7 +587,8 @@ protected function mockExceptions($exception, $username) case \Magento\Framework\Exception\State\UserLockedException::class: $message = __( - 'You did not sign in correctly or your account is temporarily disabled.' + 'The account sign-in was incorrect or your account is disabled temporarily. ' + . 'Please wait and try again later.' ); $this->messageManager->expects($this->once()) ->method('addError') diff --git a/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php b/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php index fed2005ade8e2..0ca79833e8a13 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Customer\Test\Unit\Model; use Magento\Customer\Model\AccountManagement; @@ -723,7 +724,8 @@ public function testCreateAccountWithPasswordInputException( if ($testNumber == 1) { $this->expectException( \Magento\Framework\Exception\InputException::class, - 'Please enter a password with at least ' . $minPasswordLength . ' characters.' + 'The password needs at least ' . $minPasswordLength . ' characters. ' + . 'Create a new password and try again.' ); } @@ -1214,7 +1216,7 @@ public function testValidateResetPasswordTokenBadCustomerId() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage resetPasswordLinkToken is a required field + * @expectedExceptionMessage "resetPasswordLinkToken" is required. Enter and try again. */ public function testValidateResetPasswordTokenBadResetPasswordLinkToken() { @@ -1223,7 +1225,7 @@ public function testValidateResetPasswordTokenBadResetPasswordLinkToken() /** * @expectedException \Magento\Framework\Exception\State\InputMismatchException - * @expectedExceptionMessage Reset password token mismatch + * @expectedExceptionMessage The password token is mismatched. Reset and try again. */ public function testValidateResetPasswordTokenTokenMismatch() { @@ -1236,7 +1238,7 @@ public function testValidateResetPasswordTokenTokenMismatch() /** * @expectedException \Magento\Framework\Exception\State\ExpiredException - * @expectedExceptionMessage Reset password token expired + * @expectedExceptionMessage The password token is expired. Reset and try again. */ public function testValidateResetPasswordTokenTokenExpired() { diff --git a/app/code/Magento/Customer/Test/Unit/Model/Address/AbstractAddressTest.php b/app/code/Magento/Customer/Test/Unit/Model/Address/AbstractAddressTest.php index 2eef9a44cab74..a94b7e39bc0eb 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Address/AbstractAddressTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Address/AbstractAddressTest.php @@ -327,31 +327,31 @@ public function validateDataProvider() return [ 'firstname' => [ array_merge(array_diff_key($data, ['firstname' => '']), ['country_id' => $countryId++]), - ['firstname is a required field.'], + ['"firstname" is required. Enter and try again.'], ], 'lastname' => [ array_merge(array_diff_key($data, ['lastname' => '']), ['country_id' => $countryId++]), - ['lastname is a required field.'], + ['"lastname" is required. Enter and try again.'], ], 'street' => [ array_merge(array_diff_key($data, ['street' => '']), ['country_id' => $countryId++]), - ['street is a required field.'], + ['"street" is required. Enter and try again.'], ], 'city' => [ array_merge(array_diff_key($data, ['city' => '']), ['country_id' => $countryId++]), - ['city is a required field.'], + ['"city" is required. Enter and try again.'], ], 'telephone' => [ array_merge(array_diff_key($data, ['telephone' => '']), ['country_id' => $countryId++]), - ['telephone is a required field.'], + ['"telephone" is required. Enter and try again.'], ], 'postcode' => [ array_merge(array_diff_key($data, ['postcode' => '']), ['country_id' => $countryId++]), - ['postcode is a required field.'], + ['"postcode" is required. Enter and try again.'], ], 'country_id' => [ array_diff_key($data, ['country_id' => '']), - ['countryId is a required field.'], + ['"countryId" is required. Enter and try again.'], ], 'validated' => [array_merge($data, ['country_id' => $countryId++]), true], ]; diff --git a/app/code/Magento/Customer/Test/Unit/Model/Customer/CredentialsValidatorTest.php b/app/code/Magento/Customer/Test/Unit/Model/Customer/CredentialsValidatorTest.php index 07aef85e92d08..36667e0ccf6c3 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Customer/CredentialsValidatorTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Customer/CredentialsValidatorTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Customer\Test\Unit\Model\Customer; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; @@ -29,7 +30,6 @@ protected function setUp() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Password cannot be the same as email address. */ public function testCheckPasswordDifferentFromEmail() { @@ -37,5 +37,9 @@ public function testCheckPasswordDifferentFromEmail() $password = strtoupper($email); // for case-insensitive check $this->object->checkPasswordDifferentFromEmail($email, $password); + + $this->expectExceptionMessage( + "The password can't be the same as the email address. Create a new password and try again." + ); } } diff --git a/app/code/Magento/Customer/Test/Unit/Model/CustomerTest.php b/app/code/Magento/Customer/Test/Unit/Model/CustomerTest.php index f5b7f08d2906d..9848a09540cb0 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/CustomerTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/CustomerTest.php @@ -134,7 +134,7 @@ public function testHashPassword() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Please correct the transactional account email type. + * @expectedExceptionMessage The transactional account email type is incorrect. Verify and try again. */ public function testSendNewAccountEmailException() { diff --git a/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/AddressRepositoryTest.php b/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/AddressRepositoryTest.php index f2ccc50dc68d0..070e5e59e3f99 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/AddressRepositoryTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/AddressRepositoryTest.php @@ -275,13 +275,13 @@ public function testSaveWithInvalidRegion() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage regionId is a required field. + * @expectedExceptionMessage "regionId" is required. Enter and try again. */ public function testSaveWithInvalidRegionId() { $customerId = 34; $addressId = 53; - $errors[] = __('regionId is a required field.'); + $errors[] = __('"regionId" is required. Enter and try again.'); $customerAddress = $this->getMockForAbstractClass( \Magento\Customer\Api\Data\AddressInterface::class, [], diff --git a/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/Group/Grid/ServiceCollectionTest.php b/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/Group/Grid/ServiceCollectionTest.php index 61081e1aaf224..524ae9065f67e 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/Group/Grid/ServiceCollectionTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/Group/Grid/ServiceCollectionTest.php @@ -219,7 +219,7 @@ public function testGetSearchCriteriaAnd() * @param array $conditions * * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage When passing in a field array there must be a matching condition array + * @expectedExceptionMessage The field array failed to pass. The array must have a matching condition array. * @dataProvider addFieldToFilterInconsistentArraysDataProvider */ public function testAddFieldToFilterInconsistentArrays($fields, $conditions) @@ -243,7 +243,7 @@ public function addFieldToFilterInconsistentArraysDataProvider() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage When passing an array of fields there must be at least one field in the array. + * @expectedExceptionMessage The array of fields failed to pass. The array must include at one field. * @dataProvider addFieldToFilterInconsistentArraysDataProvider */ public function testAddFieldToFilterEmptyArrays() diff --git a/app/code/Magento/CustomerImportExport/Model/Import/AbstractCustomer.php b/app/code/Magento/CustomerImportExport/Model/Import/AbstractCustomer.php index 1d78c4e5bc20e..cc6eebed57b1d 100644 --- a/app/code/Magento/CustomerImportExport/Model/Import/AbstractCustomer.php +++ b/app/code/Magento/CustomerImportExport/Model/Import/AbstractCustomer.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CustomerImportExport\Model\Import; use Magento\ImportExport\Model\Import; @@ -122,7 +123,10 @@ public function __construct( ); $this->addMessageTemplate(self::ERROR_WEBSITE_IS_EMPTY, __('Please specify a website.')); - $this->addMessageTemplate(self::ERROR_EMAIL_IS_EMPTY, __('Please specify an email.')); + $this->addMessageTemplate( + self::ERROR_EMAIL_IS_EMPTY, + __("An email wasn't specified. Enter the email and try again.") + ); $this->addMessageTemplate(self::ERROR_INVALID_WEBSITE, __('We found an invalid value in a website column.')); $this->addMessageTemplate(self::ERROR_INVALID_EMAIL, __('Please enter a valid email.')); $this->addMessageTemplate(self::ERROR_VALUE_IS_REQUIRED, __('Please make sure attribute "%s" is not empty.')); diff --git a/app/code/Magento/Deploy/Console/Command/App/SensitiveConfigSet/CollectorFactory.php b/app/code/Magento/Deploy/Console/Command/App/SensitiveConfigSet/CollectorFactory.php index f7c38f7c6f680..c66388ed47092 100644 --- a/app/code/Magento/Deploy/Console/Command/App/SensitiveConfigSet/CollectorFactory.php +++ b/app/code/Magento/Deploy/Console/Command/App/SensitiveConfigSet/CollectorFactory.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Deploy\Console\Command\App\SensitiveConfigSet; use Magento\Framework\Exception\LocalizedException; @@ -64,7 +65,9 @@ public function __construct( public function create($type) { if (!isset($this->types[$type])) { - throw new LocalizedException(__('Class for type "%1" was not declared', $type)); + throw new LocalizedException( + __('The class for "%1" type wasn\'t declared. Enter the class and try again.', $type) + ); } $object = $this->objectManager->create($this->types[$type]); diff --git a/app/code/Magento/Deploy/Console/Command/App/SensitiveConfigSet/SimpleCollector.php b/app/code/Magento/Deploy/Console/Command/App/SensitiveConfigSet/SimpleCollector.php index 0dd5930794168..53cd616604049 100644 --- a/app/code/Magento/Deploy/Console/Command/App/SensitiveConfigSet/SimpleCollector.php +++ b/app/code/Magento/Deploy/Console/Command/App/SensitiveConfigSet/SimpleCollector.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Deploy\Console\Command\App\SensitiveConfigSet; use Magento\Deploy\Console\Command\App\SensitiveConfigSetCommand; @@ -103,7 +104,7 @@ private function getConfigValueQuestion() ]); $configValueQuestion->setValidator(function ($interviewer) { if (empty($interviewer)) { - throw new LocalizedException(new Phrase('Value can\'t be empty')); + throw new LocalizedException(new Phrase("The value can't be empty. Enter the value and try again.")); } return $interviewer; }); diff --git a/app/code/Magento/Deploy/Console/Command/SetModeCommand.php b/app/code/Magento/Deploy/Console/Command/SetModeCommand.php index 55b4a4f4f9b6a..2e223f5a0dc65 100644 --- a/app/code/Magento/Deploy/Console/Command/SetModeCommand.php +++ b/app/code/Magento/Deploy/Console/Command/SetModeCommand.php @@ -105,7 +105,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $modeController->enableDefaultMode(); break; default: - throw new LocalizedException(__('Cannot switch into given mode "%1"', $toMode)); + throw new LocalizedException(__('The mode can\'t be switched to "%1".', $toMode)); } $output->writeln('Enabled ' . $toMode . ' mode.'); diff --git a/app/code/Magento/Deploy/Model/DeploymentConfig/Hash.php b/app/code/Magento/Deploy/Model/DeploymentConfig/Hash.php index 780d36ddb27e0..17f418d9457d8 100644 --- a/app/code/Magento/Deploy/Model/DeploymentConfig/Hash.php +++ b/app/code/Magento/Deploy/Model/DeploymentConfig/Hash.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Deploy\Model\DeploymentConfig; use Magento\Framework\Exception\LocalizedException; @@ -97,7 +98,7 @@ public function regenerate($sectionName = null) $flag->setFlagData($hashes); $this->flagResource->save($flag); } catch (\Exception $exception) { - throw new LocalizedException(__('Hash has not been saved.'), $exception); + throw new LocalizedException(__("The hash isn't saved."), $exception); } } diff --git a/app/code/Magento/Deploy/Model/DeploymentConfig/ImporterPool.php b/app/code/Magento/Deploy/Model/DeploymentConfig/ImporterPool.php index 9a987c704dea0..a4a9ef00c4a83 100644 --- a/app/code/Magento/Deploy/Model/DeploymentConfig/ImporterPool.php +++ b/app/code/Magento/Deploy/Model/DeploymentConfig/ImporterPool.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Deploy\Model\DeploymentConfig; use Magento\Framework\App\DeploymentConfig\ValidatorInterface; @@ -148,7 +149,9 @@ public function getImporters() foreach ($this->sort($this->importers) as $section => $importer) { if (empty($importer['importer_class'])) { - throw new ConfigurationMismatchException(__('Parameter "importer_class" must be present.')); + throw new ConfigurationMismatchException( + __('The parameter "importer_class" is missing. Set the "importer_class" and try again.') + ); } $sortedImporters[$section] = $importer['importer_class']; diff --git a/app/code/Magento/Deploy/Model/Plugin/ConfigChangeDetector.php b/app/code/Magento/Deploy/Model/Plugin/ConfigChangeDetector.php index 6ebc208ca6a97..0642593ac5528 100644 --- a/app/code/Magento/Deploy/Model/Plugin/ConfigChangeDetector.php +++ b/app/code/Magento/Deploy/Model/Plugin/ConfigChangeDetector.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Deploy\Model\Plugin; use Magento\Deploy\Model\DeploymentConfig\ChangeDetector; @@ -49,7 +50,7 @@ public function beforeDispatch(FrontControllerInterface $subject, RequestInterfa throw new LocalizedException( __( 'The configuration file has changed.' - . ' Run app:config:import or setup:upgrade command to synchronize configuration.' + . ' Run the "app:config:import" or the "setup:upgrade" command to synchronize the configuration.' ) ); } diff --git a/app/code/Magento/Deploy/Test/Unit/Console/Command/App/SensitiveConfigSet/CollectorFactoryTest.php b/app/code/Magento/Deploy/Test/Unit/Console/Command/App/SensitiveConfigSet/CollectorFactoryTest.php index 155acd4c785f0..6ac84b1c83424 100644 --- a/app/code/Magento/Deploy/Test/Unit/Console/Command/App/SensitiveConfigSet/CollectorFactoryTest.php +++ b/app/code/Magento/Deploy/Test/Unit/Console/Command/App/SensitiveConfigSet/CollectorFactoryTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Deploy\Test\Unit\Console\Command\App\SensitiveConfigSet; use Magento\Deploy\Console\Command\App\SensitiveConfigSet\CollectorFactory; @@ -60,7 +61,7 @@ public function testCreate() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Class for type "dummyType" was not declared + * @expectedExceptionMessage The class for "dummyType" type wasn't declared. Enter the class and try again. */ public function testCreateNonExisted() { diff --git a/app/code/Magento/Deploy/Test/Unit/Console/Command/SetModeCommandTest.php b/app/code/Magento/Deploy/Test/Unit/Console/Command/SetModeCommandTest.php index 33ffbf20c5bd9..588dd40ad6c4b 100644 --- a/app/code/Magento/Deploy/Test/Unit/Console/Command/SetModeCommandTest.php +++ b/app/code/Magento/Deploy/Test/Unit/Console/Command/SetModeCommandTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Deploy\Test\Unit\Console\Command; use Magento\Deploy\Console\Command\SetModeCommand; @@ -95,7 +96,7 @@ public function testSetInvalidMode() $tester = new CommandTester($this->command); $tester->execute(['mode' => 'invalid-mode']); $this->assertContains( - "Cannot switch into given mode", + 'The mode can\'t be switched to "invalid-mode".', $tester->getDisplay() ); } diff --git a/app/code/Magento/Deploy/Test/Unit/Model/DeploymentConfig/HashTest.php b/app/code/Magento/Deploy/Test/Unit/Model/DeploymentConfig/HashTest.php index 4afe9aa267d69..a67f32eb36457 100644 --- a/app/code/Magento/Deploy/Test/Unit/Model/DeploymentConfig/HashTest.php +++ b/app/code/Magento/Deploy/Test/Unit/Model/DeploymentConfig/HashTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Deploy\Test\Unit\Model\DeploymentConfig; use Magento\Deploy\Model\DeploymentConfig\DataCollector; @@ -137,7 +138,7 @@ public function testRegenerate() /** * @return void * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Hash has not been saved + * @expectedExceptionMessage The hash isn't saved. */ public function testRegenerateWithException() { diff --git a/app/code/Magento/Deploy/Test/Unit/Model/DeploymentConfig/ImporterPoolTest.php b/app/code/Magento/Deploy/Test/Unit/Model/DeploymentConfig/ImporterPoolTest.php index 73d90b4795d04..36c5dd9e734db 100644 --- a/app/code/Magento/Deploy/Test/Unit/Model/DeploymentConfig/ImporterPoolTest.php +++ b/app/code/Magento/Deploy/Test/Unit/Model/DeploymentConfig/ImporterPoolTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Deploy\Test\Unit\Model\DeploymentConfig; use Magento\Deploy\Model\DeploymentConfig\ImporterPool; @@ -68,7 +69,7 @@ public function testGetImporters() /** * @return void * @expectedException \Magento\Framework\Exception\ConfigurationMismatchException - * @expectedExceptionMessage Parameter "importer_class" must be present. + * @expectedExceptionMessage The parameter "importer_class" is missing. Set the "importer_class" and try again. */ public function testGetImportersEmptyParameterClass() { diff --git a/app/code/Magento/Deploy/Test/Unit/Model/Plugin/ConfigChangeDetectorTest.php b/app/code/Magento/Deploy/Test/Unit/Model/Plugin/ConfigChangeDetectorTest.php index 62cb1bab3b330..a3b6cf241b708 100644 --- a/app/code/Magento/Deploy/Test/Unit/Model/Plugin/ConfigChangeDetectorTest.php +++ b/app/code/Magento/Deploy/Test/Unit/Model/Plugin/ConfigChangeDetectorTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Deploy\Test\Unit\Model\Plugin; use Magento\Deploy\Model\Plugin\ConfigChangeDetector; @@ -63,7 +64,7 @@ public function testBeforeDispatchWithoutException() * @return void * @expectedException \Magento\Framework\Exception\LocalizedException * @codingStandardsIgnoreStart - * @expectedExceptionMessage The configuration file has changed. Run app:config:import or setup:upgrade command to synchronize configuration. + * @expectedExceptionMessage The configuration file has changed. Run the "app:config:import" or the "setup:upgrade" command to synchronize the configuration. * @codingStandardsIgnoreEnd */ public function testBeforeDispatchWithException() diff --git a/app/code/Magento/Dhl/Model/Validator/XmlValidator.php b/app/code/Magento/Dhl/Model/Validator/XmlValidator.php index a489832b47b20..762dcbe5939c2 100644 --- a/app/code/Magento/Dhl/Model/Validator/XmlValidator.php +++ b/app/code/Magento/Dhl/Model/Validator/XmlValidator.php @@ -49,7 +49,7 @@ public function validate($xmlResponse, $isShippingLabel = false) { if (strlen(trim($xmlResponse)) > 0 && strpos(trim($xmlResponse), 'xmlSecurity->scan($xmlResponse)) { - throw new DocumentValidationException(__('Security validation of XML document has been failed.')); + throw new DocumentValidationException(__('The security validation of the XML document has failed.')); } $xml = simplexml_load_string($xmlResponse, \Magento\Shipping\Model\Simplexml\Element::class); diff --git a/app/code/Magento/Dhl/Test/Unit/Model/Validator/XmlValidatorTest.php b/app/code/Magento/Dhl/Test/Unit/Model/Validator/XmlValidatorTest.php index 3d7893fea118f..26d879422389d 100644 --- a/app/code/Magento/Dhl/Test/Unit/Model/Validator/XmlValidatorTest.php +++ b/app/code/Magento/Dhl/Test/Unit/Model/Validator/XmlValidatorTest.php @@ -123,7 +123,7 @@ public function invalidXmlResponseProvider() [ [ 'file' => 'invalidDHLResponse.xml', - 'errorMessage' => 'Security validation of XML document has been failed.', + 'errorMessage' => 'The security validation of the XML document has failed.', 'isGenerateXml' => false, ], ], diff --git a/app/code/Magento/Directory/Model/CountryInformationAcquirer.php b/app/code/Magento/Directory/Model/CountryInformationAcquirer.php index 4eaa18d9672d1..69c8f21f5a235 100644 --- a/app/code/Magento/Directory/Model/CountryInformationAcquirer.php +++ b/app/code/Magento/Directory/Model/CountryInformationAcquirer.php @@ -103,7 +103,7 @@ public function getCountryInfo($countryId) if (!$country) { throw new NoSuchEntityException( __( - 'Requested country is not available.' + "The country isn't available." ) ); } diff --git a/app/code/Magento/Directory/Model/Observer.php b/app/code/Magento/Directory/Model/Observer.php index 8ad67ad191018..e35c2de5cee5b 100644 --- a/app/code/Magento/Directory/Model/Observer.php +++ b/app/code/Magento/Directory/Model/Observer.php @@ -9,6 +9,7 @@ * * @author Magento Core Team */ + namespace Magento\Directory\Model; class Observer @@ -113,7 +114,8 @@ public function scheduledUpdateCurrencyRates($schedule) $rates = $importModel->fetchRates(); $errors = $importModel->getMessages(); } catch (\Exception $e) { - $importWarnings[] = __('FATAL ERROR:') . ' ' . __('We can\'t initialize the import model.'); + $importWarnings[] = __('FATAL ERROR:') . ' ' + . __("The import model can't be initialized. Verify the model and try again."); throw $e; } } else { diff --git a/app/code/Magento/Directory/Test/Unit/Model/CountryInformationAcquirerTest.php b/app/code/Magento/Directory/Test/Unit/Model/CountryInformationAcquirerTest.php index 3f963cb2b82af..a3037d6481925 100644 --- a/app/code/Magento/Directory/Test/Unit/Model/CountryInformationAcquirerTest.php +++ b/app/code/Magento/Directory/Test/Unit/Model/CountryInformationAcquirerTest.php @@ -143,8 +143,8 @@ public function testGetCountryInfo() /** * test GetGetCountryInfoNotFound * - * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Requested country is not available. + * @expectedException \Magento\Framework\Exception\NoSuchEntityException + * @expectedExceptionMessage The country isn't available. */ public function testGetCountryInfoNotFound() { diff --git a/app/code/Magento/Downloadable/Model/LinkRepository.php b/app/code/Magento/Downloadable/Model/LinkRepository.php index b84a8284c9083..0898f1924e538 100644 --- a/app/code/Magento/Downloadable/Model/LinkRepository.php +++ b/app/code/Magento/Downloadable/Model/LinkRepository.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Downloadable\Model; use Magento\Catalog\Api\Data\ProductInterface; @@ -176,20 +177,22 @@ public function save($sku, LinkInterface $link, $isGlobalScopeContent = true) return $this->updateLink($product, $link, $isGlobalScopeContent); } else { if ($product->getTypeId() !== \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE) { - throw new InputException(__('Provided product must be type \'downloadable\'.')); + throw new InputException( + __('The product needs to be the downloadable type. Verify the product and try again.') + ); } $validateLinkContent = !($link->getLinkType() === 'file' && $link->getLinkFile()); $validateSampleContent = !($link->getSampleType() === 'file' && $link->getSampleFile()); if (!$this->contentValidator->isValid($link, $validateLinkContent, $validateSampleContent)) { - throw new InputException(__('Provided link information is invalid.')); + throw new InputException(__('The link information is invalid. Verify the link and try again.')); } if (!in_array($link->getLinkType(), ['url', 'file'], true)) { - throw new InputException(__('Invalid link type.')); + throw new InputException(__('The link type is invalid. Verify and try again.')); } $title = $link->getTitle(); if (empty($title)) { - throw new InputException(__('Link title cannot be empty.')); + throw new InputException(__('The link title is empty. Enter the link title and try again.')); } return $this->saveLink($product, $link, $isGlobalScopeContent); } @@ -283,18 +286,22 @@ protected function updateLink( /** @var $existingLink \Magento\Downloadable\Model\Link */ $existingLink = $this->linkFactory->create()->load($link->getId()); if (!$existingLink->getId()) { - throw new NoSuchEntityException(__('There is no downloadable link with provided ID.')); + throw new NoSuchEntityException( + __('No downloadable link with the provided ID was found. Verify the ID and try again.') + ); } $linkFieldValue = $product->getData( $this->getMetadataPool()->getMetadata(ProductInterface::class)->getLinkField() ); if ($existingLink->getProductId() != $linkFieldValue) { - throw new InputException(__('Provided downloadable link is not related to given product.')); + throw new InputException( + __("The downloadable link isn't related to the product. Verify the link and try again.") + ); } $validateLinkContent = !($link->getLinkFileContent() === null); $validateSampleContent = !($link->getSampleFileContent() === null); if (!$this->contentValidator->isValid($link, $validateLinkContent, $validateSampleContent)) { - throw new InputException(__('Provided link information is invalid.')); + throw new InputException(__('The link information is invalid. Verify the link and try again.')); } if ($isGlobalScopeContent) { $product->setStoreId(0); @@ -302,7 +309,7 @@ protected function updateLink( $title = $link->getTitle(); if (empty($title)) { if ($isGlobalScopeContent) { - throw new InputException(__('Link title cannot be empty.')); + throw new InputException(__('The link title is empty. Enter the link title and try again.')); } } @@ -325,12 +332,14 @@ public function delete($id) /** @var $link \Magento\Downloadable\Model\Link */ $link = $this->linkFactory->create()->load($id); if (!$link->getId()) { - throw new NoSuchEntityException(__('There is no downloadable link with provided ID.')); + throw new NoSuchEntityException( + __('No downloadable link with the provided ID was found. Verify the ID and try again.') + ); } try { $link->delete(); } catch (\Exception $exception) { - throw new StateException(__('Cannot delete link with id %1', $link->getId()), $exception); + throw new StateException(__('The link with "%1" ID can\'t be deleted.', $link->getId()), $exception); } return true; } diff --git a/app/code/Magento/Downloadable/Model/SampleRepository.php b/app/code/Magento/Downloadable/Model/SampleRepository.php index 5b9e8e784b9f3..0c7d2b96f1b53 100644 --- a/app/code/Magento/Downloadable/Model/SampleRepository.php +++ b/app/code/Magento/Downloadable/Model/SampleRepository.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Downloadable\Model; use Magento\Catalog\Api\Data\ProductInterface; @@ -183,20 +184,24 @@ public function save( return $this->updateSample($product, $sample, $isGlobalScopeContent); } else { if ($product->getTypeId() !== Type::TYPE_DOWNLOADABLE) { - throw new InputException(__('Provided product must be type \'downloadable\'.')); + throw new InputException( + __('The product needs to be the downloadable type. Verify the product and try again.') + ); } $validateSampleContent = !($sample->getSampleType() === 'file' && $sample->getSampleFile()); if (!$this->contentValidator->isValid($sample, $validateSampleContent)) { - throw new InputException(__('Provided sample information is invalid.')); + throw new InputException( + __('The sample information is invalid. Verify the information and try again.') + ); } if (!in_array($sample->getSampleType(), ['url', 'file'], true)) { - throw new InputException(__('Invalid sample type.')); + throw new InputException(__('The sample type is invalid. Verify the sample type and try again.')); } $title = $sample->getTitle(); if (empty($title)) { - throw new InputException(__('Sample title cannot be empty.')); + throw new InputException(__('The sample title is empty. Enter the title and try again.')); } return $this->saveSample($product, $sample, $isGlobalScopeContent); @@ -271,18 +276,22 @@ protected function updateSample( $existingSample = $this->sampleFactory->create()->load($sampleId); if (!$existingSample->getId()) { - throw new NoSuchEntityException(__('There is no downloadable sample with provided ID.')); + throw new NoSuchEntityException( + __('No downloadable sample with the provided ID was found. Verify the ID and try again.') + ); } $linkFieldValue = $product->getData( $this->getMetadataPool()->getMetadata(ProductInterface::class)->getLinkField() ); if ($existingSample->getProductId() != $linkFieldValue) { - throw new InputException(__('Provided downloadable sample is not related to given product.')); + throw new InputException( + __("The downloadable sample isn't related to the product. Verify the link and try again.") + ); } $validateFileContent = $sample->getSampleFileContent() === null ? false : true; if (!$this->contentValidator->isValid($sample, $validateFileContent)) { - throw new InputException(__('Provided sample information is invalid.')); + throw new InputException(__('The sample information is invalid. Verify the information and try again.')); } if ($isGlobalScopeContent) { $product->setStoreId(0); @@ -291,7 +300,7 @@ protected function updateSample( $title = $sample->getTitle(); if (empty($title)) { if ($isGlobalScopeContent) { - throw new InputException(__('Sample title cannot be empty.')); + throw new InputException(__('The sample title is empty. Enter the title and try again.')); } // use title from GLOBAL scope $existingSample->setTitle(null); @@ -314,12 +323,14 @@ public function delete($id) /** @var $sample \Magento\Downloadable\Model\Sample */ $sample = $this->sampleFactory->create()->load($id); if (!$sample->getId()) { - throw new NoSuchEntityException(__('There is no downloadable sample with provided ID.')); + throw new NoSuchEntityException( + __('No downloadable sample with the provided ID was found. Verify the ID and try again.') + ); } try { $sample->delete(); } catch (\Exception $exception) { - throw new StateException(__('Cannot delete sample with id %1', $sample->getId()), $exception); + throw new StateException(__('The sample with "%1" ID can\'t be deleted.', $sample->getId()), $exception); } return true; } diff --git a/app/code/Magento/Downloadable/Test/Unit/Helper/DownloadTest.php b/app/code/Magento/Downloadable/Test/Unit/Helper/DownloadTest.php index 3142900613296..226660b865240 100644 --- a/app/code/Magento/Downloadable/Test/Unit/Helper/DownloadTest.php +++ b/app/code/Magento/Downloadable/Test/Unit/Helper/DownloadTest.php @@ -102,7 +102,7 @@ public function testGetFileSizeNoResource() */ public function testGetFileSizeInvalidLinkType() { - $this->_helper->setResource(self::FILE_PATH, 'invalid link type'); + $this->_helper->setResource(self::FILE_PATH, 'The link type is invalid. Verify and try again.'); $this->_helper->getFileSize(); } diff --git a/app/code/Magento/Downloadable/Test/Unit/Model/LinkRepositoryTest.php b/app/code/Magento/Downloadable/Test/Unit/Model/LinkRepositoryTest.php index d835f25523353..f771233fad7bb 100644 --- a/app/code/Magento/Downloadable/Test/Unit/Model/LinkRepositoryTest.php +++ b/app/code/Magento/Downloadable/Test/Unit/Model/LinkRepositoryTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Downloadable\Test\Unit\Model; use Magento\Downloadable\Model\LinkRepository; @@ -259,7 +260,7 @@ public function testCreate() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Link title cannot be empty. + * @expectedExceptionMessage The link title is empty. Enter the link title and try again. */ public function testCreateThrowsExceptionIfTitleIsEmpty() { @@ -421,7 +422,7 @@ public function testUpdateWithExistingFile() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Link title cannot be empty. + * @expectedExceptionMessage The link title is empty. Enter the link title and try again. */ public function testUpdateThrowsExceptionIfTitleIsEmptyAndScopeIsGlobal() { @@ -469,7 +470,7 @@ public function testDelete() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage There is no downloadable link with provided ID. + * @expectedExceptionMessage No downloadable link with the provided ID was found. Verify the ID and try again. */ public function testDeleteThrowsExceptionIfLinkIdIsNotValid() { diff --git a/app/code/Magento/Downloadable/Test/Unit/Model/SampleRepositoryTest.php b/app/code/Magento/Downloadable/Test/Unit/Model/SampleRepositoryTest.php index 79a314cee5423..8e13bd83b039e 100644 --- a/app/code/Magento/Downloadable/Test/Unit/Model/SampleRepositoryTest.php +++ b/app/code/Magento/Downloadable/Test/Unit/Model/SampleRepositoryTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Downloadable\Test\Unit\Model; use Magento\Downloadable\Model\SampleRepository; @@ -206,7 +207,7 @@ public function testCreate() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Sample title cannot be empty. + * @expectedExceptionMessage The sample title is empty. Enter the title and try again. */ public function testCreateThrowsExceptionIfTitleIsEmpty() { @@ -341,7 +342,7 @@ public function testUpdateWithExistingFile() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Sample title cannot be empty. + * @expectedExceptionMessage The sample title is empty. Enter the title and try again. */ public function testUpdateThrowsExceptionIfTitleIsEmptyAndScopeIsGlobal() { @@ -388,7 +389,7 @@ public function testDelete() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage There is no downloadable sample with provided ID. + * @expectedExceptionMessage No downloadable sample with the provided ID was found. Verify the ID and try again. */ public function testDeleteThrowsExceptionIfSampleIdIsNotValid() { diff --git a/app/code/Magento/Eav/Model/Attribute/GroupRepository.php b/app/code/Magento/Eav/Model/Attribute/GroupRepository.php index 0714f8efac88c..07ca71d95eba5 100644 --- a/app/code/Magento/Eav/Model/Attribute/GroupRepository.php +++ b/app/code/Magento/Eav/Model/Attribute/GroupRepository.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Eav\Model\Attribute; use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; @@ -99,7 +100,7 @@ public function save(\Magento\Eav\Api\Data\AttributeGroupInterface $group) } if ($existingGroup->getAttributeSetId() != $group->getAttributeSetId()) { throw new StateException( - __('Attribute group does not belong to provided attribute set') + __("The attribute group doesn't belong to the provided attribute set.") ); } } @@ -107,7 +108,7 @@ public function save(\Magento\Eav\Api\Data\AttributeGroupInterface $group) try { $this->groupResource->save($group); } catch (\Exception $e) { - throw new StateException(__('Cannot save attributeGroup')); + throw new StateException(__("The attributeGroup can't be saved.")); } return $group; } @@ -140,7 +141,9 @@ public function get($groupId) $group = $this->groupFactory->create(); $this->groupResource->load($group, $groupId); if (!$group->getId()) { - throw new NoSuchEntityException(__('Group with id "%1" does not exist.', $groupId)); + throw new NoSuchEntityException( + __('The group with the "%1" ID doesn\'t exist. Verify the ID and try again.', $groupId) + ); } return $group; } @@ -155,7 +158,7 @@ public function delete(\Magento\Eav\Api\Data\AttributeGroupInterface $group) } catch (\Exception $e) { throw new StateException( __( - 'Cannot delete attributeGroup with id %1', + 'The attribute group with id "%1" can\'t be deleted.', $group->getId() ), $e diff --git a/app/code/Magento/Eav/Model/AttributeManagement.php b/app/code/Magento/Eav/Model/AttributeManagement.php index b76116c6f964c..31f962db3ee53 100644 --- a/app/code/Magento/Eav/Model/AttributeManagement.php +++ b/app/code/Magento/Eav/Model/AttributeManagement.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Eav\Model; use Magento\Framework\App\ObjectManager; @@ -98,19 +99,24 @@ public function assign($entityTypeCode, $attributeSetId, $attributeGroupId, $att try { $attributeSet = $this->setRepository->get($attributeSetId); } catch (NoSuchEntityException $ex) { - throw new NoSuchEntityException(__('AttributeSet with id "%1" does not exist.', $attributeSetId)); + throw new NoSuchEntityException( + __( + 'The AttributeSet with a "%1" ID doesn\'t exist. Verify the attributeSet and try again.', + $attributeSetId + ) + ); } $setEntityType = $this->entityTypeFactory->create()->getEntityType($attributeSet->getEntityTypeId()); if ($setEntityType->getEntityTypeCode() != $entityTypeCode) { - throw new InputException(__('Wrong attribute set id provided')); + throw new InputException(__('The attribute set ID is incorrect. Verify the ID and try again.')); } //Check if group exists. If not - expected exception $attributeGroup = $this->groupRepository->get($attributeGroupId); if ($attributeGroup->getAttributeSetId() != $attributeSetId) { - throw new InputException(__('Attribute group does not belong to attribute set')); + throw new InputException(__('The attribute group doesn\'t belong to the attribute set.')); } /** @var \Magento\Eav\Api\Data\AttributeInterface $attribute */ @@ -135,7 +141,9 @@ public function unassign($attributeSetId, $attributeCode) try { $attributeSet = $this->setRepository->get($attributeSetId); } catch (NoSuchEntityException $e) { - throw new NoSuchEntityException(__('Attribute set not found: %1', $attributeSetId)); + throw new NoSuchEntityException( + __('The "%1" attribute set wasn\'t found. Verify and try again.', $attributeSetId) + ); } $setEntityType = $this->entityTypeFactory->create()->getEntityType($attributeSet->getEntityTypeId()); @@ -148,11 +156,15 @@ public function unassign($attributeSetId, $attributeCode) if (!$attribute->getEntityAttributeId()) { throw new InputException( - __('Attribute "%1" not found in attribute set %2.', $attributeCode, $attributeSetId) + __( + 'The "%1" attribute wasn\'t found in the "%2" attribute set. Enter the attribute and try again.', + $attributeCode, + $attributeSetId + ) ); } if (!$attribute->getIsUserDefined()) { - throw new StateException(__('System attribute can not be deleted')); + throw new StateException(__("The system attribute can't be deleted.")); } $attribute->deleteEntity(); return true; diff --git a/app/code/Magento/Eav/Model/AttributeRepository.php b/app/code/Magento/Eav/Model/AttributeRepository.php index 3f20558d03d78..120c868a9d41b 100644 --- a/app/code/Magento/Eav/Model/AttributeRepository.php +++ b/app/code/Magento/Eav/Model/AttributeRepository.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Eav\Model; use Magento\Framework\Api\SearchCriteria\CollectionProcessor; @@ -87,7 +88,7 @@ public function save(\Magento\Eav\Api\Data\AttributeInterface $attribute) try { $this->eavResource->save($attribute); } catch (\Exception $e) { - throw new StateException(__('Cannot save attribute')); + throw new StateException(__("The attribute can't be saved.")); } return $attribute; } @@ -154,7 +155,10 @@ public function get($entityTypeCode, $attributeCode) $attribute = $this->eavConfig->getAttribute($entityTypeCode, $attributeCode); if (!$attribute || !$attribute->getAttributeId()) { throw new NoSuchEntityException( - __('Attribute with attributeCode "%1" does not exist.', $attributeCode) + __( + 'The attribute with a "%1" attributeCode doesn\'t exist. Verify the attribute and try again.', + $attributeCode + ) ); } return $attribute; @@ -168,7 +172,7 @@ public function delete(\Magento\Eav\Api\Data\AttributeInterface $attribute) try { $this->eavResource->delete($attribute); } catch (\Exception $e) { - throw new StateException(__('Cannot delete attribute.')); + throw new StateException(__("The attribute can't be deleted.")); } return true; } @@ -183,7 +187,9 @@ public function deleteById($attributeId) $this->eavResource->load($attribute, $attributeId); if (!$attribute->getAttributeId()) { - throw new NoSuchEntityException(__('Attribute with id "%1" does not exist.', $attributeId)); + throw new NoSuchEntityException( + __('The attribute with a "%1" ID doesn\'t exist. Verify the attribute and try again.', $attributeId) + ); } $this->delete($attribute); diff --git a/app/code/Magento/Eav/Model/AttributeSetRepository.php b/app/code/Magento/Eav/Model/AttributeSetRepository.php index d0b7ed3ccaa28..caab82da3910d 100644 --- a/app/code/Magento/Eav/Model/AttributeSetRepository.php +++ b/app/code/Magento/Eav/Model/AttributeSetRepository.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Eav\Model; use Magento\Eav\Api\AttributeSetRepositoryInterface; @@ -93,7 +94,12 @@ public function save(AttributeSetInterface $attributeSet) try { $this->attributeSetResource->save($attributeSet); } catch (\Exception $exception) { - throw new CouldNotSaveException(__('There was an error saving attribute set.')); + throw new CouldNotSaveException( + __( + 'The attribute set couldn\'t be saved due to an error. ' + . 'Verify your information and try again. If the error persists, please try again later.' + ) + ); } return $attributeSet; } @@ -159,9 +165,14 @@ public function delete(AttributeSetInterface $attributeSet) try { $this->attributeSetResource->delete($attributeSet); } catch (\Magento\Framework\Exception\StateException $exception) { - throw new CouldNotDeleteException(__('Default attribute set can not be deleted')); + throw new CouldNotDeleteException(__('The default attribute set can\'t be deleted.')); } catch (\Exception $exception) { - throw new CouldNotDeleteException(__('There was an error deleting attribute set.')); + throw new CouldNotDeleteException( + __( + 'The attribute set couldn\'t be deleted due to an error. ' + . 'Try again — if the error persists, please try again later.' + ) + ); } return true; } diff --git a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php index ef80f12b26721..7159cedb61cee 100644 --- a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php +++ b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php @@ -365,7 +365,7 @@ public function unsetAttributes($attributes = null) } if (!is_array($attributes)) { - throw new LocalizedException(__('Unknown parameter')); + throw new LocalizedException(__('This parameter is unknown. Verify and try again.')); } foreach ($attributes as $attrCode) { diff --git a/app/code/Magento/Eav/Model/Entity/Attribute.php b/app/code/Magento/Eav/Model/Entity/Attribute.php index a2c2cdcb5ae55..3a2bfad06db25 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Eav\Model\Entity; use Magento\Framework\Api\AttributeValueFactory; @@ -252,7 +253,10 @@ public function beforeSave() ) ) { throw new LocalizedException( - __('An attribute code must not be more than %1 characters.', self::ATTRIBUTE_CODE_MAX_LENGTH) + __( + 'The attribute code needs to be %1 characters or fewer. Re-enter the code and try again.', + self::ATTRIBUTE_CODE_MAX_LENGTH + ) ); } @@ -263,7 +267,9 @@ public function beforeSave() $numberFormatter = new \NumberFormatter($this->_localeResolver->getLocale(), \NumberFormatter::DECIMAL); $defaultValue = $numberFormatter->parse($defaultValue); if ($defaultValue === false) { - throw new LocalizedException(__('Invalid default decimal value')); + throw new LocalizedException( + __('The default decimal value is invalid. Verify the value and try again.') + ); } $this->setDefaultValue($defaultValue); } @@ -286,7 +292,7 @@ public function beforeSave() $defaultValue = $this->dateTimeFormatter->formatObject(new \DateTime($defaultValue), $format); $this->setDefaultValue($defaultValue); } catch (\Exception $e) { - throw new LocalizedException(__('Invalid default date')); + throw new LocalizedException(__('The default date is invalid. Verify the date and try again.')); } } } diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php index 19877a51c4869..4d3c79db2dfcd 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php @@ -243,7 +243,7 @@ public function loadByCode($entityType, $code) $entityTypeId = $entityType->getId(); } if (empty($entityTypeId)) { - throw new LocalizedException(__('Invalid entity supplied')); + throw new LocalizedException(__('The entity supplied is invalid. Verify the entity and try again.')); } $this->_getResource()->loadByCode($this, $entityTypeId, $code); $this->_afterLoad(); @@ -550,7 +550,12 @@ public function getBackend() } $backend = $this->_universalFactory->create($this->getBackendModel()); if (!$backend) { - throw new LocalizedException(__('Invalid backend model specified: %1', $this->getBackendModel())); + throw new LocalizedException( + __( + 'The "%1" backend model is invalid. Verify the backend model and try again.', + $this->getBackendModel() + ) + ); } $this->_backend = $backend->setAttribute($this); } diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php index 38e7b883f4ea5..53c32e1cbfba4 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Eav\Model\Entity\Attribute\Backend; use Magento\Framework\Exception\LocalizedException; @@ -238,7 +239,9 @@ public function validate($object) && $attribute->isValueEmpty($attribute->getDefaultValue()) ) { $label = $attribute->getFrontend()->getLabel(); - throw new LocalizedException(__('The value of attribute "%1" must be set', $label)); + throw new LocalizedException( + __('The "%1" attribute value is empty. Set the attribute and try again.', $label) + ); } if ($attribute->getIsUnique() @@ -251,7 +254,9 @@ public function validate($object) if ($attribute->getIsUnique()) { if (!$attribute->getEntity()->checkAttributeUniqueValue($attribute, $object)) { $label = $attribute->getFrontend()->getLabel(); - throw new LocalizedException(__('The value of attribute "%1" must be unique', $label)); + throw new LocalizedException( + __('The value of the "%1" attribute isn\'t unique. Set a unique value and try again.', $label) + ); } } diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/OptionManagement.php b/app/code/Magento/Eav/Model/Entity/Attribute/OptionManagement.php index b0508fd8cc626..938abdf30057b 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/OptionManagement.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/OptionManagement.php @@ -41,12 +41,12 @@ public function __construct( public function add($entityType, $attributeCode, $option) { if (empty($attributeCode)) { - throw new InputException(__('Empty attribute code')); + throw new InputException(__('The attribute code is empty. Enter the code and try again.')); } $attribute = $this->attributeRepository->get($entityType, $attributeCode); if (!$attribute->usesSource()) { - throw new StateException(__('Attribute %1 doesn\'t work with options', $attributeCode)); + throw new StateException(__('The "%1" attribute doesn\'t work with options.', $attributeCode)); } $optionId = $this->getOptionId($option); @@ -68,7 +68,7 @@ public function add($entityType, $attributeCode, $option) try { $this->resourceModel->save($attribute); } catch (\Exception $e) { - throw new StateException(__('Cannot save attribute %1', $attributeCode)); + throw new StateException(__('The "%1" attribute can\'t be saved.', $attributeCode)); } return true; @@ -80,12 +80,12 @@ public function add($entityType, $attributeCode, $option) public function delete($entityType, $attributeCode, $optionId) { if (empty($attributeCode)) { - throw new InputException(__('Empty attribute code')); + throw new InputException(__('The attribute code is empty. Enter the code and try again.')); } $attribute = $this->attributeRepository->get($entityType, $attributeCode); if (!$attribute->usesSource()) { - throw new StateException(__('Attribute %1 doesn\'t have any option', $attributeCode)); + throw new StateException(__('The "%1" attribute has no option.', $attributeCode)); } $this->validateOption($attribute, $optionId); @@ -99,7 +99,7 @@ public function delete($entityType, $attributeCode, $optionId) try { $this->resourceModel->save($attribute); } catch (\Exception $e) { - throw new StateException(__('Cannot save attribute %1', $attributeCode)); + throw new StateException(__('The "%1" attribute can\'t be saved.', $attributeCode)); } return true; @@ -111,14 +111,14 @@ public function delete($entityType, $attributeCode, $optionId) public function getItems($entityType, $attributeCode) { if (empty($attributeCode)) { - throw new InputException(__('Empty attribute code')); + throw new InputException(__('The attribute code is empty. Enter the code and try again.')); } $attribute = $this->attributeRepository->get($entityType, $attributeCode); try { $options = $attribute->getOptions(); } catch (\Exception $e) { - throw new StateException(__('Cannot load options for attribute %1', $attributeCode)); + throw new StateException(__('The options for "%1" attribute can\'t be loaded.', $attributeCode)); } return $options; @@ -134,7 +134,11 @@ protected function validateOption($attribute, $optionId) { if (!$attribute->getSource()->getOptionText($optionId)) { throw new NoSuchEntityException( - __('Attribute %1 does not contain option with Id %2', $attribute->getAttributeCode(), $optionId) + __( + 'The "%1" attribute doesn\'t include an option with "%2" ID.', + $attribute->getAttributeCode(), + $optionId + ) ); } } diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Set.php b/app/code/Magento/Eav/Model/Entity/Attribute/Set.php index 5434f05610467..da7d5fac089cb 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Set.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Set.php @@ -220,7 +220,12 @@ public function organizeData($data) foreach ($data['not_attributes'] as $entityAttributeId) { $entityAttribute = $this->_resourceAttribute->getEntityAttribute($entityAttributeId); if (!$entityAttribute) { - throw new LocalizedException(__('Entity attribute with id "%1" not found', $entityAttributeId)); + throw new LocalizedException( + __( + 'The entity attribute with the "%1" ID isn\'t found. Reset the attribute and try again.', + $entityAttributeId + ) + ); } $modelAttribute = $this->_eavConfig->getAttribute( $this->getEntityTypeId(), @@ -282,11 +287,13 @@ public function validate() { $attributeSetName = $this->getAttributeSetName(); if ($attributeSetName == '') { - throw new LocalizedException(__('Attribute set name is empty.')); + throw new LocalizedException(__('The attribute set name is empty. Enter the name and try again.')); } if (!$this->_getResource()->validate($this, $attributeSetName)) { - throw new LocalizedException(__('An attribute set named "%1" already exists.', $attributeSetName)); + throw new LocalizedException( + __('A "%1" attribute set name already exists. Create a new name and try again.', $attributeSetName) + ); } return true; diff --git a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php index 48dbb80fe6d14..76e7c7655ba84 100644 --- a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php +++ b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Eav\Model\Entity\Collection; use Magento\Framework\App\ResourceConnection\SourceProviderInterface; @@ -246,7 +247,9 @@ public function setEntity($entity) } elseif (is_string($entity) || $entity instanceof \Magento\Framework\App\Config\Element) { $this->_entity = $this->_eavEntityFactory->create()->setType($entity); } else { - throw new LocalizedException(__('Invalid entity supplied: %1', print_r($entity, 1))); + throw new LocalizedException( + __('The "%1" entity supplied is invalid. Verify the entity and try again.', print_r($entity, 1)) + ); } return $this; } @@ -302,7 +305,9 @@ public function setObject($object = null) public function addItem(\Magento\Framework\DataObject $object) { if (!$object instanceof $this->_itemObjectClass) { - throw new LocalizedException(__('Attempt to add an invalid object')); + throw new LocalizedException( + __("The object wasn't added because it's invalid. To continue, enter a valid object and try again.") + ); } return parent::addItem($object); } @@ -495,7 +500,12 @@ public function addAttributeToSelect($attribute, $joinType = false) $attrInstance = $this->_eavConfig->getAttribute($this->getEntity()->getType(), $attribute); } if (empty($attrInstance)) { - throw new LocalizedException(__('Invalid attribute requested: %1', (string)$attribute)); + throw new LocalizedException( + __( + 'The "%1" attribute requested is invalid. Verify the attribute and try again.', + (string)$attribute + ) + ); } $this->_selectAttributes[$attrInstance->getAttributeCode()] = $attrInstance->getId(); } @@ -662,7 +672,7 @@ public function joinAttribute($alias, $attribute, $bind, $filter = null, $joinTy } if (!$bindAttribute || !$bindAttribute->isStatic() && !$bindAttribute->getId()) { - throw new LocalizedException(__('Invalid foreign key')); + throw new LocalizedException(__('The foreign key is invalid. Verify the foreign key and try again.')); } // try to explode combined entity/attribute if supplied @@ -686,7 +696,7 @@ public function joinAttribute($alias, $attribute, $bind, $filter = null, $joinTy } } if (!$entity || !$entity->getTypeId()) { - throw new LocalizedException(__('Invalid entity type')); + throw new LocalizedException(__('The entity type is invalid. Verify the entity type and try again.')); } // cache entity @@ -699,7 +709,7 @@ public function joinAttribute($alias, $attribute, $bind, $filter = null, $joinTy $attribute = $entity->getAttribute($attribute); } if (!$attribute) { - throw new LocalizedException(__('Invalid attribute type')); + throw new LocalizedException(__('The attribute type is invalid. Verify the attribute type and try again.')); } if (empty($filter)) { @@ -819,7 +829,7 @@ public function joinTable($table, $bind, $fields = null, $cond = null, $joinType } foreach ($fields as $alias => $field) { if (isset($this->_joinFields[$alias])) { - throw new LocalizedException(__('A joint field with this alias (%1) is already declared.', $alias)); + throw new LocalizedException(__('A joint field with a "%1" alias is already declared.', $alias)); } $this->_joinFields[$alias] = ['table' => $tableAlias, 'field' => $field]; } @@ -1269,7 +1279,9 @@ protected function _setItemAttributeValue($valueInfo) $entityIdField = $this->getEntity()->getEntityIdField(); $entityId = $valueInfo[$entityIdField]; if (!isset($this->_itemsById[$entityId])) { - throw new LocalizedException(__('Data integrity: No header row found for attribute')); + throw new LocalizedException( + __('A header row is missing for an attribute. Verify the header row and try again.') + ); } $attributeCode = array_search($valueInfo['attribute_id'], $this->_selectAttributes); if (!$attributeCode) { @@ -1321,7 +1333,9 @@ protected function _getAttributeFieldName($attributeCode) $attribute = $this->getAttribute($attributeCode); if (!$attribute) { - throw new LocalizedException(__('Invalid attribute name: %1', $attributeCode)); + throw new LocalizedException( + __('The "%1" attribute name is invalid. Reset the name and try again.', $attributeCode) + ); } if ($attribute->isStatic()) { @@ -1380,7 +1394,9 @@ protected function _addAttributeJoin($attributeCode, $joinType = 'inner') } if (!$attribute) { - throw new LocalizedException(__('Invalid attribute name: %1', $attributeCode)); + throw new LocalizedException( + __('The "%1" attribute name is invalid. Reset the name and try again.', $attributeCode) + ); } if ($attribute->getBackend()->isStatic()) { diff --git a/app/code/Magento/Eav/Model/Form/Element.php b/app/code/Magento/Eav/Model/Form/Element.php index 28b6b1433eba5..0f0b74b201a7f 100644 --- a/app/code/Magento/Eav/Model/Form/Element.php +++ b/app/code/Magento/Eav/Model/Form/Element.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Eav\Model\Form; use Magento\Framework\Exception\LocalizedException; @@ -76,10 +77,10 @@ protected function _construct() public function beforeSave() { if (!$this->getTypeId()) { - throw new LocalizedException(__('Invalid form type.')); + throw new LocalizedException(__('The form type is invalid. Reset the type and try again.')); } if (!$this->getAttributeId()) { - throw new LocalizedException(__('Invalid EAV attribute')); + throw new LocalizedException(__('The EAV attribute is invalid. Verify the attribute and try again.')); } return parent::beforeSave(); diff --git a/app/code/Magento/Eav/Model/Form/Fieldset.php b/app/code/Magento/Eav/Model/Form/Fieldset.php index a0c706c3d03a5..f43a10f074a3a 100644 --- a/app/code/Magento/Eav/Model/Form/Fieldset.php +++ b/app/code/Magento/Eav/Model/Form/Fieldset.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Eav\Model\Form; /** @@ -72,7 +73,9 @@ protected function _construct() public function beforeSave() { if (!$this->getTypeId()) { - throw new \Magento\Framework\Exception\LocalizedException(__('Invalid form type.')); + throw new \Magento\Framework\Exception\LocalizedException( + __('The form type is invalid. Reset the type and try again.') + ); } if (!$this->getStoreId() && $this->getLabel()) { $this->setStoreLabel($this->getStoreId(), $this->getLabel()); diff --git a/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute.php b/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute.php index d64d5774fef1f..25858f6a3454d 100644 --- a/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute.php +++ b/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Eav\Model\ResourceModel\Entity; use Magento\Eav\Model\Config; @@ -393,7 +394,9 @@ protected function _processAttributeOptions($object, $option) protected function _checkDefaultOptionValue($values) { if (!isset($values[0])) { - throw new \Magento\Framework\Exception\LocalizedException(__('Default option value is not defined')); + throw new \Magento\Framework\Exception\LocalizedException( + __("The default option isn't defined. Set the option and try again.") + ); } } diff --git a/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Set.php b/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Set.php index 77ceb192cfdc6..4e1762730a8d9 100644 --- a/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Set.php +++ b/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Set.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Eav\Model\ResourceModel\Entity\Attribute; class Set extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb @@ -103,7 +104,7 @@ protected function _beforeDelete(\Magento\Framework\Model\AbstractModel $object) ->getDefaultAttributeSetId(); if ($object->getAttributeSetId() == $defaultAttributeSetId) { throw new \Magento\Framework\Exception\StateException( - __('Default attribute set can not be deleted') + __('The default attribute set can\'t be deleted.') ); } return parent::_beforeDelete($object); diff --git a/app/code/Magento/Eav/Setup/EavSetup.php b/app/code/Magento/Eav/Setup/EavSetup.php index 13f55308e6fa6..3486ba206a9b2 100644 --- a/app/code/Magento/Eav/Setup/EavSetup.php +++ b/app/code/Magento/Eav/Setup/EavSetup.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Eav\Setup; use Magento\Eav\Model\Entity\Setup\Context; @@ -264,7 +265,7 @@ public function getEntityTypeId($entityTypeId) $entityTypeId = $this->getEntityType($entityTypeId, 'entity_type_id'); } if (!is_numeric($entityTypeId)) { - throw new LocalizedException(__('Wrong entity ID')); + throw new LocalizedException(__('The entity ID is incorrect. Verify the ID and try again.')); } return $entityTypeId; @@ -403,7 +404,7 @@ public function getAttributeSetId($entityTypeId, $setId) $setId = $this->getAttributeSet($entityTypeId, $setId, 'attribute_set_id'); } if (!is_numeric($setId)) { - throw new LocalizedException(__('Wrong attribute set ID')); + throw new LocalizedException(__('The attribute set ID is incorrect. Verify the ID and try again.')); } return $setId; @@ -665,7 +666,7 @@ public function getAttributeGroupId($entityTypeId, $setId, $groupId) } if (!is_numeric($groupId)) { - throw new LocalizedException(__('Wrong attribute group ID')); + throw new LocalizedException(__('The attribute group ID is incorrect. Verify the ID and try again.')); } return $groupId; } @@ -902,7 +903,7 @@ public function addAttributeOption($option) // Default value if (!isset($values[0])) { throw new \Magento\Framework\Exception\LocalizedException( - __('Default option value is not defined') + __("The default option isn't defined. Set the option and try again.") ); } $condition = ['option_id =?' => $intOptionId]; diff --git a/app/code/Magento/Eav/Test/Unit/Model/Attribute/GroupRepositoryTest.php b/app/code/Magento/Eav/Test/Unit/Model/Attribute/GroupRepositoryTest.php index 9b0f9704887bb..6f9dab002aa0a 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Attribute/GroupRepositoryTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Attribute/GroupRepositoryTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Eav\Test\Unit\Model\Attribute; use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; @@ -176,7 +177,7 @@ public function testSaveThrowExceptionIfAttributeSetDoesNotExist() * Test saving throws exception if cannot save group * * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Cannot save attributeGroup + * @expectedExceptionMessage The attributeGroup can't be saved. * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\StateException * @return void @@ -207,7 +208,7 @@ public function testSaveThrowExceptionIfCannotSaveGroup() * Test saving throws exception if group does not belong to provided set * * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Attribute group does not belong to provided attribute set + * @expectedExceptionMessage The attribute group doesn't belong to the provided attribute set. * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\StateException * @return void @@ -336,7 +337,7 @@ public function testGet() * Test get throws exception if provided group does not exist * * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Group with id "42" does not exist. + * @expectedExceptionMessage The group with the "42" ID doesn't exist. Verify the ID and try again. * @throws \Magento\Framework\Exception\NoSuchEntityException * @return void */ @@ -367,7 +368,7 @@ public function testDelete() * Test deletion throws exception if provided group does not exist * * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Cannot delete attributeGroup with id + * @expectedExceptionMessage The attribute group with id "42" can't be deleted. * @throws \Magento\Framework\Exception\StateException * @return void */ diff --git a/app/code/Magento/Eav/Test/Unit/Model/AttributeManagementTest.php b/app/code/Magento/Eav/Test/Unit/Model/AttributeManagementTest.php index 21697bf1e22c7..5b78154555809 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/AttributeManagementTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/AttributeManagementTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Eav\Test\Unit\Model; use Magento\Eav\Model\AttributeManagement; @@ -101,7 +102,7 @@ protected function setUp() /** * * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage AttributeSet with id "2" does not exist. + * @expectedExceptionMessage The AttributeSet with a "2" ID doesn't exist. Verify the attributeSet and try again. */ public function testAssignNoSuchEntityException() { @@ -128,7 +129,7 @@ public function testAssignNoSuchEntityException() /** * * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Wrong attribute set id provided + * @expectedExceptionMessage The attribute set ID is incorrect. Verify the ID and try again. */ public function testAssignInputException() { @@ -160,7 +161,7 @@ public function testAssignInputException() /** * * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Attribute group does not belong to attribute set + * @expectedExceptionMessage The attribute group doesn't belong to the attribute set. */ public function testAssignInputExceptionGroupInSet() { @@ -295,7 +296,6 @@ public function testUnassign() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Attribute "code" not found in attribute set 1. */ public function testUnassignInputException() { @@ -335,11 +335,15 @@ public function testUnassignInputException() $attributeMock->expects($this->never())->method('deleteEntity'); $this->attributeManagement->unassign($attributeSetId, $attributeCode); + + $this->expectExceptionMessage( + 'The "code" attribute wasn\'t found in the "1" attribute set. Enter the attribute and try again.' + ); } /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Attribute set not found: 1 + * @expectedExceptionMessage The "1234567" attribute set wasn't found. Verify and try again. */ public function testUnassignWithWrongAttributeSet() { @@ -356,7 +360,7 @@ public function testUnassignWithWrongAttributeSet() /** * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage System attribute can not be deleted + * @expectedExceptionMessage The system attribute can't be deleted. */ public function testUnassignStateException() { diff --git a/app/code/Magento/Eav/Test/Unit/Model/AttributeRepositoryTest.php b/app/code/Magento/Eav/Test/Unit/Model/AttributeRepositoryTest.php index c225941c9eb35..548a70e07bfc3 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/AttributeRepositoryTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/AttributeRepositoryTest.php @@ -100,7 +100,7 @@ protected function setUp() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage entity_type_code is a required field. + * @expectedExceptionMessage "entity_type_code" is required. Enter and try again. */ public function testGetListInputException() { diff --git a/app/code/Magento/Eav/Test/Unit/Model/AttributeSetRepositoryTest.php b/app/code/Magento/Eav/Test/Unit/Model/AttributeSetRepositoryTest.php index b7724c9cf349d..04cd905d4ff3f 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/AttributeSetRepositoryTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/AttributeSetRepositoryTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Eav\Test\Unit\Model; use Magento\Eav\Model\AttributeSetRepository; @@ -132,7 +133,6 @@ public function testSave() /** * @return void * @expectedException \Magento\Framework\Exception\CouldNotSaveException - * @expectedExceptionMessage There was an error saving attribute set. */ public function testSaveThrowsExceptionIfGivenEntityCannotBeSaved() { @@ -141,6 +141,11 @@ public function testSaveThrowsExceptionIfGivenEntityCannotBeSaved() new \Exception('Some internal exception message.') ); $this->model->save($attributeSetMock); + + $this->expectExceptionMessage( + "The attribute set couldn't be saved due to an error. Verify your information and try again. " + . "If the error persists, please try again later." + ); } /** @@ -156,7 +161,6 @@ public function testDelete() /** * @return void * @expectedException \Magento\Framework\Exception\CouldNotDeleteException - * @expectedExceptionMessage There was an error deleting attribute set. */ public function testDeleteThrowsExceptionIfGivenEntityCannotBeDeleted() { @@ -165,12 +169,17 @@ public function testDeleteThrowsExceptionIfGivenEntityCannotBeDeleted() new \Magento\Framework\Exception\CouldNotDeleteException(__('Some internal exception message.')) ); $this->model->delete($attributeSetMock); + + $this->expectExceptionMessage( + "The attribute set couldn't be deleted due to an error. " + . "Try again — if the error persists, please try again later." + ); } /** * @return void * @expectedException \Magento\Framework\Exception\CouldNotDeleteException - * @expectedExceptionMessage Default attribute set can not be deleted + * @expectedExceptionMessage The default attribute set can't be deleted. */ public function testDeleteThrowsExceptionIfGivenAttributeSetIsDefault() { diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/OptionManagementTest.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/OptionManagementTest.php index 36eb78fd435e7..8900a22f6ab7e 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/OptionManagementTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/OptionManagementTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Eav\Test\Unit\Model\Entity\Attribute; class OptionManagementTest extends \PHPUnit\Framework\TestCase @@ -85,7 +86,7 @@ public function testAdd() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Empty attribute code + * @expectedExceptionMessage The attribute code is empty. Enter the code and try again. */ public function testAddWithEmptyAttributeCode() { @@ -106,7 +107,7 @@ public function testAddWithEmptyAttributeCode() /** * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Attribute testAttribute doesn't work with options + * @expectedExceptionMessage The "testAttribute" attribute doesn't work with options. */ public function testAddWithWrongOptions() { @@ -139,7 +140,7 @@ public function testAddWithWrongOptions() /** * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Cannot save attribute atrCde + * @expectedExceptionMessage The "atrCde" attribute can't be saved. */ public function testAddWithCannotSaveException() { @@ -225,7 +226,7 @@ public function testDelete() /** * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Cannot save attribute atrCode + * @expectedExceptionMessage The "atrCode" attribute can't be saved. */ public function testDeleteWithCannotSaveException() { @@ -261,7 +262,7 @@ public function testDeleteWithCannotSaveException() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Attribute atrCode does not contain option with Id option + * @expectedExceptionMessage The "atrCode" attribute doesn't include an option with "option" ID. */ public function testDeleteWithWrongOption() { @@ -290,7 +291,7 @@ public function testDeleteWithWrongOption() /** * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Attribute atrCode doesn't have any option + * @expectedExceptionMessage The "atrCode" attribute has no option. */ public function testDeleteWithAbsentOption() { @@ -315,7 +316,7 @@ public function testDeleteWithAbsentOption() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Empty attribute code + * @expectedExceptionMessage The attribute code is empty. Enter the code and try again. */ public function testDeleteWithEmptyAttributeCode() { @@ -348,7 +349,7 @@ public function testGetItems() /** * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Cannot load options for attribute atrCode + * @expectedExceptionMessage The options for "atrCode" attribute can't be loaded. */ public function testGetItemsWithCannotLoadException() { @@ -371,7 +372,7 @@ public function testGetItemsWithCannotLoadException() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Empty attribute code + * @expectedExceptionMessage The attribute code is empty. Enter the code and try again. */ public function testGetItemsWithEmptyAttributeCode() { diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/SetTest.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/SetTest.php index 78465e57c6236..79f601b154b73 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/SetTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/SetTest.php @@ -65,8 +65,8 @@ public function testValidateWithNonexistentValidName() public function invalidAttributeSetDataProvider() { return [ - ['', 'Attribute set name is empty.'], - ['existing_name', 'An attribute set named "existing_name" already exists.'] + ['', 'The attribute set name is empty. Enter the name and try again.'], + ['existing_name', 'A "existing_name" attribute set name already exists. Create a new name and try again.'] ]; } } diff --git a/app/code/Magento/Eav/Test/Unit/Model/ResourceModel/Entity/Attribute/SetTest.php b/app/code/Magento/Eav/Test/Unit/Model/ResourceModel/Entity/Attribute/SetTest.php index 1c66788f8585a..4c2ede60c8798 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/ResourceModel/Entity/Attribute/SetTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/ResourceModel/Entity/Attribute/SetTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Eav\Test\Unit\Model\ResourceModel\Entity\Attribute; use Magento\Eav\Model\ResourceModel\Entity\Attribute\Set; @@ -116,7 +117,7 @@ protected function setUp() /** * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Default attribute set can not be deleted + * @expectedExceptionMessage The default attribute set can't be deleted. * @return void */ public function testBeforeDeleteStateException() diff --git a/app/code/Magento/Email/Model/AbstractTemplate.php b/app/code/Magento/Email/Model/AbstractTemplate.php index e6a2f74a0d1a8..4830ecfbb74b3 100644 --- a/app/code/Magento/Email/Model/AbstractTemplate.php +++ b/app/code/Magento/Email/Model/AbstractTemplate.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Email\Model; use Magento\Framework\App\Filesystem\DirectoryList; @@ -535,7 +536,7 @@ protected function cancelDesignConfig() public function setForcedArea($templateId) { if ($this->area) { - throw new \LogicException(__('Area is already set')); + throw new \LogicException(__('The area is already set.')); } $this->area = $this->emailConfig->getTemplateArea($templateId); return $this; @@ -605,7 +606,9 @@ public function getDesignConfig() public function setDesignConfig(array $config) { if (!isset($config['area']) || !isset($config['store'])) { - throw new LocalizedException(__('Design config must have area and store.')); + throw new LocalizedException( + __('The design config needs an area and a store. Verify that both are set and try again.') + ); } $this->getDesignConfig()->setData($config); return $this; diff --git a/app/code/Magento/GiftMessage/Model/CartRepository.php b/app/code/Magento/GiftMessage/Model/CartRepository.php index eeab05f01d09f..f6577d1e1237b 100644 --- a/app/code/Magento/GiftMessage/Model/CartRepository.php +++ b/app/code/Magento/GiftMessage/Model/CartRepository.php @@ -101,15 +101,15 @@ public function save($cartId, \Magento\GiftMessage\Api\Data\MessageInterface $gi $quote = $this->quoteRepository->getActive($cartId); if (0 == $quote->getItemsCount()) { - throw new InputException(__('Gift Messages are not applicable for empty cart')); + throw new InputException(__("Gift messages can't be used for an empty cart. Add an item and try again.")); } if ($quote->isVirtual()) { - throw new InvalidTransitionException(__('Gift Messages are not applicable for virtual products')); + throw new InvalidTransitionException(__("Gift messages can't be used for virtual products.")); } $messageText = $giftMessage->getMessage(); if ($messageText && !$this->helper->isMessagesAllowed('quote', $quote, $this->storeManager->getStore())) { - throw new CouldNotSaveException(__('Gift Message is not available')); + throw new CouldNotSaveException(__("The gift message isn't available.")); } $this->giftMessageManager->setMessage($quote, 'quote', $giftMessage); return true; diff --git a/app/code/Magento/GiftMessage/Model/GiftMessageManager.php b/app/code/Magento/GiftMessage/Model/GiftMessageManager.php index e01da4c526252..605fd221462d9 100644 --- a/app/code/Magento/GiftMessage/Model/GiftMessageManager.php +++ b/app/code/Magento/GiftMessage/Model/GiftMessageManager.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\GiftMessage\Model; use Magento\Framework\Exception\CouldNotSaveException; @@ -98,7 +99,7 @@ public function add($giftMessages, $quote) * @param \Magento\GiftMessage\Api\Data\MessageInterface $giftMessage The gift message. * @param null|int $entityId The entity ID. * @return void - * @throws \Magento\Framework\Exception\CouldNotSaveException The specified gift message is not available. + * @throws \Magento\Framework\Exception\CouldNotSaveException The gift message isn't available. */ public function setMessage(\Magento\Quote\Model\Quote $quote, $type, $giftMessage, $entityId = null) { @@ -111,7 +112,7 @@ public function setMessage(\Magento\Quote\Model\Quote $quote, $type, $giftMessag try { $this->add($message, $quote); } catch (\Exception $e) { - throw new CouldNotSaveException(__('Could not add gift message to shopping cart')); + throw new CouldNotSaveException(__("The gift message couldn't be added to Cart.")); } } } diff --git a/app/code/Magento/GiftMessage/Model/ItemRepository.php b/app/code/Magento/GiftMessage/Model/ItemRepository.php index 6d369e083b135..3c62a489af4ab 100644 --- a/app/code/Magento/GiftMessage/Model/ItemRepository.php +++ b/app/code/Magento/GiftMessage/Model/ItemRepository.php @@ -85,7 +85,9 @@ public function get($cartId, $itemId) */ $quote = $this->quoteRepository->getActive($cartId); if (!$item = $quote->getItemById($itemId)) { - throw new NoSuchEntityException(__('There is no item with provided id in the cart')); + throw new NoSuchEntityException( + __('No item with the provided ID was found in the Cart. Verify the ID and try again.') + ); }; $messageId = $item->getGiftMessageId(); if (!$messageId) { @@ -114,16 +116,19 @@ public function save($cartId, \Magento\GiftMessage\Api\Data\MessageInterface $gi if (!$item = $quote->getItemById($itemId)) { throw new NoSuchEntityException( - __('There is no product with provided itemId: %1 in the cart', $itemId) + __( + 'No product with the "%1" itemId exists in the Cart. Verify your information and try again.', + $itemId + ) ); }; if ($item->getIsVirtual()) { - throw new InvalidTransitionException(__('Gift Messages are not applicable for virtual products')); + throw new InvalidTransitionException(__('Gift messages can\'t be used for virtual products.')); } $messageText = $giftMessage->getMessage(); if ($messageText && !$this->helper->isMessagesAllowed('items', $quote, $this->storeManager->getStore())) { - throw new CouldNotSaveException(__('Gift Message is not available')); + throw new CouldNotSaveException(__("The gift message isn't available.")); } $this->giftMessageManager->setMessage($quote, 'quote_item', $giftMessage, $itemId); return true; diff --git a/app/code/Magento/GiftMessage/Model/OrderItemRepository.php b/app/code/Magento/GiftMessage/Model/OrderItemRepository.php index 4be7483dfe672..943552e2b75bc 100644 --- a/app/code/Magento/GiftMessage/Model/OrderItemRepository.php +++ b/app/code/Magento/GiftMessage/Model/OrderItemRepository.php @@ -86,18 +86,25 @@ public function get($orderId, $orderItemId) { /** @var \Magento\Sales\Api\Data\OrderItemInterface $orderItem */ if (!$orderItem = $this->getItemById($orderId, $orderItemId)) { - throw new NoSuchEntityException(__('There is no item with provided id in the order')); + throw new NoSuchEntityException( + __('No item with the provided ID was found in the Order. Verify the ID and try again.') + ); }; if (!$this->helper->isMessagesAllowed('order_item', $orderItem, $this->storeManager->getStore())) { throw new NoSuchEntityException( - __('There is no item with provided id in the order or gift message isn\'t allowed') + __( + "No item with the provided ID was found in the Order, or a gift message isn't allowed. " + . "Verify and try again." + ) ); } $messageId = $orderItem->getGiftMessageId(); if (!$messageId) { - throw new NoSuchEntityException(__('There is no item with provided id in the order')); + throw new NoSuchEntityException( + __('No item with the provided ID was found in the Order. Verify the ID and try again.') + ); } return $this->messageFactory->create()->load($messageId); @@ -113,14 +120,16 @@ public function save($orderId, $orderItemId, \Magento\GiftMessage\Api\Data\Messa /** @var \Magento\Sales\Api\Data\OrderItemInterface $orderItem */ if (!$orderItem = $this->getItemById($orderId, $orderItemId)) { - throw new NoSuchEntityException(__('There is no item with provided id in the order')); + throw new NoSuchEntityException( + __('No item with the provided ID was found in the Order. Verify the ID and try again.') + ); }; if ($order->getIsVirtual()) { - throw new InvalidTransitionException(__('Gift Messages are not applicable for virtual products')); + throw new InvalidTransitionException(__("Gift messages can't be used for virtual products.")); } if (!$this->helper->isMessagesAllowed('order_item', $orderItem, $this->storeManager->getStore())) { - throw new CouldNotSaveException(__('Gift Message is not available')); + throw new CouldNotSaveException(__("The gift message isn't available.")); } $message = []; @@ -136,7 +145,10 @@ public function save($orderId, $orderItemId, \Magento\GiftMessage\Api\Data\Messa $this->giftMessageSaveModel->saveAllInOrder(); unset($this->orders[$orderId]); } catch (\Exception $e) { - throw new CouldNotSaveException(__('Could not add gift message to order: "%1"', $e->getMessage()), $e); + throw new CouldNotSaveException( + __('The gift message couldn\'t be added to the "%1" order.', $e->getMessage()), + $e + ); } return true; } diff --git a/app/code/Magento/GiftMessage/Model/OrderRepository.php b/app/code/Magento/GiftMessage/Model/OrderRepository.php index 1960281367e3a..abf38f1287b7a 100644 --- a/app/code/Magento/GiftMessage/Model/OrderRepository.php +++ b/app/code/Magento/GiftMessage/Model/OrderRepository.php @@ -83,13 +83,15 @@ public function get($orderId) if (!$this->helper->isMessagesAllowed('order', $order, $this->storeManager->getStore())) { throw new NoSuchEntityException( - __('There is no order with provided id or gift message isn\'t allowed') + __("Either no order exists with this ID or gift message isn't allowed.") ); } $messageId = $order->getGiftMessageId(); if (!$messageId) { - throw new NoSuchEntityException(__('There is no item with provided id in the order')); + throw new NoSuchEntityException( + __('No item with the provided ID was found in the Order. Verify the ID and try again.') + ); } return $this->messageFactory->create()->load($messageId); @@ -103,18 +105,20 @@ public function save($orderId, \Magento\GiftMessage\Api\Data\MessageInterface $g /** @var \Magento\Sales\Api\Data\OrderInterface $order */ $order = $this->orderFactory->create()->load($orderId); if (!$order->getEntityId()) { - throw new NoSuchEntityException(__('There is no order with provided id')); + throw new NoSuchEntityException(__('No order exists with this ID. Verify your information and try again.')); }; if (0 == $order->getTotalItemCount()) { - throw new InputException(__('Gift Messages are not applicable for empty order')); + throw new InputException( + __("Gift messages can't be used for an empty order. Create an order, add an item, and try again.") + ); } if ($order->getIsVirtual()) { - throw new InvalidTransitionException(__('Gift Messages are not applicable for virtual products')); + throw new InvalidTransitionException(__("Gift messages can't be used for virtual products.")); } if (!$this->helper->isMessagesAllowed('order', $order, $this->storeManager->getStore())) { - throw new CouldNotSaveException(__('Gift Message is not available')); + throw new CouldNotSaveException(__("The gift message isn't available.")); } $message = []; @@ -130,7 +134,10 @@ public function save($orderId, \Magento\GiftMessage\Api\Data\MessageInterface $g try { $this->giftMessageSaveModel->saveAllInOrder(); } catch (\Exception $e) { - throw new CouldNotSaveException(__('Could not add gift message to order: "%1"', $e->getMessage()), $e); + throw new CouldNotSaveException( + __('The gift message couldn\'t be added to the "%1" order.', $e->getMessage()), + $e + ); } return true; } diff --git a/app/code/Magento/GiftMessage/Model/Plugin/OrderSave.php b/app/code/Magento/GiftMessage/Model/Plugin/OrderSave.php index 260780828faba..8cddc0582f13f 100644 --- a/app/code/Magento/GiftMessage/Model/Plugin/OrderSave.php +++ b/app/code/Magento/GiftMessage/Model/Plugin/OrderSave.php @@ -74,7 +74,7 @@ protected function saveOrderGiftMessage(\Magento\Sales\Api\Data\OrderInterface $ $this->giftMessageOrderRepository->save($order->getEntityId(), $giftMessage); } catch (\Exception $e) { throw new CouldNotSaveException( - __('Could not add gift message to order: "%1"', $e->getMessage()), + __('The gift message couldn\'t be added to the "%1" order.', $e->getMessage()), $e ); } @@ -109,7 +109,7 @@ protected function saveOrderItemGiftMessage(\Magento\Sales\Api\Data\OrderInterfa ); } catch (\Exception $e) { throw new CouldNotSaveException( - __('Could not add gift message to order\'s item: "%1"', $e->getMessage()), + __('The gift message couldn\'t be added to the "%1" order item.', $e->getMessage()), $e ); } diff --git a/app/code/Magento/GiftMessage/Test/Unit/Model/CartRepositoryTest.php b/app/code/Magento/GiftMessage/Test/Unit/Model/CartRepositoryTest.php index b013b4a6de7b4..e41cb48550176 100644 --- a/app/code/Magento/GiftMessage/Test/Unit/Model/CartRepositoryTest.php +++ b/app/code/Magento/GiftMessage/Test/Unit/Model/CartRepositoryTest.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\GiftMessage\Test\Unit\Model; use Magento\GiftMessage\Model\CartRepository; @@ -134,7 +135,7 @@ public function testGet() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Gift Messages are not applicable for empty cart + * @expectedExceptionMessage Gift messages can't be used for an empty cart. Add an item and try again. */ public function testSaveWithInputException() { @@ -144,7 +145,7 @@ public function testSaveWithInputException() /** * @expectedException \Magento\Framework\Exception\State\InvalidTransitionException - * @expectedExceptionMessage Gift Messages are not applicable for virtual products + * @expectedExceptionMessage Gift messages can't be used for virtual products. */ public function testSaveWithInvalidTransitionException() { diff --git a/app/code/Magento/GiftMessage/Test/Unit/Model/GiftMessageManagerTest.php b/app/code/Magento/GiftMessage/Test/Unit/Model/GiftMessageManagerTest.php index a70a946e77fe5..5956a4f5a1f15 100644 --- a/app/code/Magento/GiftMessage/Test/Unit/Model/GiftMessageManagerTest.php +++ b/app/code/Magento/GiftMessage/Test/Unit/Model/GiftMessageManagerTest.php @@ -312,7 +312,7 @@ public function testAddWithQuoteAddressItem() /** * @expectedException \Magento\Framework\Exception\CouldNotSaveException - * @expectedExceptionMessage Could not add gift message to shopping cart + * @expectedExceptionMessage The gift message couldn't be added to Cart. */ public function testSetMessageCouldNotAddGiftMessageException() { diff --git a/app/code/Magento/GiftMessage/Test/Unit/Model/GuestItemRepositoryTest.php b/app/code/Magento/GiftMessage/Test/Unit/Model/GuestItemRepositoryTest.php index f9985a1f92daa..fab9f961f1e4c 100644 --- a/app/code/Magento/GiftMessage/Test/Unit/Model/GuestItemRepositoryTest.php +++ b/app/code/Magento/GiftMessage/Test/Unit/Model/GuestItemRepositoryTest.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\GiftMessage\Test\Unit\Model; use Magento\GiftMessage\Model\ItemRepository; @@ -115,7 +116,7 @@ protected function setUp() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage There is no item with provided id in the cart + * @expectedExceptionMessage No item with the provided ID was found in the Cart. Verify the ID and try again. */ public function testGetWithNoSuchEntityException() { @@ -163,20 +164,22 @@ public function testGet() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage There is no product with provided itemId: 1 in the cart */ public function testSaveWithNoSuchEntityException() { $itemId = 1; $this->quoteMock->expects($this->once())->method('getItemById')->with($itemId)->will($this->returnValue(null)); - $this->itemRepository->save($this->cartId, $this->messageMock, $itemId); + + $this->expectExceptionMessage( + 'No product with the "1" itemId exists in the Cart. Verify your information and try again.' + ); } /** * @expectedException \Magento\Framework\Exception\State\InvalidTransitionException - * @expectedExceptionMessage Gift Messages are not applicable for virtual products + * @expectedExceptionMessage Gift messages can't be used for virtual products. */ public function testSaveWithInvalidTransitionException() { diff --git a/app/code/Magento/GiftMessage/Test/Unit/Model/ItemRepositoryTest.php b/app/code/Magento/GiftMessage/Test/Unit/Model/ItemRepositoryTest.php index 9b0970a3ae2ea..589dcaf2154fc 100644 --- a/app/code/Magento/GiftMessage/Test/Unit/Model/ItemRepositoryTest.php +++ b/app/code/Magento/GiftMessage/Test/Unit/Model/ItemRepositoryTest.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\GiftMessage\Test\Unit\Model; use Magento\GiftMessage\Model\ItemRepository; @@ -115,7 +116,7 @@ protected function setUp() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage There is no item with provided id in the cart + * @expectedExceptionMessage No item with the provided ID was found in the Cart. Verify the ID and try again. */ public function testGetWithNoSuchEntityException() { @@ -163,20 +164,22 @@ public function testGet() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage There is no product with provided itemId: 1 in the cart */ public function testSaveWithNoSuchEntityException() { $itemId = 1; $this->quoteMock->expects($this->once())->method('getItemById')->with($itemId)->will($this->returnValue(null)); - $this->itemRepository->save($this->cartId, $this->messageMock, $itemId); + + $this->expectExceptionMessage( + 'No product with the "1" itemId exists in the Cart. Verify your information and try again.' + ); } /** * @expectedException \Magento\Framework\Exception\State\InvalidTransitionException - * @expectedExceptionMessage Gift Messages are not applicable for virtual products + * @expectedExceptionMessage Gift messages can't be used for virtual products. */ public function testSaveWithInvalidTransitionException() { diff --git a/app/code/Magento/GiftMessage/Test/Unit/Model/OrderItemRepositoryTest.php b/app/code/Magento/GiftMessage/Test/Unit/Model/OrderItemRepositoryTest.php index d6847259dbe5c..ae85e32eceeb6 100644 --- a/app/code/Magento/GiftMessage/Test/Unit/Model/OrderItemRepositoryTest.php +++ b/app/code/Magento/GiftMessage/Test/Unit/Model/OrderItemRepositoryTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\GiftMessage\Test\Unit\Model; use Magento\Framework\Exception\NoSuchEntityException; @@ -169,7 +170,10 @@ public function testGetNoSuchEntityExceptionOnGetItemById() $this->orderItemRepository->get($orderId, $orderItemId); $this->fail('Expected NoSuchEntityException not caught'); } catch (NoSuchEntityException $exception) { - $this->assertEquals('There is no item with provided id in the order', $exception->getMessage()); + $this->assertEquals( + 'No item with the provided ID was found in the Order. Verify the ID and try again.', + $exception->getMessage() + ); } } @@ -206,7 +210,8 @@ public function testGetNoSuchEntityExceptionOnIsMessageAllowed() $this->fail('Expected NoSuchEntityException not caught'); } catch (NoSuchEntityException $exception) { $this->assertEquals( - 'There is no item with provided id in the order or gift message isn\'t allowed', + "No item with the provided ID was found in the Order, or a gift message isn't allowed. " + . "Verify and try again.", $exception->getMessage() ); } @@ -248,7 +253,10 @@ public function testGetNoSuchEntityExceptionOnGetGiftMessageId() $this->orderItemRepository->get($orderId, $orderItemId); $this->fail('Expected NoSuchEntityException not caught'); } catch (NoSuchEntityException $exception) { - $this->assertEquals('There is no item with provided id in the order', $exception->getMessage()); + $this->assertEquals( + 'No item with the provided ID was found in the Order. Verify the ID and try again.', + $exception->getMessage() + ); } } @@ -336,7 +344,10 @@ public function testSaveNoSuchEntityException() $this->orderItemRepository->save($orderId, $orderItemId, $messageMock); $this->fail('Expected NoSuchEntityException not caught'); } catch (NoSuchEntityException $exception) { - $this->assertEquals('There is no item with provided id in the order', $exception->getMessage()); + $this->assertEquals( + 'No item with the provided ID was found in the Order. Verify the ID and try again.', + $exception->getMessage() + ); } } @@ -375,7 +386,7 @@ public function testSaveInvalidTransitionException() $this->orderItemRepository->save($orderId, $orderItemId, $messageMock); $this->fail('Expected InvalidTransitionException not caught'); } catch (InvalidTransitionException $exception) { - $this->assertEquals('Gift Messages are not applicable for virtual products', $exception->getMessage()); + $this->assertEquals("Gift messages can't be used for virtual products.", $exception->getMessage()); } } @@ -418,7 +429,7 @@ public function testSaveCouldNotSaveException() $this->orderItemRepository->save($orderId, $orderItemId, $messageMock); $this->fail('Expected CouldNotSaveException not caught'); } catch (CouldNotSaveException $exception) { - $this->assertEquals('Gift Message is not available', $exception->getMessage()); + $this->assertEquals("The gift message isn't available.", $exception->getMessage()); } } @@ -482,7 +493,7 @@ public function testSaveCouldNotSaveExceptionOnSaveAllInOrder() $this->fail('Expected CouldNotSaveException not caught'); } catch (CouldNotSaveException $exception) { $this->assertEquals( - 'Could not add gift message to order: "' . $excep->getMessage() . '"', + 'The gift message couldn\'t be added to the "' . $excep->getMessage() . '" order.', $exception->getMessage() ); } diff --git a/app/code/Magento/GiftMessage/Test/Unit/Model/Plugin/OrderSaveTest.php b/app/code/Magento/GiftMessage/Test/Unit/Model/Plugin/OrderSaveTest.php index ec8a8841f6477..2170864407ea4 100644 --- a/app/code/Magento/GiftMessage/Test/Unit/Model/Plugin/OrderSaveTest.php +++ b/app/code/Magento/GiftMessage/Test/Unit/Model/Plugin/OrderSaveTest.php @@ -128,7 +128,7 @@ public function testAfterSaveGiftMessages() /** * @expectedException \Magento\Framework\Exception\CouldNotSaveException - * @expectedMessage Could not add gift message to order:Test message + * @expectedMessage The gift message couldn't be added to the "Test message" order. */ public function testAfterSaveIfGiftMessagesNotExist() { @@ -155,7 +155,7 @@ public function testAfterSaveIfGiftMessagesNotExist() /** * @expectedException \Magento\Framework\Exception\CouldNotSaveException - * @expectedMessage Could not add gift message to order:Test message + * @expectedMessage The gift message couldn't be added to the "Test message" order. */ public function testAfterSaveIfItemGiftMessagesNotExist() { diff --git a/app/code/Magento/Indexer/Console/Command/IndexerReindexCommand.php b/app/code/Magento/Indexer/Console/Command/IndexerReindexCommand.php index 43065ada77271..6eab92f65117a 100644 --- a/app/code/Magento/Indexer/Console/Command/IndexerReindexCommand.php +++ b/app/code/Magento/Indexer/Console/Command/IndexerReindexCommand.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Indexer\Console\Command; use Magento\Framework\Console\Cli; @@ -237,7 +238,9 @@ private function getIndexerIdsBySharedIndex($sharedIndex) private function validateSharedIndex($sharedIndex) { if (empty($sharedIndex)) { - throw new \InvalidArgumentException('sharedIndex must be a valid shared index identifier'); + throw new \InvalidArgumentException( + 'The sharedIndex is an invalid shared index identifier. Verify the identifier and try again.' + ); } $indexerIds = $this->getIndexerIdsBySharedIndex($sharedIndex); if (empty($indexerIds)) { diff --git a/app/code/Magento/InstantPurchase/Model/InstantPurchaseOption.php b/app/code/Magento/InstantPurchase/Model/InstantPurchaseOption.php index a780d9716bd94..214b93560669f 100644 --- a/app/code/Magento/InstantPurchase/Model/InstantPurchaseOption.php +++ b/app/code/Magento/InstantPurchase/Model/InstantPurchaseOption.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\InstantPurchase\Model; use Magento\Customer\Model\Address; @@ -101,7 +102,9 @@ public function isAvailable(): bool public function getPaymentToken(): PaymentTokenInterface { if (!isset($this->paymentToken)) { - throw new LocalizedException(__('Payment method is not defined for instance purchase.')); + throw new LocalizedException( + __("A payment method isn't defined for instance purchase. Verify and try again.") + ); } return $this->paymentToken; } diff --git a/app/code/Magento/Integration/Controller/Adminhtml/Integration/Save.php b/app/code/Magento/Integration/Controller/Adminhtml/Integration/Save.php index dfddd8b954bd3..cb2fcb2ba0e29 100644 --- a/app/code/Magento/Integration/Controller/Adminhtml/Integration/Save.php +++ b/app/code/Magento/Integration/Controller/Adminhtml/Integration/Save.php @@ -56,7 +56,7 @@ public function execute() return; } if ($integrationData[Info::DATA_SETUP_TYPE] == IntegrationModel::TYPE_CONFIG) { - throw new LocalizedException(__('Cannot edit integrations created via config file.')); + throw new LocalizedException(__("The integrations created in the config file can't be edited.")); } } $this->validateUser(); diff --git a/app/code/Magento/Integration/Controller/Adminhtml/Integration/TokensExchange.php b/app/code/Magento/Integration/Controller/Adminhtml/Integration/TokensExchange.php index e295198766501..a49561dd95ade 100644 --- a/app/code/Magento/Integration/Controller/Adminhtml/Integration/TokensExchange.php +++ b/app/code/Magento/Integration/Controller/Adminhtml/Integration/TokensExchange.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Integration\Controller\Adminhtml\Integration; use Magento\Integration\Model\Integration as IntegrationModel; @@ -57,7 +58,10 @@ public function execute() $consumer = $this->_oauthService->loadConsumer($integration->getConsumerId()); if (!$consumer->getId()) { throw new \Magento\Framework\Oauth\Exception( - __('A consumer with ID %1 does not exist', $integration->getConsumerId()) + __( + 'A consumer with "%1" ID doesn\'t exist. Verify the ID and try again.', + $integration->getConsumerId() + ) ); } /** Initialize response body */ diff --git a/app/code/Magento/Integration/Model/AdminTokenService.php b/app/code/Magento/Integration/Model/AdminTokenService.php index 080181b5d8d61..5a030325e9fbd 100644 --- a/app/code/Magento/Integration/Model/AdminTokenService.php +++ b/app/code/Magento/Integration/Model/AdminTokenService.php @@ -87,7 +87,10 @@ public function createAdminAccessToken($username, $password) * Need to make sure that this is refactored once exception handling is updated in Auth Model. */ throw new AuthenticationException( - __('You did not sign in correctly or your account is temporarily disabled.') + __( + 'The account sign-in was incorrect or your account is disabled temporarily. ' + . 'Please wait and try again later.' + ) ); } $this->getRequestThrottler()->resetAuthenticationFailuresCount($username, RequestThrottler::USER_TYPE_ADMIN); @@ -114,7 +117,7 @@ public function revokeAdminAccessToken($adminId) $token->delete(); } } catch (\Exception $e) { - throw new LocalizedException(__('The tokens could not be revoked.')); + throw new LocalizedException(__("The tokens couldn't be revoked.")); } return true; } diff --git a/app/code/Magento/Integration/Model/AuthorizationService.php b/app/code/Magento/Integration/Model/AuthorizationService.php index 1375116bd96d4..b51f1a773b8a7 100644 --- a/app/code/Magento/Integration/Model/AuthorizationService.php +++ b/app/code/Magento/Integration/Model/AuthorizationService.php @@ -104,7 +104,7 @@ public function grantPermissions($integrationId, $resources) } catch (\Exception $e) { $this->_logger->critical($e); throw new LocalizedException( - __('Sorry, something went wrong granting permissions. You can find out more in the exceptions log.') + __('An error occurred during the attempt to grant permissions. For details, see the exceptions log.') ); } } diff --git a/app/code/Magento/Integration/Model/CredentialsValidator.php b/app/code/Magento/Integration/Model/CredentialsValidator.php index d736a1f490063..f058d5ac77bd8 100644 --- a/app/code/Magento/Integration/Model/CredentialsValidator.php +++ b/app/code/Magento/Integration/Model/CredentialsValidator.php @@ -25,10 +25,10 @@ public function validate($username, $password) { $exception = new InputException(); if (!is_string($username) || strlen($username) == 0) { - $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'username'])); + $exception->addError(__('"%fieldName" is required. Enter and try again.', ['fieldName' => 'username'])); } if (!is_string($password) || strlen($password) == 0) { - $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'password'])); + $exception->addError(__('"%fieldName" is required. Enter and try again.', ['fieldName' => 'password'])); } if ($exception->wasErrorAdded()) { throw $exception; diff --git a/app/code/Magento/Integration/Model/CustomerTokenService.php b/app/code/Magento/Integration/Model/CustomerTokenService.php index 947ca6f9f8821..3c245804a9f6e 100644 --- a/app/code/Magento/Integration/Model/CustomerTokenService.php +++ b/app/code/Magento/Integration/Model/CustomerTokenService.php @@ -80,7 +80,10 @@ public function createCustomerAccessToken($username, $password) } catch (\Exception $e) { $this->getRequestThrottler()->logAuthenticationFailure($username, RequestThrottler::USER_TYPE_CUSTOMER); throw new AuthenticationException( - __('You did not sign in correctly or your account is temporarily disabled.') + __( + 'The account sign-in was incorrect or your account is disabled temporarily. ' + . 'Please wait and try again later.' + ) ); } $this->getRequestThrottler()->resetAuthenticationFailuresCount($username, RequestThrottler::USER_TYPE_CUSTOMER); @@ -107,7 +110,7 @@ public function revokeCustomerAccessToken($customerId) $token->delete(); } } catch (\Exception $e) { - throw new LocalizedException(__('The tokens could not be revoked.')); + throw new LocalizedException(__("The tokens couldn't be revoked.")); } return true; } diff --git a/app/code/Magento/Integration/Model/IntegrationService.php b/app/code/Magento/Integration/Model/IntegrationService.php index 6acb692273957..9818d76c94456 100644 --- a/app/code/Magento/Integration/Model/IntegrationService.php +++ b/app/code/Magento/Integration/Model/IntegrationService.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Integration\Model; use Magento\Integration\Model\Integration as IntegrationModel; @@ -129,7 +130,7 @@ private function _checkIntegrationByName($name) { $integration = $this->_integrationFactory->create()->load($name, 'name'); if ($integration->getId()) { - throw new IntegrationException(__('Integration with name \'%1\' exists.', $name)); + throw new IntegrationException(__('The integration with name "%1" exists.', $name)); } } @@ -144,7 +145,7 @@ protected function _loadIntegrationById($integrationId) { $integration = $this->_integrationFactory->create()->load($integrationId); if (!$integration->getId()) { - throw new IntegrationException(__('Integration with ID \'%1\' does not exist.', $integrationId)); + throw new IntegrationException(__('The integration with ID "%1" doesn\'t exist.', $integrationId)); } return $integration; } diff --git a/app/code/Magento/Integration/Model/Oauth/Token/Provider.php b/app/code/Magento/Integration/Model/Oauth/Token/Provider.php index c43118b4f76d6..cc8c40be4bc63 100644 --- a/app/code/Magento/Integration/Model/Oauth/Token/Provider.php +++ b/app/code/Magento/Integration/Model/Oauth/Token/Provider.php @@ -258,7 +258,7 @@ protected function _getToken($token) { if (!$this->validateOauthToken($token)) { throw new \Magento\Framework\Oauth\Exception( - __('Token is not the correct length') + __('The token length is invalid. Check the length and try again.') ); } diff --git a/app/code/Magento/Integration/Model/Oauth/Token/RequestThrottler.php b/app/code/Magento/Integration/Model/Oauth/Token/RequestThrottler.php index 9af6510d0930e..9ec907a657c92 100644 --- a/app/code/Magento/Integration/Model/Oauth/Token/RequestThrottler.php +++ b/app/code/Magento/Integration/Model/Oauth/Token/RequestThrottler.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Integration\Model\Oauth\Token; use Magento\Integration\Model\Oauth\Token\RequestLog\ReaderInterface as RequestLogReader; @@ -65,7 +66,10 @@ public function throttle($userName, $userType) $count = $this->requestLogReader->getFailuresCount($userName, $userType); if ($count >= $this->requestLogConfig->getMaxFailuresCount()) { throw new AuthenticationException( - __('You did not sign in correctly or your account is temporarily disabled.') + __( + 'The account sign-in was incorrect or your account is disabled temporarily. ' + . 'Please wait and try again later.' + ) ); } } diff --git a/app/code/Magento/Integration/Model/OauthService.php b/app/code/Magento/Integration/Model/OauthService.php index 859f3815d0702..03aaf27319c0c 100644 --- a/app/code/Magento/Integration/Model/OauthService.php +++ b/app/code/Magento/Integration/Model/OauthService.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Integration\Model; use Magento\Framework\Oauth\Helper\Oauth as OauthHelper; @@ -129,7 +130,9 @@ public function createConsumer($consumerData) throw $exception; } catch (\Exception $exception) { throw new \Magento\Framework\Oauth\Exception( - __('Unexpected error. Unable to create oAuth consumer account.') + __( + "The oAuth consumer account couldn't be created due to an unexpected error. Please try again later." + ) ); } } @@ -186,7 +189,7 @@ public function loadConsumer($consumerId) throw $exception; } catch (\Exception $exception) { throw new \Magento\Framework\Oauth\Exception( - __('Unexpected error. Unable to load oAuth consumer account.') + __("The oAuth consumer account couldn't be loaded due to an unexpected error. Please try again later.") ); } } @@ -202,7 +205,7 @@ public function loadConsumerByKey($key) throw $exception; } catch (\Exception $exception) { throw new \Magento\Framework\Oauth\Exception( - __('Unexpected error. Unable to load oAuth consumer account.') + __("The oAuth consumer account couldn't be loaded due to an unexpected error. Please try again later.") ); } } @@ -218,7 +221,7 @@ public function postToConsumer($consumerId, $endpointUrl) $consumer->save(); if (!$consumer->getId()) { throw new \Magento\Framework\Oauth\Exception( - __('A consumer with ID %1 does not exist', $consumerId) + __('A consumer with "%1" ID doesn\'t exist. Verify the ID and try again.', $consumerId) ); } $consumerData = $consumer->getData(); @@ -245,7 +248,7 @@ public function postToConsumer($consumerId, $endpointUrl) } catch (\Exception $exception) { $this->_logger->critical($exception); throw new \Magento\Framework\Oauth\Exception( - __('Unable to post data to consumer due to an unexpected error') + __('The attempt to post data to consumer failed due to an unexpected error. Please try again later.') ); } } @@ -287,7 +290,9 @@ protected function _loadConsumerById($consumerId) { $consumer = $this->_consumerFactory->create()->load($consumerId); if (!$consumer->getId()) { - throw new IntegrationException(__('Consumer with ID \'%1\' does not exist.', $consumerId)); + throw new IntegrationException( + __('A consumer with ID "%1" doesn\'t exist. Verify the ID and try again.', $consumerId) + ); } return $consumer; } diff --git a/app/code/Magento/Integration/Test/Unit/Controller/Adminhtml/Integration/DeleteTest.php b/app/code/Magento/Integration/Test/Unit/Controller/Adminhtml/Integration/DeleteTest.php index e0fba2a85d776..dcb0ddccf6f83 100644 --- a/app/code/Magento/Integration/Test/Unit/Controller/Adminhtml/Integration/DeleteTest.php +++ b/app/code/Magento/Integration/Test/Unit/Controller/Adminhtml/Integration/DeleteTest.php @@ -156,7 +156,7 @@ public function testDeleteActionForServiceIntegrationException() ->willReturn(self::INTEGRATION_ID); // Use real translate model $this->_translateModelMock = null; - $exceptionMessage = __("Integration with ID '%1' doesn't exist.", $intData[Info::DATA_ID]); + $exceptionMessage = __('The integration with ID "%1" doesn\'t exist.', $intData[Info::DATA_ID]); $invalidIdException = new IntegrationException($exceptionMessage); $this->_integrationSvcMock->expects($this->once()) ->method('delete') @@ -178,7 +178,7 @@ public function testDeleteActionForServiceGenericException() ->willReturn(self::INTEGRATION_ID); // Use real translate model $this->_translateModelMock = null; - $exceptionMessage = __("Integration with ID '%1' doesn't exist.", $intData[Info::DATA_ID]); + $exceptionMessage = __('The integration with ID "%1" doesn\'t exist.', $intData[Info::DATA_ID]); $invalidIdException = new \Exception($exceptionMessage); $this->_integrationSvcMock->expects($this->once()) ->method('delete') diff --git a/app/code/Magento/Integration/Test/Unit/Controller/Adminhtml/Integration/SaveTest.php b/app/code/Magento/Integration/Test/Unit/Controller/Adminhtml/Integration/SaveTest.php index 739af68173642..63026cb99e0a0 100644 --- a/app/code/Magento/Integration/Test/Unit/Controller/Adminhtml/Integration/SaveTest.php +++ b/app/code/Magento/Integration/Test/Unit/Controller/Adminhtml/Integration/SaveTest.php @@ -181,7 +181,7 @@ public function testSaveActionExceptionDuringServiceCreation() public function testSaveActionExceptionOnIntegrationsCreatedFromConfigFile() { - $exceptionMessage = 'Cannot edit integrations created via config file.'; + $exceptionMessage = "The integrations created in the config file can't be edited."; $intData = new \Magento\Framework\DataObject( [ Info::DATA_NAME => 'nameTest', @@ -215,7 +215,7 @@ public function testSaveActionExceptionOnIntegrationsCreatedFromConfigFile() */ public function testSaveActionUserLockedException() { - $exceptionMessage = __('Your account is temporarily disabled.'); + $exceptionMessage = __('Your account is temporarily disabled. Please try again later.'); $passwordString = '1234567'; $this->_requestMock->expects($this->exactly(2)) @@ -254,7 +254,8 @@ public function testSaveActionUserLockedException() public function testSaveActionAuthenticationException() { $passwordString = '1234567'; - $exceptionMessage = __('You have entered an invalid password for current user.'); + $exceptionMessage = + __('The password entered for the current user is invalid. Verify the password and try again.'); $this->_requestMock->expects($this->any()) ->method('getParam') diff --git a/app/code/Magento/Integration/Test/Unit/Model/AdminTokenServiceTest.php b/app/code/Magento/Integration/Test/Unit/Model/AdminTokenServiceTest.php index 6fd8799045292..e0b1113e80d8d 100644 --- a/app/code/Magento/Integration/Test/Unit/Model/AdminTokenServiceTest.php +++ b/app/code/Magento/Integration/Test/Unit/Model/AdminTokenServiceTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Integration\Test\Unit\Model; use Magento\Integration\Model\Oauth\Token; @@ -116,7 +117,7 @@ public function testRevokeAdminAccessTokenWithoutAdminId() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage The tokens could not be revoked. + * @expectedExceptionMessage The tokens couldn't be revoked. */ public function testRevokeAdminAccessTokenCannotRevoked() { diff --git a/app/code/Magento/Integration/Test/Unit/Model/AuthorizationServiceTest.php b/app/code/Magento/Integration/Test/Unit/Model/AuthorizationServiceTest.php index 475fb75d68517..230cb1e94fec8 100644 --- a/app/code/Magento/Integration/Test/Unit/Model/AuthorizationServiceTest.php +++ b/app/code/Magento/Integration/Test/Unit/Model/AuthorizationServiceTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Integration\Test\Unit\Model; use Magento\Authorization\Model\ResourceModel\Rules; @@ -177,7 +178,6 @@ public function testGrantPermissionsNoRole() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Sorry, something went wrong granting permissions. */ public function testGrantPermissionsException() { @@ -197,6 +197,10 @@ public function testGrantPermissionsException() $this->rulesMock->expects($this->any())->method('saveRel')->will($this->throwException(new \Exception())); $this->integrationAuthorizationService->grantPermissions(self::INTEGRATION_ID, $this->resources); + + $this->expectExceptionMessage( + 'An error occurred during the attempt to grant permissions. For details, see the exceptions log.' + ); } public function testGrantAllPermissions() diff --git a/app/code/Magento/Integration/Test/Unit/Model/CredentialsValidatorTest.php b/app/code/Magento/Integration/Test/Unit/Model/CredentialsValidatorTest.php index cd9e2657fa324..94d72b47c24e2 100644 --- a/app/code/Magento/Integration/Test/Unit/Model/CredentialsValidatorTest.php +++ b/app/code/Magento/Integration/Test/Unit/Model/CredentialsValidatorTest.php @@ -22,7 +22,7 @@ protected function setUp() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage username is a required field. + * @expectedExceptionMessage "username" is required. Enter and try again. */ public function testValidateNoUsername() { @@ -34,7 +34,7 @@ public function testValidateNoUsername() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage password is a required field. + * @expectedExceptionMessage "password" is required. Enter and try again. */ public function testValidateNoPassword() { diff --git a/app/code/Magento/Integration/Test/Unit/Model/CustomerTokenServiceTest.php b/app/code/Magento/Integration/Test/Unit/Model/CustomerTokenServiceTest.php index ecd4788545c0a..1a7c819343294 100644 --- a/app/code/Magento/Integration/Test/Unit/Model/CustomerTokenServiceTest.php +++ b/app/code/Magento/Integration/Test/Unit/Model/CustomerTokenServiceTest.php @@ -117,7 +117,7 @@ public function testRevokeCustomerAccessTokenWithoutCustomerId() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage The tokens could not be revoked. + * @expectedExceptionMessage The tokens couldn't be revoked. */ public function testRevokeCustomerAccessTokenCannotRevoked() { diff --git a/app/code/Magento/Integration/Test/Unit/Model/IntegrationServiceTest.php b/app/code/Magento/Integration/Test/Unit/Model/IntegrationServiceTest.php index 60c7d43193344..09b02419fb0e8 100644 --- a/app/code/Magento/Integration/Test/Unit/Model/IntegrationServiceTest.php +++ b/app/code/Magento/Integration/Test/Unit/Model/IntegrationServiceTest.php @@ -5,6 +5,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Integration\Test\Unit\Model; use Magento\Integration\Model\Integration; @@ -149,7 +150,7 @@ public function testCreateSuccess() /** * @expectedException \Magento\Framework\Exception\IntegrationException - * @expectedExceptionMessage Integration with name 'Integration Name' exists. + * @expectedExceptionMessage The integration with name "Integration Name" exists. */ public function testCreateIntegrationAlreadyExistsException() { @@ -244,7 +245,7 @@ public function testUpdateSuccessNameChanged() /** * @expectedException \Magento\Framework\Exception\IntegrationException - * @expectedExceptionMessage Integration with name 'Another Integration Name' exists. + * @expectedExceptionMessage The integration with name "Another Integration Name" exists. */ public function testUpdateException() { @@ -297,7 +298,7 @@ public function testGet() /** * @expectedException \Magento\Framework\Exception\IntegrationException - * @expectedExceptionMessage Integration with ID '1' does not exist. + * @expectedExceptionMessage The integration with ID "1" doesn't exist. */ public function testGetException() { @@ -385,7 +386,7 @@ public function testDelete() /** * @expectedException \Magento\Framework\Exception\IntegrationException - * @expectedExceptionMessage Integration with ID '1' does not exist. + * @expectedExceptionMessage The integration with ID "1" doesn't exist. */ public function testDeleteException() { diff --git a/app/code/Magento/Integration/Test/Unit/Model/Oauth/Token/ProviderTest.php b/app/code/Magento/Integration/Test/Unit/Model/Oauth/Token/ProviderTest.php index b7a5193f443ff..2fe0632a0ae69 100644 --- a/app/code/Magento/Integration/Test/Unit/Model/Oauth/Token/ProviderTest.php +++ b/app/code/Magento/Integration/Test/Unit/Model/Oauth/Token/ProviderTest.php @@ -340,7 +340,7 @@ public function testValidateRequestTokenNotExistentToken() /** * @expectedException \Magento\Framework\Oauth\Exception - * @expectedExceptionMessage Token is not the correct length + * @expectedExceptionMessage The token length is invalid. Check the length and try again. */ public function testValidateRequestTokenIncorrectLengthToken() { diff --git a/app/code/Magento/Integration/Test/Unit/Model/OauthServiceTest.php b/app/code/Magento/Integration/Test/Unit/Model/OauthServiceTest.php index 85d8b50097aed..9b8293c285c04 100644 --- a/app/code/Magento/Integration/Test/Unit/Model/OauthServiceTest.php +++ b/app/code/Magento/Integration/Test/Unit/Model/OauthServiceTest.php @@ -5,6 +5,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Integration\Test\Unit\Model; use Magento\Integration\Model\Oauth\Token; @@ -141,7 +142,7 @@ public function testDelete() /** * @return void * @expectedException \Magento\Framework\Exception\IntegrationException - * @expectedExceptionMessage Consumer with ID '1' does not exist. + * @expectedExceptionMessage A consumer with ID "1" doesn't exist. Verify the ID and try again. */ public function testDeleteException() { @@ -288,7 +289,6 @@ public function testLoadConsumer() /** * @return void * @expectedException \Magento\Framework\Oauth\Exception - * @expectedExceptionMessage Unexpected error. Unable to load oAuth consumer account. */ public function testLoadConsumerException() { @@ -298,10 +298,19 @@ public function testLoadConsumerException() 'load' )->will( $this->throwException( - new \Magento\Framework\Oauth\Exception(__('Unexpected error. Unable to load oAuth consumer account.')) + new \Magento\Framework\Oauth\Exception( + __( + "The oAuth consumer account couldn't be loaded due to an unexpected error. " + . "Please try again later." + ) + ) ) ); $this->_service->loadConsumer(self::VALUE_CONSUMER_ID); + + $this->expectExceptionMessage( + "The oAuth consumer account couldn't be loaded due to an unexpected error. Please try again later." + ); } /** @@ -328,7 +337,6 @@ public function testLoadConsumerByKey() /** * @return void * @expectedException \Magento\Framework\Oauth\Exception - * @expectedExceptionMessage Unexpected error. Unable to load oAuth consumer account. */ public function testLoadConsumerByKeyException() { @@ -338,10 +346,19 @@ public function testLoadConsumerByKeyException() 'load' )->will( $this->throwException( - new \Magento\Framework\Oauth\Exception(__('Unexpected error. Unable to load oAuth consumer account.')) + new \Magento\Framework\Oauth\Exception( + __( + "The oAuth consumer account couldn't be loaded due to an unexpected error. " + . "Please try again later." + ) + ) ) ); $this->_service->loadConsumerByKey(self::VALUE_CONSUMER_KEY); + + $this->expectExceptionMessage( + "The oAuth consumer account couldn't be loaded due to an unexpected error. Please try again later." + ); } /** diff --git a/app/code/Magento/Integration/Test/Unit/Oauth/OauthTest.php b/app/code/Magento/Integration/Test/Unit/Oauth/OauthTest.php index 4e928985b7ae4..875377776771d 100644 --- a/app/code/Magento/Integration/Test/Unit/Oauth/OauthTest.php +++ b/app/code/Magento/Integration/Test/Unit/Oauth/OauthTest.php @@ -505,7 +505,7 @@ public function testGetAccessTokenVersionRejected() * \Magento\Framework\Oauth\OauthInterface::ERR_PARAMETER_ABSENT * * @expectedException \Magento\Framework\Oauth\OauthInputException - * @expectedExceptionMessage oauth_verifier is a required field. + * @expectedExceptionMessage "oauth_verifier" is required. Enter and try again. */ public function testGetAccessTokenParameterAbsent() { diff --git a/app/code/Magento/MediaStorage/Helper/File/Media.php b/app/code/Magento/MediaStorage/Helper/File/Media.php index 72b99728a99cc..0bacd44bdc13f 100644 --- a/app/code/Magento/MediaStorage/Helper/File/Media.php +++ b/app/code/Magento/MediaStorage/Helper/File/Media.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\MediaStorage\Helper\File; use Magento\Framework\App\Filesystem\DirectoryList; @@ -61,7 +62,9 @@ public function collectFileInfo($mediaDirectory, $path) $dir = $this->filesystem->getDirectoryRead(DirectoryList::MEDIA); $relativePath = $dir->getRelativePath($fullPath); if (!$dir->isFile($relativePath)) { - throw new \Magento\Framework\Exception\LocalizedException(__('File %1 does not exist', $fullPath)); + throw new \Magento\Framework\Exception\LocalizedException( + __('The "%1" file doesn\'t exist. Verify the file and try again.', $fullPath) + ); } if (!$dir->isReadable($relativePath)) { throw new \Magento\Framework\Exception\LocalizedException(__('File %1 is not readable', $fullPath)); diff --git a/app/code/Magento/MediaStorage/Test/Unit/Helper/File/MediaTest.php b/app/code/Magento/MediaStorage/Test/Unit/Helper/File/MediaTest.php index 0c50b6e130484..59f0d08ba3adb 100644 --- a/app/code/Magento/MediaStorage/Test/Unit/Helper/File/MediaTest.php +++ b/app/code/Magento/MediaStorage/Test/Unit/Helper/File/MediaTest.php @@ -97,7 +97,7 @@ public function pathDataProvider() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage File mediaDir/path does not exist + * @expectedExceptionMessage The "mediaDir/path" file doesn't exist. Verify the file and try again. */ public function testCollectFileInfoNotFile() { diff --git a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php index a3edd57d54e05..fdbe1d24ba1f5 100644 --- a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php +++ b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Multishipping\Model\Checkout\Type; use Magento\Customer\Api\AddressRepositoryInterface; @@ -396,7 +397,11 @@ public function setShippingItemsInformation($info) $maxQty = $this->helper->getMaximumQty(); if ($allQty > $maxQty) { throw new \Magento\Framework\Exception\LocalizedException( - __('Maximum qty allowed for Shipping to multiple addresses is %1', $maxQty) + __( + "The maximum quantity can't be more than %1 when shipping to multiple addresses. " + . "Change the quantity and try again.", + $maxQty + ) ); } $quote = $this->getQuote(); @@ -478,7 +483,7 @@ protected function _addShippingItem($quoteItemId, $data) if ($addressId && $quoteItem) { if (!$this->isAddressIdApplicable($addressId)) { - throw new LocalizedException(__('Please check shipping address information.')); + throw new LocalizedException(__('Verify the shipping address information and continue.')); } /** @@ -526,7 +531,7 @@ protected function _addShippingItem($quoteItemId, $data) public function updateQuoteCustomerShippingAddress($addressId) { if (!$this->isAddressIdApplicable($addressId)) { - throw new LocalizedException(__('Please check shipping address information.')); + throw new LocalizedException(__('Verify the shipping address information and continue.')); } try { $address = $this->addressRepository->getById($addressId); @@ -553,7 +558,7 @@ public function updateQuoteCustomerShippingAddress($addressId) public function setQuoteCustomerBillingAddress($addressId) { if (!$this->isAddressIdApplicable($addressId)) { - throw new LocalizedException(__('Please check billing address information.')); + throw new LocalizedException(__('Verify the billing address information and continue.')); } try { $address = $this->addressRepository->getById($addressId); @@ -588,7 +593,7 @@ public function setShippingMethods($methods) $address->setShippingMethod($methods[$addressId]); } elseif (!$address->getShippingMethod()) { throw new \Magento\Framework\Exception\LocalizedException( - __('Please select shipping methods for all addresses.') + __('Set shipping methods for all addresses. Verify the shipping methods and try again.') ); } } @@ -608,12 +613,15 @@ public function setPaymentMethod($payment) { if (!isset($payment['method'])) { throw new \Magento\Framework\Exception\LocalizedException( - __('A payment method is not defined.') + __("A payment method isn't defined. Verify and try again.") ); } if (!$this->paymentSpecification->isSatisfiedBy($payment['method'])) { throw new \Magento\Framework\Exception\LocalizedException( - __('The requested payment method is not available for multishipping.') + __( + "This payment method can't be used for shipping to multiple addresses. " + . "Change the payment method and try again." + ) ); } $quote = $this->getQuote(); @@ -660,7 +668,7 @@ protected function _prepareOrder(\Magento\Quote\Model\Quote\Address $address) $_quoteItem = $item->getQuoteItem(); if (!$_quoteItem) { throw new \Magento\Checkout\Exception( - __('Item not found or already ordered') + __("The item isn't found, or it's already ordered.") ); } $item->setProductType( @@ -692,7 +700,7 @@ protected function _validate() $paymentMethod = $quote->getPayment()->getMethodInstance(); if (!$paymentMethod->isAvailable($quote)) { throw new \Magento\Framework\Exception\LocalizedException( - __('Please specify a payment method.') + __("The payment method isn't selected. Enter the payment method and try again.") ); } @@ -701,27 +709,29 @@ protected function _validate() $addressValidation = $address->validate(); if ($addressValidation !== true) { throw new \Magento\Framework\Exception\LocalizedException( - __('Please check shipping addresses information.') + __('Verify the shipping address information and continue.') ); } $method = $address->getShippingMethod(); $rate = $address->getShippingRateByCode($method); if (!$method || !$rate) { throw new \Magento\Framework\Exception\LocalizedException( - __('Please specify shipping methods for all addresses.') + __('Set shipping methods for all addresses. Verify the shipping methods and try again.') ); } // Checks if a country id present in the allowed countries list. if (!in_array($address->getCountryId(), $this->allowedCountryReader->getAllowedCountries())) { throw new \Magento\Framework\Exception\LocalizedException( - __('Some addresses cannot be used due to country-specific configurations.') + __("Some addresses can't be used due to the configurations for specific countries.") ); } } $addressValidation = $quote->getBillingAddress()->validate(); if ($addressValidation !== true) { - throw new \Magento\Framework\Exception\LocalizedException(__('Please check billing address information.')); + throw new \Magento\Framework\Exception\LocalizedException( + __('Verify the billing address information and continue.') + ); } return $this; } @@ -906,7 +916,7 @@ private function getDefaultAddressByDataKey($key, $defaultAddressIdFromCustomer) $addressId = $defaultAddressIdFromCustomer; if (!$addressId) { /** Default address is not available, try to find any customer address */ - $filter = $this->filterBuilder->setField('parent_id') + $filter = $this->filterBuilder->setField('parent_id') ->setValue($this->getCustomer()->getId()) ->setConditionType('eq') ->create(); diff --git a/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php b/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php index 749fd178ec7c3..b2e484e148f43 100644 --- a/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php +++ b/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Multishipping\Test\Unit\Model\Checkout\Type; use Magento\Checkout\Model\Session; @@ -242,7 +243,7 @@ public function testSetShippingItemsInformation() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Please check shipping address information. + * @expectedExceptionMessage Verify the shipping address information and continue. */ public function testSetShippingItemsInformationForAddressLeak() { @@ -288,7 +289,7 @@ public function testUpdateQuoteCustomerShippingAddress() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Please check shipping address information. + * @expectedExceptionMessage Verify the shipping address information and continue. */ public function testUpdateQuoteCustomerShippingAddressForAddressLeak() { @@ -318,7 +319,7 @@ public function testSetQuoteCustomerBillingAddress() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Please check billing address information. + * @expectedExceptionMessage Verify the billing address information and continue. */ public function testSetQuoteCustomerBillingAddressForAddressLeak() { @@ -368,7 +369,7 @@ public function testSetShippingMethods() * Tests exception for addresses with country id not in the allowed countries list. * * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Some addresses cannot be used due to country-specific configurations. + * @expectedExceptionMessage Some addresses can't be used due to the configurations for specific countries. */ public function testCreateOrdersCountryNotPresentInAllowedListException() { diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php b/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php index 87d4b984cf933..2c4fc9a4ccfe1 100644 --- a/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php +++ b/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\OfflineShipping\Model\Carrier; use Magento\Framework\Exception\LocalizedException; @@ -228,7 +229,9 @@ public function getCode($type, $code = '') ]; if (!isset($codes[$type])) { - throw new LocalizedException(__('Please correct Table Rate code type: %1.', $type)); + throw new LocalizedException( + __('The "%1" code type for Table Rate is incorrect. Verify the type and try again.', $type) + ); } if ('' === $code) { @@ -236,7 +239,9 @@ public function getCode($type, $code = '') } if (!isset($codes[$type][$code])) { - throw new LocalizedException(__('Please correct Table Rate code for type %1: %2.', $type, $code)); + throw new LocalizedException( + __('The "%1: %2" code type for Table Rate is incorrect. Verify the type and try again.', $type, $code) + ); } return $codes[$type][$code]; diff --git a/app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate/CSV/RowParser.php b/app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate/CSV/RowParser.php index 4d2e11ebb8a1e..9431973fdfe91 100644 --- a/app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate/CSV/RowParser.php +++ b/app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate/CSV/RowParser.php @@ -62,7 +62,12 @@ public function parse( ) { // validate row if (count($rowData) < 5) { - throw new RowException(__('Please correct Table Rates format in the Row #%1.', $rowNumber)); + throw new RowException( + __( + 'The Table Rates File Format is incorrect in row number "%1". Verify the format and try again.', + $rowNumber + ) + ); } $countryId = $this->getCountryId($rowData, $rowNumber, $columnResolver); @@ -99,7 +104,13 @@ private function getCountryId(array $rowData, $rowNumber, ColumnResolver $column } elseif ($countryCode === '*' || $countryCode === '') { $countryId = '0'; } else { - throw new RowException(__('Please correct Country "%1" in the Row #%2.', $countryCode, $rowNumber)); + throw new RowException( + __( + 'The "%1" country in row number "%2" is incorrect. Verify the country and try again.', + $countryCode, + $rowNumber + ) + ); } return $countryId; } @@ -121,7 +132,14 @@ private function getRegionId(array $rowData, $rowNumber, ColumnResolver $columnR } elseif ($regionCode === '*' || $regionCode === '') { $regionId = 0; } else { - throw new RowException(__('Please correct Region/State "%1" in the Row #%2.', $regionCode, $rowNumber)); + throw new RowException( + __( + 'The "%1" region or state in row number "%2" is incorrect. ' + . 'Verify the region or state and try again.', + $regionCode, + $rowNumber + ) + ); } return $regionId; } @@ -181,7 +199,13 @@ private function getPrice(array $rowData, $rowNumber, ColumnResolver $columnReso $priceValue = $columnResolver->getColumnValue(ColumnResolver::COLUMN_PRICE, $rowData); $price = $this->_parseDecimalValue($priceValue); if ($price === false) { - throw new RowException(__('Please correct Shipping Price "%1" in the Row #%2.', $priceValue, $rowNumber)); + throw new RowException( + __( + 'The "%1" shipping price in row number "%2" is incorrect. Verify the shipping price and try again.', + $priceValue, + $rowNumber + ) + ); } return $price; } diff --git a/app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate/Import.php b/app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate/Import.php index 1012394f22fcb..a5b0d7e87d2e1 100644 --- a/app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate/Import.php +++ b/app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate/Import.php @@ -16,6 +16,9 @@ use Magento\OfflineShipping\Model\ResourceModel\Carrier\Tablerate\CSV\RowParser; use Magento\Store\Model\StoreManagerInterface; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class Import { /** @@ -178,7 +181,9 @@ private function getHeaders(ReadInterface $file) // check and skip headers $headers = $file->readCsv(); if ($headers === false || count($headers) < 5) { - throw new LocalizedException(__('Please correct Table Rates File Format.')); + throw new LocalizedException( + __('The Table Rates File Format is incorrect. Verify the format and try again.') + ); } return $headers; } diff --git a/app/code/Magento/OfflineShipping/Test/Unit/Model/ResourceModel/Carrier/Tablerate/CSV/RowParserTest.php b/app/code/Magento/OfflineShipping/Test/Unit/Model/ResourceModel/Carrier/Tablerate/CSV/RowParserTest.php index 2f6c5ca600bd3..4807d4956d266 100644 --- a/app/code/Magento/OfflineShipping/Test/Unit/Model/ResourceModel/Carrier/Tablerate/CSV/RowParserTest.php +++ b/app/code/Magento/OfflineShipping/Test/Unit/Model/ResourceModel/Carrier/Tablerate/CSV/RowParserTest.php @@ -143,7 +143,7 @@ public function parseWithExceptionDataProvider() [$conditionFullName, $rowData, 40], [ColumnResolver::COLUMN_PRICE, $rowData, 350], ], - 'Please correct Country "XX" in the Row #120.', + 'The "XX" country in row number "120" is incorrect. Verify the country and try again.', ], [ $rowData, @@ -155,7 +155,7 @@ public function parseWithExceptionDataProvider() [$conditionFullName, $rowData, 40], [ColumnResolver::COLUMN_PRICE, $rowData, 350], ], - 'Please correct Region/State "AA" in the Row #120.', + 'The "AA" region or state in row number "120" is incorrect. Verify the region or state and try again.', ], [ $rowData, @@ -179,7 +179,7 @@ public function parseWithExceptionDataProvider() [$conditionFullName, $rowData, 40], [ColumnResolver::COLUMN_PRICE, $rowData, 'BBB'], ], - 'Please correct Shipping Price "BBB" in the Row #120.', + 'The "BBB" shipping price in row number "120" is incorrect. Verify the shipping price and try again.', ], ]; } diff --git a/app/code/Magento/OfflineShipping/Test/Unit/Model/ResourceModel/Carrier/Tablerate/ImportTest.php b/app/code/Magento/OfflineShipping/Test/Unit/Model/ResourceModel/Carrier/Tablerate/ImportTest.php index 14fa8129532fa..4e433c380f753 100644 --- a/app/code/Magento/OfflineShipping/Test/Unit/Model/ResourceModel/Carrier/Tablerate/ImportTest.php +++ b/app/code/Magento/OfflineShipping/Test/Unit/Model/ResourceModel/Carrier/Tablerate/ImportTest.php @@ -193,7 +193,7 @@ public function testGetDataWithDuplicatedLine() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Please correct Table Rates File Format. + * @expectedExceptionMessage The Table Rates File Format is incorrect. Verify the format and try again. * @SuppressWarnings(PHPMD.UnusedLocalVariable) */ public function testGetDataFromEmptyFile() diff --git a/app/code/Magento/Payment/Gateway/Command/CommandManagerPool.php b/app/code/Magento/Payment/Gateway/Command/CommandManagerPool.php index b1de33b6dad7b..6561fd42dc3c5 100644 --- a/app/code/Magento/Payment/Gateway/Command/CommandManagerPool.php +++ b/app/code/Magento/Payment/Gateway/Command/CommandManagerPool.php @@ -50,7 +50,7 @@ public function get($paymentProviderCode) { if (!isset($this->executors[$paymentProviderCode])) { throw new NotFoundException( - __('Command Executor for %1 is not defined.', $paymentProviderCode) + __('The "%1" command executor isn\'t defined. Verify the executor and try again.', $paymentProviderCode) ); } diff --git a/app/code/Magento/Payment/Gateway/Command/CommandPool.php b/app/code/Magento/Payment/Gateway/Command/CommandPool.php index f866914463d4d..9c90147b2850d 100644 --- a/app/code/Magento/Payment/Gateway/Command/CommandPool.php +++ b/app/code/Magento/Payment/Gateway/Command/CommandPool.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Payment\Gateway\Command; use Magento\Framework\ObjectManager\TMap; @@ -48,7 +49,9 @@ public function __construct( public function get($commandCode) { if (!isset($this->commands[$commandCode])) { - throw new NotFoundException(__('Command %1 does not exist.', $commandCode)); + throw new NotFoundException( + __('The "%1" command doesn\'t exist. Verify the command and try again.', $commandCode) + ); } return $this->commands[$commandCode]; diff --git a/app/code/Magento/Payment/Gateway/Http/Converter/HtmlFormConverter.php b/app/code/Magento/Payment/Gateway/Http/Converter/HtmlFormConverter.php index 82b6e8de8b068..e10d3e6693751 100644 --- a/app/code/Magento/Payment/Gateway/Http/Converter/HtmlFormConverter.php +++ b/app/code/Magento/Payment/Gateway/Http/Converter/HtmlFormConverter.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Payment\Gateway\Http\Converter; use Magento\Payment\Gateway\Http\ConverterException; @@ -29,7 +30,9 @@ public function convert($response) libxml_use_internal_errors(true); if (!$document->loadHTML($response)) { - throw new ConverterException(__('Wrong gateway response format.')); + throw new ConverterException( + __('The gateway response format was incorrect. Verify the format and try again.') + ); } libxml_use_internal_errors(false); diff --git a/app/code/Magento/Payment/Gateway/Validator/ValidatorPool.php b/app/code/Magento/Payment/Gateway/Validator/ValidatorPool.php index 91503734277f3..3a6c65a7145a1 100644 --- a/app/code/Magento/Payment/Gateway/Validator/ValidatorPool.php +++ b/app/code/Magento/Payment/Gateway/Validator/ValidatorPool.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Payment\Gateway\Validator; use Magento\Framework\Exception\NotFoundException; @@ -48,7 +49,7 @@ public function __construct( public function get($code) { if (!isset($this->validators[$code])) { - throw new NotFoundException(__('Validator for field %1 does not exist.', $code)); + throw new NotFoundException(__('The validator for the "%1" field doesn\'t exist.', $code)); } return $this->validators[$code]; diff --git a/app/code/Magento/Payment/Model/Method/Adapter.php b/app/code/Magento/Payment/Model/Method/Adapter.php index 85c1584eb44f8..6c7ef372a8854 100644 --- a/app/code/Magento/Payment/Model/Method/Adapter.php +++ b/app/code/Magento/Payment/Model/Method/Adapter.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Payment\Model\Method; use Magento\Framework\App\ObjectManager; @@ -538,7 +539,7 @@ private function executeCommand($commandCode, array $arguments = []) } if ($this->commandPool === null) { - throw new \DomainException('Command pool is not configured for use.'); + throw new \DomainException("The command pool isn't configured for use."); } $command = $this->commandPool->get($commandCode); diff --git a/app/code/Magento/Payment/view/frontend/templates/transparent/iframe.phtml b/app/code/Magento/Payment/view/frontend/templates/transparent/iframe.phtml index cb28c0ed69bbb..bbd06cd7c48f3 100644 --- a/app/code/Magento/Payment/view/frontend/templates/transparent/iframe.phtml +++ b/app/code/Magento/Payment/view/frontend/templates/transparent/iframe.phtml @@ -40,7 +40,9 @@ $params = $block->getParams(); $(parent).trigger('clearTimeout'); fullScreenLoader.stopLoader(); globalMessageList.addErrorMessage({ - message: $t('An error occurred on the server. Please try to place the order again.') + message: $t( + 'A server error stopped your order from being placed. Please try to place your order again.' + ) }); } ); diff --git a/app/code/Magento/Paypal/Controller/Express/AbstractExpress/PlaceOrder.php b/app/code/Magento/Paypal/Controller/Express/AbstractExpress/PlaceOrder.php index 1222679593f36..eb4c35b02696c 100644 --- a/app/code/Magento/Paypal/Controller/Express/AbstractExpress/PlaceOrder.php +++ b/app/code/Magento/Paypal/Controller/Express/AbstractExpress/PlaceOrder.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Paypal\Controller\Express\AbstractExpress; use Magento\Paypal\Model\Api\ProcessableException as ApiProcessableException; @@ -66,7 +67,10 @@ public function execute() !$this->agreementsValidator->isValid(array_keys($this->getRequest()->getPost('agreement', []))) ) { $e = new \Magento\Framework\Exception\LocalizedException( - __('Please agree to all the terms and conditions before placing the order.') + __( + "The order wasn't placed. " + . "First, agree to the terms and conditions, then try placing your order again." + ) ); $this->messageManager->addExceptionMessage( $e, @@ -205,6 +209,6 @@ private function redirectToOrderReviewPageAndShowError($errorMessage) protected function isValidationRequired() { return is_array($this->getRequest()->getBeforeForwardInfo()) - && empty($this->getRequest()->getBeforeForwardInfo()); + && empty($this->getRequest()->getBeforeForwardInfo()); } } diff --git a/app/code/Magento/Paypal/Gateway/Payflowpro/Command/AuthorizationCommand.php b/app/code/Magento/Paypal/Gateway/Payflowpro/Command/AuthorizationCommand.php index 2ce757cfa65d9..1dbafaf5ff0c2 100644 --- a/app/code/Magento/Paypal/Gateway/Payflowpro/Command/AuthorizationCommand.php +++ b/app/code/Magento/Paypal/Gateway/Payflowpro/Command/AuthorizationCommand.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Paypal\Gateway\Payflowpro\Command; use Magento\Framework\Exception\LocalizedException; @@ -73,7 +74,7 @@ public function execute(array $commandSubject) } catch (LocalizedException $exception) { $payment->setParentTransactionId($response->getData(Transparent::PNREF)); $this->payflowFacade->void($payment); - throw new LocalizedException(__('Error processing payment, please try again later.')); + throw new LocalizedException(__("The payment couldn't be processed at this time. Please try again later.")); } $this->payflowFacade->setTransStatus($payment, $response); diff --git a/app/code/Magento/Paypal/Model/Ipn.php b/app/code/Magento/Paypal/Model/Ipn.php index 0b12a9f26c8a2..a370bbc77ffb2 100644 --- a/app/code/Magento/Paypal/Model/Ipn.php +++ b/app/code/Magento/Paypal/Model/Ipn.php @@ -106,7 +106,7 @@ protected function _getConfig() $parameters = ['params' => [$methodCode, $order->getStoreId()]]; $this->_config = $this->_configFactory->create($parameters); if (!$this->_config->isMethodActive($methodCode) || !$this->_config->isMethodAvailable()) { - throw new Exception(sprintf('Method "%s" is not available.', $methodCode)); + throw new Exception(sprintf('The "%s" method isn\'t available.', $methodCode)); } /** @link https://cms.paypal.com/cgi-bin/marketingweb?cmd=_render-content&content_ID= * developer/e_howto_admin_IPNIntro */ @@ -118,7 +118,11 @@ protected function _getConfig() $receiver = $this->getRequestData('business') ?: $this->getRequestData('receiver_email'); if (strtolower($merchantEmail) != strtolower($receiver)) { throw new Exception( - sprintf('The requested %s and configured %s merchant emails do not match.', $receiver, $merchantEmail) + sprintf( + 'The requested "%s" and the configured "%s" merchant emails don\'t match.', + $receiver, + $merchantEmail + ) ); } @@ -136,7 +140,7 @@ protected function _getOrder() $incrementId = $this->getRequestData('invoice'); $this->_order = $this->_orderFactory->create()->loadByIncrementId($incrementId); if (!$this->_order->getId()) { - throw new Exception(sprintf('Wrong order ID: "%s".', $incrementId)); + throw new Exception(sprintf('The "%s" order ID is incorrect. Verify the ID and try again.', $incrementId)); } return $this->_order; } @@ -266,7 +270,7 @@ protected function _registerTransaction() $this->_registerPaymentVoid(); break; default: - throw new Exception("Cannot handle payment status '{$paymentStatus}'."); + throw new Exception("The '{$paymentStatus}' payment status couldn't be handled."); } } @@ -370,7 +374,7 @@ public function _registerPaymentPending() return; } if ('order' === $reason) { - throw new Exception('The "order" authorizations are not implemented.'); + throw new Exception('The "order" authorizations aren\'t implemented.'); } // case when was placed using PayPal standard if (\Magento\Sales\Model\Order::STATE_PENDING_PAYMENT == $this->_order->getState() diff --git a/app/code/Magento/Paypal/Model/Payflow/Transparent.php b/app/code/Magento/Paypal/Model/Payflow/Transparent.php index c161580c1b7f1..c308731c69527 100644 --- a/app/code/Magento/Paypal/Model/Payflow/Transparent.php +++ b/app/code/Magento/Paypal/Model/Payflow/Transparent.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Paypal\Model\Payflow; use Magento\Payment\Helper\Formatter; @@ -177,7 +178,7 @@ public function authorize(InfoInterface $payment, $amount) } catch (LocalizedException $exception) { $payment->setParentTransactionId($response->getData(self::PNREF)); $this->void($payment); - throw new LocalizedException(__('Error processing payment. Please try again later.')); + throw new LocalizedException(__("The payment couldn't be processed at this time. Please try again later.")); } $this->setTransStatus($payment, $response); diff --git a/app/code/Magento/Paypal/Model/Payflowpro.php b/app/code/Magento/Paypal/Model/Payflowpro.php index 0e8d6db5e9a28..125aa0f6e65a7 100644 --- a/app/code/Magento/Paypal/Model/Payflowpro.php +++ b/app/code/Magento/Paypal/Model/Payflowpro.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Paypal\Model; use Magento\Framework\DataObject; @@ -653,7 +654,7 @@ public function processErrors(DataObject $response) { if ($response->getResultCode() == self::RESPONSE_CODE_VOID_ERROR) { throw new \Magento\Framework\Exception\State\InvalidTransitionException( - __('You cannot void a verification transaction.') + __("The verification transaction can't be voided. ") ); } elseif ($response->getResultCode() != self::RESPONSE_CODE_APPROVED && $response->getResultCode() != self::RESPONSE_CODE_FRAUDSERVICE_FILTER diff --git a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/TransparentTest.php b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/TransparentTest.php index 9b67cedb47885..e6a994cba78c3 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/Payflow/TransparentTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/Payflow/TransparentTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Paypal\Test\Unit\Model\Payflow; use Magento\Paypal\Block\Payment\Info; @@ -277,7 +278,7 @@ public function testAuthorizeException() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Error processing payment. Please try again later. + * @expectedExceptionMessage The payment couldn't be processed at this time. Please try again later. */ public function testAuthorizeValidationException() { diff --git a/app/code/Magento/ProductAlert/Controller/Add/Price.php b/app/code/Magento/ProductAlert/Controller/Add/Price.php index 6effaacd9624d..04e623105e645 100644 --- a/app/code/Magento/ProductAlert/Controller/Add/Price.php +++ b/app/code/Magento/ProductAlert/Controller/Add/Price.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\ProductAlert\Controller\Add; use Magento\ProductAlert\Controller\Add as AddController; @@ -98,7 +99,10 @@ public function execute() } return $resultRedirect; } catch (\Exception $e) { - $this->messageManager->addException($e, __('We can\'t update the alert subscription right now.')); + $this->messageManager->addException( + $e, + __("The alert subscription couldn't update at this time. Please try again later.") + ); } $resultRedirect->setUrl($this->_redirect->getRedirectUrl()); return $resultRedirect; diff --git a/app/code/Magento/ProductAlert/Controller/Add/Stock.php b/app/code/Magento/ProductAlert/Controller/Add/Stock.php index 5b89b4b327ee0..56d052f7e11e2 100644 --- a/app/code/Magento/ProductAlert/Controller/Add/Stock.php +++ b/app/code/Magento/ProductAlert/Controller/Add/Stock.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\ProductAlert\Controller\Add; use Magento\ProductAlert\Controller\Add as AddController; @@ -67,7 +68,10 @@ public function execute() $resultRedirect->setUrl($backUrl); return $resultRedirect; } catch (\Exception $e) { - $this->messageManager->addException($e, __('We can\'t update the alert subscription right now.')); + $this->messageManager->addException( + $e, + __("The alert subscription couldn't update at this time. Please try again later.") + ); } $resultRedirect->setUrl($this->_redirect->getRedirectUrl()); return $resultRedirect; diff --git a/app/code/Magento/ProductAlert/Controller/Unsubscribe/Price.php b/app/code/Magento/ProductAlert/Controller/Unsubscribe/Price.php index 9adf15a2e1347..2077b1ff2794b 100644 --- a/app/code/Magento/ProductAlert/Controller/Unsubscribe/Price.php +++ b/app/code/Magento/ProductAlert/Controller/Unsubscribe/Price.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\ProductAlert\Controller\Unsubscribe; use Magento\ProductAlert\Controller\Unsubscribe as UnsubscribeController; @@ -68,11 +69,14 @@ public function execute() $this->messageManager->addSuccess(__('You deleted the alert subscription.')); } catch (NoSuchEntityException $noEntityException) { - $this->messageManager->addError(__('We can\'t find the product.')); + $this->messageManager->addError(__("The product wasn't found. Verify the product and try again.")); $resultRedirect->setPath('customer/account/'); return $resultRedirect; } catch (\Exception $e) { - $this->messageManager->addException($e, __('We can\'t update the alert subscription right now.')); + $this->messageManager->addException( + $e, + __("The alert subscription couldn't update at this time. Please try again later.") + ); } $resultRedirect->setUrl($product->getProductUrl()); return $resultRedirect; diff --git a/app/code/Magento/ProductAlert/Controller/Unsubscribe/Stock.php b/app/code/Magento/ProductAlert/Controller/Unsubscribe/Stock.php index 84ebbaecaaf69..7a6aeb40eb5b7 100644 --- a/app/code/Magento/ProductAlert/Controller/Unsubscribe/Stock.php +++ b/app/code/Magento/ProductAlert/Controller/Unsubscribe/Stock.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\ProductAlert\Controller\Unsubscribe; use Magento\ProductAlert\Controller\Unsubscribe as UnsubscribeController; @@ -70,7 +71,10 @@ public function execute() $resultRedirect->setPath('customer/account/'); return $resultRedirect; } catch (\Exception $e) { - $this->messageManager->addException($e, __('We can\'t update the alert subscription right now.')); + $this->messageManager->addException( + $e, + __("The alert subscription couldn't update at this time. Please try again later.") + ); } $resultRedirect->setUrl($product->getProductUrl()); return $resultRedirect; diff --git a/app/code/Magento/ProductVideo/Controller/Adminhtml/Product/Gallery/RetrieveImage.php b/app/code/Magento/ProductVideo/Controller/Adminhtml/Product/Gallery/RetrieveImage.php index 9950526182e3e..23721cb4b1658 100644 --- a/app/code/Magento/ProductVideo/Controller/Adminhtml/Product/Gallery/RetrieveImage.php +++ b/app/code/Magento/ProductVideo/Controller/Adminhtml/Product/Gallery/RetrieveImage.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\ProductVideo\Controller\Adminhtml\Product\Gallery; use Magento\Framework\App\Filesystem\DirectoryList; @@ -199,7 +200,7 @@ protected function retrieveRemoteImage($fileUrl, $localFilePath) $image = $this->curl->read(); if (empty($image)) { throw new LocalizedException( - __('Could not get preview image information. Please check your connection and try again.') + __('The preview image information is unavailable. Check your connection and try again.') ); } $this->fileUtility->saveFile($localFilePath, $image); diff --git a/app/code/Magento/Quote/Api/GuestShippingMethodManagementInterface.php b/app/code/Magento/Quote/Api/GuestShippingMethodManagementInterface.php index 143b9638835e5..29baac025282c 100644 --- a/app/code/Magento/Quote/Api/GuestShippingMethodManagementInterface.php +++ b/app/code/Magento/Quote/Api/GuestShippingMethodManagementInterface.php @@ -18,7 +18,7 @@ interface GuestShippingMethodManagementInterface * @param string $cartId The shopping cart ID. * @return \Magento\Quote\Api\Data\ShippingMethodInterface[] An array of shipping methods. * @throws \Magento\Framework\Exception\NoSuchEntityException The specified quote does not exist. - * @throws \Magento\Framework\Exception\StateException The shipping address is not set. + * @throws \Magento\Framework\Exception\StateException The shipping address is missing. */ public function getList($cartId); diff --git a/app/code/Magento/Quote/Api/ShippingMethodManagementInterface.php b/app/code/Magento/Quote/Api/ShippingMethodManagementInterface.php index 21905ecabf57f..c6d51857a8d54 100644 --- a/app/code/Magento/Quote/Api/ShippingMethodManagementInterface.php +++ b/app/code/Magento/Quote/Api/ShippingMethodManagementInterface.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Quote\Api; /** @@ -37,7 +38,7 @@ public function estimateByAddressId($cartId, $addressId); * @param int $cartId The shopping cart ID. * @return \Magento\Quote\Api\Data\ShippingMethodInterface[] An array of shipping methods. * @throws \Magento\Framework\Exception\NoSuchEntityException The specified quote does not exist. - * @throws \Magento\Framework\Exception\StateException The shipping address is not set. + * @throws \Magento\Framework\Exception\StateException The shipping address is missing. */ public function getList($cartId); } diff --git a/app/code/Magento/Quote/Model/BillingAddressManagement.php b/app/code/Magento/Quote/Model/BillingAddressManagement.php index 2cbca917c26a1..70a8c94fefad0 100644 --- a/app/code/Magento/Quote/Model/BillingAddressManagement.php +++ b/app/code/Magento/Quote/Model/BillingAddressManagement.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Quote\Model; use Magento\Framework\Exception\InputException; @@ -84,7 +85,7 @@ public function assign($cartId, \Magento\Quote\Api\Data\AddressInterface $addres $this->quoteRepository->save($quote); } catch (\Exception $e) { $this->logger->critical($e); - throw new InputException(__('Unable to save address. Please check input data.')); + throw new InputException(__('The address failed to save. Verify the address and try again.')); } return $quote->getBillingAddress()->getId(); } diff --git a/app/code/Magento/Quote/Model/CouponManagement.php b/app/code/Magento/Quote/Model/CouponManagement.php index 7701e41e0b55a..62515a17f268b 100644 --- a/app/code/Magento/Quote/Model/CouponManagement.php +++ b/app/code/Magento/Quote/Model/CouponManagement.php @@ -53,7 +53,7 @@ public function set($cartId, $couponCode) /** @var \Magento\Quote\Model\Quote $quote */ $quote = $this->quoteRepository->getActive($cartId); if (!$quote->getItemsCount()) { - throw new NoSuchEntityException(__('Cart %1 doesn\'t contain products', $cartId)); + throw new NoSuchEntityException(__('The "%1" Cart doesn\'t contain products.', $cartId)); } $quote->getShippingAddress()->setCollectShippingRates(true); @@ -61,10 +61,12 @@ public function set($cartId, $couponCode) $quote->setCouponCode($couponCode); $this->quoteRepository->save($quote->collectTotals()); } catch (\Exception $e) { - throw new CouldNotSaveException(__('Could not apply coupon code')); + throw new CouldNotSaveException( + __("The coupon code couldn't be applied. Verify the coupon code and try again.") + ); } if ($quote->getCouponCode() != $couponCode) { - throw new NoSuchEntityException(__('Coupon code is not valid')); + throw new NoSuchEntityException(__("The coupon code isn't valid. Verify the code and try again.")); } return true; } @@ -77,17 +79,21 @@ public function remove($cartId) /** @var \Magento\Quote\Model\Quote $quote */ $quote = $this->quoteRepository->getActive($cartId); if (!$quote->getItemsCount()) { - throw new NoSuchEntityException(__('Cart %1 doesn\'t contain products', $cartId)); + throw new NoSuchEntityException(__('The "%1" Cart doesn\'t contain products.', $cartId)); } $quote->getShippingAddress()->setCollectShippingRates(true); try { $quote->setCouponCode(''); $this->quoteRepository->save($quote->collectTotals()); } catch (\Exception $e) { - throw new CouldNotDeleteException(__('Could not delete coupon code')); + throw new CouldNotDeleteException( + __("The coupon code couldn't be deleted. Verify the coupon code and try again.") + ); } if ($quote->getCouponCode() != '') { - throw new CouldNotDeleteException(__('Could not delete coupon code')); + throw new CouldNotDeleteException( + __("The coupon code couldn't be deleted. Verify the coupon code and try again.") + ); } return true; } diff --git a/app/code/Magento/Quote/Model/GuestCart/GuestShippingMethodManagementInterface.php b/app/code/Magento/Quote/Model/GuestCart/GuestShippingMethodManagementInterface.php index e8109a0ac0cee..1cc1a3c8fcbfd 100644 --- a/app/code/Magento/Quote/Model/GuestCart/GuestShippingMethodManagementInterface.php +++ b/app/code/Magento/Quote/Model/GuestCart/GuestShippingMethodManagementInterface.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Quote\Model\GuestCart; /** @@ -20,7 +21,7 @@ interface GuestShippingMethodManagementInterface * @return bool * @throws \Magento\Framework\Exception\InputException The shipping method is not valid for an empty cart. * @throws \Magento\Framework\Exception\CouldNotSaveException The shipping method could not be saved. - * @throws \Magento\Framework\Exception\StateException The billing or shipping address is not set. + * @throws \Magento\Framework\Exception\StateException The billing or shipping address is missing. * @throws \Magento\Framework\Exception\NoSuchEntityException The specified cart contains only virtual products * so the shipping method does not apply. */ @@ -32,7 +33,7 @@ public function set($cartId, $carrierCode, $methodCode); * @param string $cartId The shopping cart ID. * @return \Magento\Quote\Api\Data\ShippingMethodInterface Shipping method. * @throws \Magento\Framework\Exception\NoSuchEntityException The specified shopping cart does not exist. - * @throws \Magento\Framework\Exception\StateException The shipping address is not set. + * @throws \Magento\Framework\Exception\StateException The shipping address is missing. */ public function get($cartId); } diff --git a/app/code/Magento/Quote/Model/GuestCartManagement/Plugin/Authorization.php b/app/code/Magento/Quote/Model/GuestCartManagement/Plugin/Authorization.php index e8aeed63e74a2..5d83757321f7d 100644 --- a/app/code/Magento/Quote/Model/GuestCartManagement/Plugin/Authorization.php +++ b/app/code/Magento/Quote/Model/GuestCartManagement/Plugin/Authorization.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Quote\Model\GuestCartManagement\Plugin; use Magento\Framework\Exception\StateException; @@ -40,7 +41,7 @@ public function beforeAssignCustomer( ) { if ($customerId !== (int)$this->userContext->getUserId()) { throw new StateException( - __('Cannot assign customer to the given cart. You don\'t have permission for this operation.') + __("You don't have the correct permissions to assign the customer to the cart.") ); } } diff --git a/app/code/Magento/Quote/Model/PaymentMethodManagement.php b/app/code/Magento/Quote/Model/PaymentMethodManagement.php index f12b9e5d1fb7f..91d8fe4dbcffd 100644 --- a/app/code/Magento/Quote/Model/PaymentMethodManagement.php +++ b/app/code/Magento/Quote/Model/PaymentMethodManagement.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Quote\Model; use Magento\Framework\Exception\State\InvalidTransitionException; @@ -68,7 +69,9 @@ public function set($cartId, \Magento\Quote\Api\Data\PaymentInterface $method) } else { // check if shipping address is set if ($quote->getShippingAddress()->getCountryId() === null) { - throw new InvalidTransitionException(__('Shipping address is not set')); + throw new InvalidTransitionException( + __('The shipping address is missing. Set the address and try again.') + ); } $quote->getShippingAddress()->setPaymentMethod($payment->getMethod()); } diff --git a/app/code/Magento/Quote/Model/Quote/Item/CartItemPersister.php b/app/code/Magento/Quote/Model/Quote/Item/CartItemPersister.php index e29364d41b498..9b5f5c9a126df 100644 --- a/app/code/Magento/Quote/Model/Quote/Item/CartItemPersister.php +++ b/app/code/Magento/Quote/Model/Quote/Item/CartItemPersister.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Quote\Model\Quote\Item; use Magento\Quote\Api\Data\CartInterface; @@ -62,7 +63,7 @@ public function save(CartInterface $quote, CartItemInterface $item) $currentItem = $quote->getItemById($itemId); if (!$currentItem) { throw new NoSuchEntityException( - __('Cart %1 does not contain item %2', $cartId, $itemId) + __('The %1 Cart doesn\'t contain the %2 item.', $cartId, $itemId) ); } $productType = $currentItem->getProduct()->getTypeId(); @@ -99,7 +100,7 @@ public function save(CartInterface $quote, CartItemInterface $item) } catch (LocalizedException $e) { throw $e; } catch (\Exception $e) { - throw new CouldNotSaveException(__('Could not save quote')); + throw new CouldNotSaveException(__("The quote couldn't be saved.")); } $itemId = $item->getId(); foreach ($quote->getAllItems() as $quoteItem) { @@ -109,6 +110,6 @@ public function save(CartInterface $quote, CartItemInterface $item) return $this->cartItemOptionProcessor->applyCustomOptions($item); } } - throw new CouldNotSaveException(__('Could not save quote')); + throw new CouldNotSaveException(__("The quote couldn't be saved.")); } } diff --git a/app/code/Magento/Quote/Model/Quote/Item/Repository.php b/app/code/Magento/Quote/Model/Quote/Item/Repository.php index d8238628e0eaa..1fb0a2d7107f1 100644 --- a/app/code/Magento/Quote/Model/Quote/Item/Repository.php +++ b/app/code/Magento/Quote/Model/Quote/Item/Repository.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Quote\Model\Quote\Item; use Magento\Framework\App\ObjectManager; @@ -103,14 +104,14 @@ public function deleteById($cartId, $itemId) $quoteItem = $quote->getItemById($itemId); if (!$quoteItem) { throw new NoSuchEntityException( - __('Cart %1 doesn\'t contain item %2', $cartId, $itemId) + __('The %1 Cart doesn\'t contain the %2 item.', $cartId, $itemId) ); } try { $quote->removeItem($itemId); $this->quoteRepository->save($quote); } catch (\Exception $e) { - throw new CouldNotSaveException(__('Could not remove item from quote')); + throw new CouldNotSaveException(__("The item couldn't be removed from the quote.")); } return true; diff --git a/app/code/Magento/Quote/Model/QuoteManagement.php b/app/code/Magento/Quote/Model/QuoteManagement.php index b2cd613ba46a1..d062c0b4d05c1 100644 --- a/app/code/Magento/Quote/Model/QuoteManagement.php +++ b/app/code/Magento/Quote/Model/QuoteManagement.php @@ -235,7 +235,7 @@ public function createEmptyCart() $quote->getShippingAddress()->setCollectShippingRates(true); $this->quoteRepository->save($quote); } catch (\Exception $e) { - throw new CouldNotSaveException(__('Cannot create quote')); + throw new CouldNotSaveException(__("The quote can't be created.")); } return $quote->getId(); } @@ -251,7 +251,7 @@ public function createEmptyCartForCustomer($customerId) try { $this->quoteRepository->save($quote); } catch (\Exception $e) { - throw new CouldNotSaveException(__('Cannot create quote')); + throw new CouldNotSaveException(__("The quote can't be created.")); } return $quote->getId(); } @@ -267,18 +267,18 @@ public function assignCustomer($cartId, $customerId, $storeId) if (!in_array($storeId, $customerModel->load($customerId)->getSharedStoreIds())) { throw new StateException( - __('Cannot assign customer to the given cart. The cart belongs to different store.') + __("The customer can't be assigned to the cart. The cart belongs to a different store.") ); } if ($quote->getCustomerId()) { throw new StateException( - __('Cannot assign customer to the given cart. The cart is not anonymous.') + __("The customer can't be assigned to the cart because the cart isn't anonymous.") ); } try { $this->quoteRepository->getForCustomer($customerId); throw new StateException( - __('Cannot assign customer to the given cart. Customer already has active cart.') + __("The customer can't be assigned to the cart because the customer already has an active cart.") ); } catch (\Magento\Framework\Exception\NoSuchEntityException $e) { } @@ -364,7 +364,7 @@ public function placeOrder($cartId, PaymentInterface $paymentMethod = null) if (null == $order) { throw new LocalizedException( - __('An error occurred on the server. Please try to place the order again.') + __('A server error stopped your order from being placed. Please try to place your order again.') ); } diff --git a/app/code/Magento/Quote/Model/QuoteValidator.php b/app/code/Magento/Quote/Model/QuoteValidator.php index 8d46832df8db2..1f6deca4c1d74 100644 --- a/app/code/Magento/Quote/Model/QuoteValidator.php +++ b/app/code/Magento/Quote/Model/QuoteValidator.php @@ -90,14 +90,16 @@ public function validateBeforeSubmit(QuoteEntity $quote) $this->allowedCountryReader->getAllowedCountries() )) { throw new \Magento\Framework\Exception\LocalizedException( - __('Some addresses cannot be used due to country-specific configurations.') + __("Some addresses can't be used due to the configurations for specific countries.") ); } $method = $quote->getShippingAddress()->getShippingMethod(); $rate = $quote->getShippingAddress()->getShippingRateByCode($method); if (!$method || !$rate) { - throw new \Magento\Framework\Exception\LocalizedException(__('Please specify a shipping method.')); + throw new \Magento\Framework\Exception\LocalizedException( + __('The shipping method is missing. Select the shipping method and try again.') + ); } } if ($quote->getBillingAddress()->validate() !== true) { @@ -109,7 +111,9 @@ public function validateBeforeSubmit(QuoteEntity $quote) ); } if (!$quote->getPayment()->getMethod()) { - throw new \Magento\Framework\Exception\LocalizedException(__('Please select a valid payment method.')); + throw new \Magento\Framework\Exception\LocalizedException( + __('Enter a valid payment method and try again. ') + ); } if (!$quote->validateMinimumAmount($quote->getIsMultiShipping())) { throw new LocalizedException($this->minimumAmountMessage->getMessage()); diff --git a/app/code/Magento/Quote/Model/ShippingAddressManagement.php b/app/code/Magento/Quote/Model/ShippingAddressManagement.php index 0e2be5c9e3692..d8e70c68ba33f 100644 --- a/app/code/Magento/Quote/Model/ShippingAddressManagement.php +++ b/app/code/Magento/Quote/Model/ShippingAddressManagement.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Quote\Model; use Magento\Framework\App\ObjectManager; @@ -87,7 +88,7 @@ public function assign($cartId, \Magento\Quote\Api\Data\AddressInterface $addres $quote = $this->quoteRepository->getActive($cartId); if ($quote->isVirtual()) { throw new NoSuchEntityException( - __('Cart contains virtual product(s) only. Shipping address is not applicable.') + __('The Cart includes virtual product(s) only, so a shipping address is not used.') ); } @@ -116,7 +117,7 @@ public function assign($cartId, \Magento\Quote\Api\Data\AddressInterface $addres $address->save(); } catch (\Exception $e) { $this->logger->critical($e); - throw new InputException(__('Unable to save address. Please check input data.')); + throw new InputException(__('The address failed to save. Verify the address and try again.')); } return $quote->getShippingAddress()->getId(); } @@ -130,7 +131,7 @@ public function get($cartId) $quote = $this->quoteRepository->getActive($cartId); if ($quote->isVirtual()) { throw new NoSuchEntityException( - __('Cart contains virtual product(s) only. Shipping address is not applicable.') + __('The Cart includes virtual product(s) only, so a shipping address is not used.') ); } /** @var \Magento\Quote\Model\Quote\Address $address */ diff --git a/app/code/Magento/Quote/Model/ShippingMethodManagement.php b/app/code/Magento/Quote/Model/ShippingMethodManagement.php index 5d7160d8c384a..ade2649d0b1b0 100644 --- a/app/code/Magento/Quote/Model/ShippingMethodManagement.php +++ b/app/code/Magento/Quote/Model/ShippingMethodManagement.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Quote\Model; use Magento\Customer\Api\Data\AddressInterfaceFactory; @@ -97,7 +98,7 @@ public function get($cartId) /** @var \Magento\Quote\Model\Quote\Address $shippingAddress */ $shippingAddress = $quote->getShippingAddress(); if (!$shippingAddress->getCountryId()) { - throw new StateException(__('Shipping address not set.')); + throw new StateException(__('The shipping address is missing. Set the address and try again.')); } $shippingMethod = $shippingAddress->getShippingMethod(); @@ -131,7 +132,7 @@ public function getList($cartId) $shippingAddress = $quote->getShippingAddress(); if (!$shippingAddress->getCountryId()) { - throw new StateException(__('Shipping address not set.')); + throw new StateException(__('The shipping address is missing. Set the address and try again.')); } $shippingAddress->collectShippingRates(); $shippingRates = $shippingAddress->getGroupedAllShippingRates(); @@ -159,7 +160,7 @@ public function set($cartId, $carrierCode, $methodCode) try { $this->quoteRepository->save($quote->collectTotals()); } catch (\Exception $e) { - throw new CouldNotSaveException(__('Cannot set shipping method. %1', $e->getMessage())); + throw new CouldNotSaveException(__('The shipping method can\'t be set. %1', $e->getMessage())); } return true; } @@ -171,24 +172,26 @@ public function set($cartId, $carrierCode, $methodCode) * @return void * @throws InputException The shipping method is not valid for an empty cart. * @throws CouldNotSaveException The shipping method could not be saved. - * @throws NoSuchEntityException Cart contains only virtual products. Shipping method is not applicable. - * @throws StateException The billing or shipping address is not set. + * @throws NoSuchEntityException CThe Cart includes virtual product(s) only, so a shipping address is not used. + * @throws StateException The billing or shipping address is missing. Set the address and try again. */ public function apply($cartId, $carrierCode, $methodCode) { /** @var \Magento\Quote\Model\Quote $quote */ $quote = $this->quoteRepository->getActive($cartId); if (0 == $quote->getItemsCount()) { - throw new InputException(__('Shipping method is not applicable for empty cart')); + throw new InputException( + __('The shipping method can\'t be set for an empty cart. Add an item to cart and try again.') + ); } if ($quote->isVirtual()) { throw new NoSuchEntityException( - __('Cart contains virtual product(s) only. Shipping method is not applicable.') + __('The Cart includes virtual product(s) only, so a shipping address is not used.') ); } $shippingAddress = $quote->getShippingAddress(); if (!$shippingAddress->getCountryId()) { - throw new StateException(__('Shipping address is not set')); + throw new StateException(__('The shipping address is missing. Set the address and try again.')); } $shippingAddress->setShippingMethod($carrierCode . '_' . $methodCode); } diff --git a/app/code/Magento/Quote/Model/ShippingMethodManagementInterface.php b/app/code/Magento/Quote/Model/ShippingMethodManagementInterface.php index eef2dc3abf09f..64dc7be46d2a1 100644 --- a/app/code/Magento/Quote/Model/ShippingMethodManagementInterface.php +++ b/app/code/Magento/Quote/Model/ShippingMethodManagementInterface.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Quote\Model; /** @@ -20,7 +21,7 @@ interface ShippingMethodManagementInterface * @return bool * @throws \Magento\Framework\Exception\InputException The shipping method is not valid for an empty cart. * @throws \Magento\Framework\Exception\CouldNotSaveException The shipping method could not be saved. - * @throws \Magento\Framework\Exception\StateException The billing or shipping address is not set. + * @throws \Magento\Framework\Exception\StateException The billing or shipping address is missing. * @throws \Magento\Framework\Exception\NoSuchEntityException The specified cart contains only virtual products * so the shipping method does not apply. */ @@ -32,7 +33,7 @@ public function set($cartId, $carrierCode, $methodCode); * @param int $cartId The shopping cart ID. * @return \Magento\Quote\Api\Data\ShippingMethodInterface Shipping method. * @throws \Magento\Framework\Exception\NoSuchEntityException The specified shopping cart does not exist. - * @throws \Magento\Framework\Exception\StateException The shipping address is not set. + * @throws \Magento\Framework\Exception\StateException The shipping address is missing. */ public function get($cartId); } diff --git a/app/code/Magento/Quote/Test/Unit/Model/BillingAddressManagementTest.php b/app/code/Magento/Quote/Test/Unit/Model/BillingAddressManagementTest.php index 14bc1dcc8efba..4182dbe72dac4 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/BillingAddressManagementTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/BillingAddressManagementTest.php @@ -128,7 +128,7 @@ public function testSetAddress() /** * @return void * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Unable to save address. Please check input data. + * @expectedExceptionMessage The address failed to save. Verify the address and try again. */ public function testSetAddressWithInabilityToSaveQuote() { diff --git a/app/code/Magento/Quote/Test/Unit/Model/CouponManagementTest.php b/app/code/Magento/Quote/Test/Unit/Model/CouponManagementTest.php index ed32017e7e440..e6ba50e35b4c3 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/CouponManagementTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/CouponManagementTest.php @@ -76,7 +76,7 @@ public function testGetCoupon() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Cart 33 doesn't contain products + * @expectedExceptionMessage The "33" Cart doesn't contain products. */ public function testSetWhenCartDoesNotContainsProducts() { @@ -91,7 +91,7 @@ public function testSetWhenCartDoesNotContainsProducts() /** * @expectedException \Magento\Framework\Exception\CouldNotSaveException - * @expectedExceptionMessage Could not apply coupon code + * @expectedExceptionMessage The coupon code couldn't be applied. Verify the coupon code and try again. */ public function testSetWhenCouldNotApplyCoupon() { @@ -105,7 +105,7 @@ public function testSetWhenCouldNotApplyCoupon() ->method('getShippingAddress')->will($this->returnValue($this->quoteAddressMock)); $this->quoteAddressMock->expects($this->once())->method('setCollectShippingRates')->with(true); $this->quoteMock->expects($this->once())->method('setCouponCode')->with($couponCode); - $exceptionMessage = 'Could not apply coupon code'; + $exceptionMessage = "The coupon code couldn't be applied. Verify the coupon code and try again."; $exception = new \Magento\Framework\Exception\CouldNotDeleteException(__($exceptionMessage)); $this->quoteMock->expects($this->once())->method('collectTotals')->will($this->returnValue($this->quoteMock)); $this->quoteRepositoryMock->expects($this->once()) @@ -118,7 +118,7 @@ public function testSetWhenCouldNotApplyCoupon() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Coupon code is not valid + * @expectedExceptionMessage The coupon code isn't valid. Verify the code and try again. */ public function testSetWhenCouponCodeIsInvalid() { @@ -160,7 +160,7 @@ public function testSet() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Cart 65 doesn't contain products + * @expectedExceptionMessage The "65" Cart doesn't contain products. */ public function testDeleteWhenCartDoesNotContainsProducts() { @@ -176,7 +176,7 @@ public function testDeleteWhenCartDoesNotContainsProducts() /** * @expectedException \Magento\Framework\Exception\CouldNotDeleteException - * @expectedExceptionMessage Could not delete coupon code + * @expectedExceptionMessage The coupon code couldn't be deleted. Verify the coupon code and try again. */ public function testDeleteWhenCouldNotDeleteCoupon() { @@ -190,7 +190,7 @@ public function testDeleteWhenCouldNotDeleteCoupon() $this->quoteAddressMock->expects($this->once())->method('setCollectShippingRates')->with(true); $this->quoteMock->expects($this->once())->method('setCouponCode')->with(''); $this->quoteMock->expects($this->once())->method('collectTotals')->will($this->returnValue($this->quoteMock)); - $exceptionMessage = 'Could not delete coupon code'; + $exceptionMessage = "The coupon code couldn't be deleted. Verify the coupon code and try again."; $exception = new \Magento\Framework\Exception\CouldNotSaveException(__($exceptionMessage)); $this->quoteMock->expects($this->once())->method('collectTotals')->will($this->returnValue($this->quoteMock)); $this->quoteRepositoryMock->expects($this->once()) @@ -203,7 +203,7 @@ public function testDeleteWhenCouldNotDeleteCoupon() /** * @expectedException \Magento\Framework\Exception\CouldNotDeleteException - * @expectedExceptionMessage Could not delete coupon code + * @expectedExceptionMessage The coupon code couldn't be deleted. Verify the coupon code and try again. */ public function testDeleteWhenCouponIsNotEmpty() { diff --git a/app/code/Magento/Quote/Test/Unit/Model/GuestCartManagement/Plugin/AuthorizationTest.php b/app/code/Magento/Quote/Test/Unit/Model/GuestCartManagement/Plugin/AuthorizationTest.php index 9cde4bbc19184..22962aacc8dac 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/GuestCartManagement/Plugin/AuthorizationTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/GuestCartManagement/Plugin/AuthorizationTest.php @@ -36,7 +36,7 @@ protected function setUp() /** * @expectedException \Magento\Framework\Exception\StateException - * @expectedMessage Cannot assign customer to the given cart. You don't have permission for this operation. + * @expectedMessage You don't have the correct permissions to assign the customer to the cart. */ public function testBeforeAssignCustomer() { diff --git a/app/code/Magento/Quote/Test/Unit/Model/PaymentMethodManagementTest.php b/app/code/Magento/Quote/Test/Unit/Model/PaymentMethodManagementTest.php index 8143e0e417ead..68b077fcdb965 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/PaymentMethodManagementTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/PaymentMethodManagementTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Quote\Test\Unit\Model; class PaymentMethodManagementTest extends \PHPUnit\Framework\TestCase @@ -297,7 +298,7 @@ public function testSetSimpleProduct() /** * @expectedException \Magento\Framework\Exception\State\InvalidTransitionException - * @expectedExceptionMessage Shipping address is not set + * @expectedExceptionMessage The shipping address is missing. Set the address and try again. */ public function testSetSimpleProductTrowsExceptionIfShippingAddressNotSet() { diff --git a/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/RepositoryTest.php b/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/RepositoryTest.php index e329a15c5a7f4..4ecd8b021d7f0 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/RepositoryTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/RepositoryTest.php @@ -145,7 +145,7 @@ public function testSave() /** * @return void * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Cart 11 doesn't contain item 5 + * @expectedExceptionMessage The 11 Cart doesn't contain the 5 item. */ public function testDeleteWithInvalidQuoteItem() { @@ -163,7 +163,7 @@ public function testDeleteWithInvalidQuoteItem() /** * @return void * @expectedException \Magento\Framework\Exception\CouldNotSaveException - * @expectedExceptionMessage Could not remove item from quote + * @expectedExceptionMessage The item couldn't be removed from the quote. */ public function testDeleteWithCouldNotSaveException() { @@ -181,7 +181,7 @@ public function testDeleteWithCouldNotSaveException() ->method('removeItem') ->with($itemId) ->willReturn($this->quoteMock); - $exceptionMessage = 'Could not remove item from quote'; + $exceptionMessage = "The item couldn't be removed from the quote."; $exception = new \Magento\Framework\Exception\CouldNotSaveException(__($exceptionMessage)); $this->quoteRepositoryMock->expects($this->once()) ->method('save') diff --git a/app/code/Magento/Quote/Test/Unit/Model/QuoteManagementTest.php b/app/code/Magento/Quote/Test/Unit/Model/QuoteManagementTest.php index 2ca7613796b07..107445bb18d2a 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/QuoteManagementTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/QuoteManagementTest.php @@ -320,7 +320,7 @@ public function testCreateEmptyCartForCustomerReturnExistsQuote() /** * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Cannot assign customer to the given cart. The cart belongs to different store + * @expectedExceptionMessage The customer can't be assigned to the cart. The cart belongs to a different store. */ public function testAssignCustomerFromAnotherStore() { @@ -364,7 +364,7 @@ public function testAssignCustomerFromAnotherStore() /** * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Cannot assign customer to the given cart. The cart is not anonymous. + * @expectedExceptionMessage The customer can't be assigned to the cart because the cart isn't anonymous. */ public function testAssignCustomerToNonanonymousCart() { @@ -413,7 +413,6 @@ public function testAssignCustomerToNonanonymousCart() /** * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Cannot assign customer to the given cart. Customer already has active cart. */ public function testAssignCustomerNoSuchCustomer() { @@ -463,6 +462,10 @@ public function testAssignCustomerNoSuchCustomer() ->with($customerId); $this->model->assignCustomer($cartId, $customerId, $storeId); + + $this->expectExceptionMessage( + "The customer can't be assigned to the cart because the customer already has an active cart." + ); } public function testAssignCustomer() diff --git a/app/code/Magento/Quote/Test/Unit/Model/QuoteValidatorTest.php b/app/code/Magento/Quote/Test/Unit/Model/QuoteValidatorTest.php index bd53e44afe9db..6865134a04870 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/QuoteValidatorTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/QuoteValidatorTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Quote\Test\Unit\Model; use Magento\Directory\Model\AllowedCountries; @@ -142,7 +143,7 @@ public function testValidateBeforeSubmitThrowsExceptionIfShippingAddressIsInvali /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Please specify a shipping method. + * @expectedExceptionMessage The shipping method is missing. Select the shipping method and try again. */ public function testValidateBeforeSubmitThrowsExceptionIfShippingRateIsNotSelected() { @@ -181,7 +182,7 @@ public function testValidateBeforeSubmitThrowsExceptionIfBillingAddressIsNotVali /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Please select a valid payment method. + * @expectedExceptionMessage Enter a valid payment method and try again. */ public function testValidateBeforeSubmitThrowsExceptionIfPaymentMethodIsNotSelected() { @@ -225,7 +226,7 @@ public function testValidateBeforeSubmitThrowsExceptionIfMinimumOrderAmount() * Test case when country id not present in allowed countries list. * * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Some addresses cannot be used due to country-specific configurations. + * @expectedExceptionMessage Some addresses can't be used due to the configurations for specific countries. */ public function testValidateBeforeSubmitThrowsExceptionIfCountrySpecificConfigurations() { diff --git a/app/code/Magento/Quote/Test/Unit/Model/ShippingAddressManagementTest.php b/app/code/Magento/Quote/Test/Unit/Model/ShippingAddressManagementTest.php index c3afd3f053271..e3d5528d62c70 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/ShippingAddressManagementTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/ShippingAddressManagementTest.php @@ -173,7 +173,7 @@ public function testSetAddress() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Cart contains virtual product(s) only. Shipping address is not applicable + * @expectedExceptionMessage The Cart includes virtual product(s) only, so a shipping address is not used. */ public function testSetAddressForVirtualProduct() { @@ -195,12 +195,12 @@ public function testSetAddressForVirtualProduct() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Unable to save address. Please check input data. + * @expectedExceptionMessage The address failed to save. Verify the address and try again. */ public function testSetAddressWithInabilityToSaveQuote() { $this->quoteAddressMock->expects($this->once())->method('save')->willThrowException( - new \Exception('Unable to save address. Please check input data.') + new \Exception('The address failed to save. Verify the address and try again.') ); $customerAddressId = 150; @@ -265,7 +265,7 @@ public function testGetAddress() /** * @expectedException \Exception - * @expectedExceptionMessage Cart contains virtual product(s) only. Shipping address is not applicable + * @expectedExceptionMessage The Cart includes virtual product(s) only, so a shipping address is not used. */ public function testGetAddressOfQuoteWithVirtualProducts() { diff --git a/app/code/Magento/Quote/Test/Unit/Model/ShippingMethodManagementTest.php b/app/code/Magento/Quote/Test/Unit/Model/ShippingMethodManagementTest.php index af68dcc30a50f..198f1c54a42b4 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/ShippingMethodManagementTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/ShippingMethodManagementTest.php @@ -168,7 +168,7 @@ protected function setUp() /** * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Shipping address not set. + * @expectedExceptionMessage The shipping address is missing. Set the address and try again. */ public function testGetMethodWhenShippingAddressIsNotSet() { @@ -257,7 +257,7 @@ public function testGetListForEmptyCart() /** * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Shipping address not set. + * @expectedExceptionMessage The shipping address is missing. Set the address and try again. */ public function testGetListWhenShippingAddressIsNotSet() { @@ -307,7 +307,7 @@ public function testGetList() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Shipping method is not applicable for empty cart + * @expectedExceptionMessage The shipping method can't be set for an empty cart. Add an item to cart and try again. */ public function testSetMethodWithInputException() { @@ -326,7 +326,7 @@ public function testSetMethodWithInputException() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Cart contains virtual product(s) only. Shipping method is not applicable. + * @expectedExceptionMessage The Cart includes virtual product(s) only, so a shipping address is not used. */ public function testSetMethodWithVirtualProduct() { @@ -346,7 +346,7 @@ public function testSetMethodWithVirtualProduct() /** * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Shipping address is not set + * @expectedExceptionMessage The shipping address is missing. Set the address and try again. */ public function testSetMethodWithoutShippingAddress() { @@ -368,7 +368,7 @@ public function testSetMethodWithoutShippingAddress() /** * @expectedException \Magento\Framework\Exception\CouldNotSaveException - * @expectedExceptionMessage Cannot set shipping method. Custom Error + * @expectedExceptionMessage The shipping method can't be set. Custom Error */ public function testSetMethodWithCouldNotSaveException() { @@ -404,7 +404,7 @@ public function testSetMethodWithCouldNotSaveException() /** * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Shipping address is not set + * @expectedExceptionMessage The shipping address is missing. Set the address and try again. */ public function testSetMethodWithoutAddress() { diff --git a/app/code/Magento/Review/Controller/Product/ListAjax.php b/app/code/Magento/Review/Controller/Product/ListAjax.php index 32d608704c241..0180e5a7ee035 100644 --- a/app/code/Magento/Review/Controller/Product/ListAjax.php +++ b/app/code/Magento/Review/Controller/Product/ListAjax.php @@ -19,7 +19,7 @@ class ListAjax extends ProductController public function execute() { if (!$this->initProduct()) { - throw new LocalizedException(__('Cannot initialize product')); + throw new LocalizedException(__("The product can't be initialized.")); } else { /** @var \Magento\Framework\View\Result\Layout $resultLayout */ $resultLayout = $this->resultFactory->create(ResultFactory::TYPE_LAYOUT); diff --git a/app/code/Magento/Review/Helper/Action/Pager.php b/app/code/Magento/Review/Helper/Action/Pager.php index 39c4f3c09d0b7..5d1c5fd308e9c 100644 --- a/app/code/Magento/Review/Helper/Action/Pager.php +++ b/app/code/Magento/Review/Helper/Action/Pager.php @@ -141,7 +141,7 @@ protected function _findItemPositionByValue($value) protected function _getStorageKey() { if (!$this->_storageId) { - throw new LocalizedException(__('Storage key was not set')); + throw new LocalizedException(__("The storage key wasn't set. Add the storage key and try again.")); } return self::STORAGE_PREFIX . $this->_storageId; diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/AddComment.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/AddComment.php index 12038ee375059..07716314ec6e2 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/AddComment.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/AddComment.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Controller\Adminhtml\Order; use Magento\Backend\App\Action; @@ -30,7 +31,9 @@ public function execute() try { $data = $this->getRequest()->getPost('history'); if (empty($data['comment']) && $data['status'] == $order->getDataByKey('status')) { - throw new \Magento\Framework\Exception\LocalizedException(__('Please enter a comment.')); + throw new \Magento\Framework\Exception\LocalizedException( + __('The comment is missing. Enter and try again.') + ); } $notify = isset($data['is_customer_notified']) ? $data['is_customer_notified'] : false; diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Create.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Create.php index 1343b77bcd0ae..a7b41d0a780f3 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Create.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Create.php @@ -327,7 +327,7 @@ protected function _processActionData($action = null) if ($this->_getQuote()->getCouponCode() !== $couponCode) { $this->messageManager->addError( __( - '"%1" coupon code is not valid.', + 'The "%1" coupon code isn\'t valid. Verify the code and try again.', $this->escaper->escapeHtml($couponCode) ) ); diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/ConfigureQuoteItems.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/ConfigureQuoteItems.php index 422fe1895b1f0..ba60a916c6daf 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/ConfigureQuoteItems.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/ConfigureQuoteItems.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Controller\Adminhtml\Order\Create; class ConfigureQuoteItems extends \Magento\Sales\Controller\Adminhtml\Order\Create @@ -19,12 +20,16 @@ public function execute() try { $quoteItemId = (int)$this->getRequest()->getParam('id'); if (!$quoteItemId) { - throw new \Magento\Framework\Exception\LocalizedException(__('Quote item id is not received.')); + throw new \Magento\Framework\Exception\LocalizedException( + __('The quote item ID needs to be received. Set the ID and try again.') + ); } $quoteItem = $this->_objectManager->create(\Magento\Quote\Model\Quote\Item::class)->load($quoteItemId); if (!$quoteItem->getId()) { - throw new \Magento\Framework\Exception\LocalizedException(__('Quote item is not loaded.')); + throw new \Magento\Framework\Exception\LocalizedException( + __('The quote item needs to be loaded. Load the item and try again.') + ); } $configureResult->setOk(true); diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/AddComment.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/AddComment.php index cfac8243d091e..4e158efe9702d 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/AddComment.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/AddComment.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Controller\Adminhtml\Order\Creditmemo; use Magento\Backend\App\Action; @@ -78,7 +79,7 @@ public function execute() $data = $this->getRequest()->getPost('comment'); if (empty($data['comment'])) { throw new \Magento\Framework\Exception\LocalizedException( - __('Please enter a comment.') + __('The comment is missing. Enter and try again.') ); } $this->creditmemoLoader->setOrderId($this->getRequest()->getParam('order_id')); diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/AddComment.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/AddComment.php index 9483abf6354cb..515c0753542a0 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/AddComment.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/AddComment.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Controller\Adminhtml\Order\Invoice; use Magento\Backend\App\Action\Context; @@ -74,7 +75,7 @@ public function execute() $this->getRequest()->setParam('invoice_id', $this->getRequest()->getParam('id')); $data = $this->getRequest()->getPost('comment'); if (empty($data['comment'])) { - throw new LocalizedException(__('Please enter a comment.')); + throw new LocalizedException(__('The comment is missing. Enter and try again.')); } $invoice = $this->getInvoice(); if (!$invoice) { diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/NewAction.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/NewAction.php index 9db9599862f4e..359bbafd45105 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/NewAction.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/NewAction.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Controller\Adminhtml\Order\Invoice; use Magento\Backend\App\Action; @@ -94,7 +95,7 @@ public function execute() if (!$invoice->getTotalQty()) { throw new \Magento\Framework\Exception\LocalizedException( - __('You can\'t create an invoice without products.') + __("The invoice can't be created without products. Add products and try again.") ); } $this->registry->register('current_invoice', $invoice); diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save.php index c45a1982784e1..d804dff5d48a0 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Controller\Adminhtml\Order\Invoice; use Magento\Backend\App\Action; @@ -117,7 +118,7 @@ public function execute() $formKeyIsValid = $this->_formKeyValidator->validate($this->getRequest()); $isPost = $this->getRequest()->isPost(); if (!$formKeyIsValid || !$isPost) { - $this->messageManager->addError(__('We can\'t save the invoice right now.')); + $this->messageManager->addError(__("The invoice can't be saved at this time. Please try again later.")); return $resultRedirect->setPath('sales/order/index'); } @@ -146,12 +147,12 @@ public function execute() $invoice = $this->invoiceService->prepareInvoice($order, $invoiceItems); if (!$invoice) { - throw new LocalizedException(__('We can\'t save the invoice right now.')); + throw new LocalizedException(__("The invoice can't be saved at this time. Please try again later.")); } if (!$invoice->getTotalQty()) { throw new \Magento\Framework\Exception\LocalizedException( - __('You can\'t create an invoice without products.') + __("The invoice can't be created without products. Add products and try again.") ); } $this->registry->register('current_invoice', $invoice); @@ -221,7 +222,7 @@ public function execute() } catch (LocalizedException $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addError(__('We can\'t save the invoice right now.')); + $this->messageManager->addError(__("The invoice can't be saved at this time. Please try again later.")); $this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e); } return $resultRedirect->setPath('sales/*/new', ['order_id' => $orderId]); diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/UpdateQty.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/UpdateQty.php index cdb4114f70976..78fb4aff3f275 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/UpdateQty.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/UpdateQty.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Controller\Adminhtml\Order\Invoice; use Magento\Framework\Exception\LocalizedException; @@ -93,7 +94,7 @@ public function execute() if (!$invoice->getTotalQty()) { throw new \Magento\Framework\Exception\LocalizedException( - __('You can\'t create an invoice without products.') + __("The invoice can't be created without products. Add products and try again.") ); } $this->registry->register('current_invoice', $invoice); diff --git a/app/code/Magento/Sales/Model/AdminOrder/Create.php b/app/code/Magento/Sales/Model/AdminOrder/Create.php index 9847c600e691e..ebe0aa6a20368 100644 --- a/app/code/Magento/Sales/Model/AdminOrder/Create.php +++ b/app/code/Magento/Sales/Model/AdminOrder/Create.php @@ -1977,12 +1977,12 @@ protected function _validate() if (!$this->getQuote()->isVirtual()) { if (!$this->getQuote()->getShippingAddress()->getShippingMethod()) { - $this->_errors[] = __('Please specify a shipping method.'); + $this->_errors[] = __('The shipping method is missing. Select the shipping method and try again.'); } } if (!$this->getQuote()->getPayment()->getMethod()) { - $this->_errors[] = __('Please specify a payment method.'); + $this->_errors[] = __("The payment method isn't selected. Enter the payment method and try again."); } else { $method = $this->getQuote()->getPayment()->getMethodInstance(); if (!$method->isAvailable($this->getQuote())) { diff --git a/app/code/Magento/Sales/Model/EntityStorage.php b/app/code/Magento/Sales/Model/EntityStorage.php index 3fc0837e7cd58..06f0044715487 100644 --- a/app/code/Magento/Sales/Model/EntityStorage.php +++ b/app/code/Magento/Sales/Model/EntityStorage.php @@ -45,7 +45,7 @@ public function addByIdentifyingFields(FrameworkAbstractModel $object, array $id throw new \Magento\Framework\Exception\InputException(__('Identifying Fields required')); } if (!$object->getId()) { - throw new \Magento\Framework\Exception\InputException(__('Id required')); + throw new \Magento\Framework\Exception\InputException(__('An ID is needed. Set the ID and try again.')); } $this->storageMapper[$storageName][$this->getHash($identifyingFields)] = $object->getId(); $this->registry[$object->getId()] = $object; diff --git a/app/code/Magento/Sales/Model/Order/Address/Validator.php b/app/code/Magento/Sales/Model/Order/Address/Validator.php index e6353f7f28899..31cb5bb1f60ca 100644 --- a/app/code/Magento/Sales/Model/Order/Address/Validator.php +++ b/app/code/Magento/Sales/Model/Order/Address/Validator.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Model\Order\Address; use Magento\Directory\Helper\Data as DirectoryHelper; @@ -84,7 +85,7 @@ public function validate(Address $address) $warnings = []; foreach ($this->required as $code => $label) { if (!$address->hasData($code)) { - $warnings[] = sprintf('%s is a required field', $label); + $warnings[] = sprintf('"%s" is required. Enter and try again.', $label); } } if (!filter_var($address->getEmail(), FILTER_VALIDATE_EMAIL)) { diff --git a/app/code/Magento/Sales/Model/Order/AddressRepository.php b/app/code/Magento/Sales/Model/Order/AddressRepository.php index 96dc531a82bf4..2aed6ef16817e 100644 --- a/app/code/Magento/Sales/Model/Order/AddressRepository.php +++ b/app/code/Magento/Sales/Model/Order/AddressRepository.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Model\Order; use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; @@ -67,14 +68,16 @@ public function __construct( public function get($id) { if (!$id) { - throw new InputException(__('Id required')); + throw new InputException(__('An ID is needed. Set the ID and try again.')); } if (!isset($this->registry[$id])) { /** @var \Magento\Sales\Api\Data\OrderAddressInterface $entity */ $entity = $this->metadata->getNewInstance()->load($id); if (!$entity->getEntityId()) { - throw new NoSuchEntityException(__('Requested entity doesn\'t exist')); + throw new NoSuchEntityException( + __("The entity that was requested doesn't exist. Verify the entity and try again.") + ); } $this->registry[$id] = $entity; @@ -113,7 +116,7 @@ public function delete(\Magento\Sales\Api\Data\OrderAddressInterface $entity) unset($this->registry[$entity->getEntityId()]); } catch (\Exception $e) { - throw new CouldNotDeleteException(__('Could not delete order address'), $e); + throw new CouldNotDeleteException(__("The order address couldn't be deleted."), $e); } return true; @@ -145,7 +148,7 @@ public function save(\Magento\Sales\Api\Data\OrderAddressInterface $entity) $this->metadata->getMapper()->save($entity); $this->registry[$entity->getEntityId()] = $entity; } catch (\Exception $e) { - throw new CouldNotSaveException(__('Could not save order address'), $e); + throw new CouldNotSaveException(__("The order address couldn't be saved."), $e); } return $this->registry[$entity->getEntityId()]; diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/Comment/Validator.php b/app/code/Magento/Sales/Model/Order/Creditmemo/Comment/Validator.php index 091bcdf594875..012bd7afa6411 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo/Comment/Validator.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo/Comment/Validator.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Model\Order\Creditmemo\Comment; use Magento\Sales\Model\Order\Creditmemo\Comment; @@ -34,7 +35,7 @@ public function validate(Comment $comment) $commentData = $comment->getData(); foreach ($this->required as $code => $label) { if (!$comment->hasData($code)) { - $errors[$code] = sprintf('%s is a required field', $label); + $errors[$code] = sprintf('"%s" is required. Enter and try again.', $label); } elseif (empty($commentData[$code])) { $errors[$code] = sprintf('%s can not be empty', $label); } diff --git a/app/code/Magento/Sales/Model/Order/CreditmemoRepository.php b/app/code/Magento/Sales/Model/Order/CreditmemoRepository.php index b866b0de0abfc..a57839b933617 100644 --- a/app/code/Magento/Sales/Model/Order/CreditmemoRepository.php +++ b/app/code/Magento/Sales/Model/Order/CreditmemoRepository.php @@ -70,13 +70,15 @@ public function __construct( public function get($id) { if (!$id) { - throw new InputException(__('Id required')); + throw new InputException(__('An ID is needed. Set the ID and try again.')); } if (!isset($this->registry[$id])) { /** @var \Magento\Sales\Api\Data\CreditmemoInterface $entity */ $entity = $this->metadata->getNewInstance()->load($id); if (!$entity->getEntityId()) { - throw new NoSuchEntityException(__('Requested entity doesn\'t exist')); + throw new NoSuchEntityException( + __("The entity that was requested doesn't exist. Verify the entity and try again.") + ); } $this->registry[$id] = $entity; } @@ -121,7 +123,7 @@ public function delete(\Magento\Sales\Api\Data\CreditmemoInterface $entity) $this->metadata->getMapper()->delete($entity); unset($this->registry[$entity->getEntityId()]); } catch (\Exception $e) { - throw new CouldNotDeleteException(__('Could not delete credit memo'), $e); + throw new CouldNotDeleteException(__("The credit memo couldn't be deleted."), $e); } return true; } @@ -139,7 +141,7 @@ public function save(\Magento\Sales\Api\Data\CreditmemoInterface $entity) $this->metadata->getMapper()->save($entity); $this->registry[$entity->getEntityId()] = $entity; } catch (\Exception $e) { - throw new CouldNotSaveException(__('Could not save credit memo'), $e); + throw new CouldNotSaveException(__("The credit memo couldn't be saved."), $e); } return $this->registry[$entity->getEntityId()]; } diff --git a/app/code/Magento/Sales/Model/Order/Invoice/Comment/Validator.php b/app/code/Magento/Sales/Model/Order/Invoice/Comment/Validator.php index 316764dc6d61c..ac189d2277772 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice/Comment/Validator.php +++ b/app/code/Magento/Sales/Model/Order/Invoice/Comment/Validator.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Model\Order\Invoice\Comment; use Magento\Sales\Model\Order\Invoice\Comment; @@ -34,7 +35,7 @@ public function validate(Comment $comment) $commentData = $comment->getData(); foreach ($this->required as $code => $label) { if (!$comment->hasData($code)) { - $errors[$code] = sprintf('%s is a required field', $label); + $errors[$code] = sprintf('"%s" is required. Enter and try again.', $label); } elseif (empty($commentData[$code])) { $errors[$code] = sprintf('%s can not be empty', $label); } diff --git a/app/code/Magento/Sales/Model/Order/InvoiceQuantityValidator.php b/app/code/Magento/Sales/Model/Order/InvoiceQuantityValidator.php index d6fca37d664ad..e4fcecbcf11ac 100644 --- a/app/code/Magento/Sales/Model/Order/InvoiceQuantityValidator.php +++ b/app/code/Magento/Sales/Model/Order/InvoiceQuantityValidator.php @@ -75,7 +75,7 @@ private function checkQtyAvailability(InvoiceInterface $invoice, OrderInterface if ($qtys) { $messages[] = __('The invoice contains one or more items that are not part of the original order.'); } elseif ($totalQty <= 0) { - $messages[] = __('You can\'t create an invoice without products.'); + $messages[] = __("The invoice can't be created without products. Add products and try again."); } return $messages; } diff --git a/app/code/Magento/Sales/Model/Order/InvoiceRepository.php b/app/code/Magento/Sales/Model/Order/InvoiceRepository.php index db8cb2e1d88c8..2244a86260c2f 100644 --- a/app/code/Magento/Sales/Model/Order/InvoiceRepository.php +++ b/app/code/Magento/Sales/Model/Order/InvoiceRepository.php @@ -66,13 +66,15 @@ public function __construct( public function get($id) { if (!$id) { - throw new \Magento\Framework\Exception\InputException(__('ID required')); + throw new \Magento\Framework\Exception\InputException(__('An ID is needed. Set the ID and try again.')); } if (!isset($this->registry[$id])) { /** @var \Magento\Sales\Api\Data\InvoiceInterface $entity */ $entity = $this->metadata->getNewInstance()->load($id); if (!$entity->getEntityId()) { - throw new NoSuchEntityException(__('Requested entity doesn\'t exist')); + throw new NoSuchEntityException( + __("The entity that was requested doesn't exist. Verify the entity and try again.") + ); } $this->registry[$id] = $entity; } diff --git a/app/code/Magento/Sales/Model/Order/ItemRepository.php b/app/code/Magento/Sales/Model/Order/ItemRepository.php index 8ded805546c8a..32741a1a7f943 100644 --- a/app/code/Magento/Sales/Model/Order/ItemRepository.php +++ b/app/code/Magento/Sales/Model/Order/ItemRepository.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Model\Order; use Magento\Catalog\Api\Data\ProductOptionExtensionFactory; @@ -105,13 +106,15 @@ public function __construct( public function get($id) { if (!$id) { - throw new InputException(__('ID required')); + throw new InputException(__('An ID is needed. Set the ID and try again.')); } if (!isset($this->registry[$id])) { /** @var OrderItemInterface $orderItem */ $orderItem = $this->metadata->getNewInstance()->load($id); if (!$orderItem->getItemId()) { - throw new NoSuchEntityException(__('Requested entity doesn\'t exist')); + throw new NoSuchEntityException( + __("The entity that was requested doesn't exist. Verify the entity and try again.") + ); } $this->addProductOption($orderItem); diff --git a/app/code/Magento/Sales/Model/Order/Payment/Repository.php b/app/code/Magento/Sales/Model/Order/Payment/Repository.php index 87bcc85e00af6..4353f6b1cc391 100644 --- a/app/code/Magento/Sales/Model/Order/Payment/Repository.php +++ b/app/code/Magento/Sales/Model/Order/Payment/Repository.php @@ -80,12 +80,14 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr public function get($id) { if (!$id) { - throw new \Magento\Framework\Exception\InputException(__('ID required')); + throw new \Magento\Framework\Exception\InputException(__('An ID is needed. Set the ID and try again.')); } if (!isset($this->registry[$id])) { $entity = $this->metaData->getNewInstance()->load($id); if (!$entity->getId()) { - throw new NoSuchEntityException(__('Requested entity doesn\'t exist')); + throw new NoSuchEntityException( + __("The entity that was requested doesn't exist. Verify the entity and try again.") + ); } $this->registry[$id] = $entity; } diff --git a/app/code/Magento/Sales/Model/Order/Payment/Transaction/Repository.php b/app/code/Magento/Sales/Model/Order/Payment/Transaction/Repository.php index a2f1d6bcdfbcc..3caae611d9551 100644 --- a/app/code/Magento/Sales/Model/Order/Payment/Transaction/Repository.php +++ b/app/code/Magento/Sales/Model/Order/Payment/Transaction/Repository.php @@ -100,12 +100,14 @@ public function __construct( public function get($id) { if (!$id) { - throw new \Magento\Framework\Exception\InputException(__('ID required')); + throw new \Magento\Framework\Exception\InputException(__('An ID is needed. Set the ID and try again.')); } if (!$this->entityStorage->has($id)) { $entity = $this->metaData->getNewInstance()->load($id); if (!$entity->getTransactionId()) { - throw new NoSuchEntityException(__('Requested entity doesn\'t exist')); + throw new NoSuchEntityException( + __("The entity that was requested doesn't exist. Verify the entity and try again.") + ); } $this->entityStorage->add($entity); } diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Comment/Validator.php b/app/code/Magento/Sales/Model/Order/Shipment/Comment/Validator.php index 3ccc65bf27512..d48af3cea8450 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment/Comment/Validator.php +++ b/app/code/Magento/Sales/Model/Order/Shipment/Comment/Validator.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Model\Order\Shipment\Comment; use Magento\Sales\Model\Order\Shipment\Comment; @@ -34,7 +35,7 @@ public function validate(Comment $comment) $commentData = $comment->getData(); foreach ($this->required as $code => $label) { if (!$comment->hasData($code)) { - $errors[$code] = sprintf('%s is a required field', $label); + $errors[$code] = sprintf('"%s" is required. Enter and try again.', $label); } elseif (empty($commentData[$code])) { $errors[$code] = sprintf('%s can not be empty', $label); } diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Track/Validator.php b/app/code/Magento/Sales/Model/Order/Shipment/Track/Validator.php index ddd193f3c50fd..9bd144654b6d3 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment/Track/Validator.php +++ b/app/code/Magento/Sales/Model/Order/Shipment/Track/Validator.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Model\Order\Shipment\Track; use Magento\Sales\Model\Order\Shipment\Track; @@ -36,7 +37,7 @@ public function validate(Track $track) $commentData = $track->getData(); foreach ($this->required as $code => $label) { if (!$track->hasData($code)) { - $errors[$code] = sprintf('%s is a required field', $label); + $errors[$code] = sprintf('"%s" is required. Enter and try again.', $label); } elseif (empty($commentData[$code])) { $errors[$code] = sprintf('%s can not be empty', $label); } diff --git a/app/code/Magento/Sales/Model/Order/ShipmentRepository.php b/app/code/Magento/Sales/Model/Order/ShipmentRepository.php index d39d27746c92e..0b86bec895b75 100644 --- a/app/code/Magento/Sales/Model/Order/ShipmentRepository.php +++ b/app/code/Magento/Sales/Model/Order/ShipmentRepository.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Model\Order; use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; @@ -66,14 +67,16 @@ public function __construct( public function get($id) { if (!$id) { - throw new InputException(__('Id required')); + throw new InputException(__('An ID is needed. Set the ID and try again.')); } if (!isset($this->registry[$id])) { /** @var \Magento\Sales\Api\Data\ShipmentInterface $entity */ $entity = $this->metadata->getNewInstance()->load($id); if (!$entity->getEntityId()) { - throw new NoSuchEntityException(__('Requested entity doesn\'t exist')); + throw new NoSuchEntityException( + __("The entity that was requested doesn't exist. Verify the entity and try again.") + ); } $this->registry[$id] = $entity; @@ -112,7 +115,7 @@ public function delete(\Magento\Sales\Api\Data\ShipmentInterface $entity) unset($this->registry[$entity->getEntityId()]); } catch (\Exception $e) { - throw new CouldNotDeleteException(__('Could not delete shipment'), $e); + throw new CouldNotDeleteException(__("The shipment couldn't be deleted."), $e); } return true; @@ -144,7 +147,7 @@ public function save(\Magento\Sales\Api\Data\ShipmentInterface $entity) $this->metadata->getMapper()->save($entity); $this->registry[$entity->getEntityId()] = $entity; } catch (\Exception $e) { - throw new CouldNotSaveException(__('Could not save shipment'), $e); + throw new CouldNotSaveException(__("The shipment couldn't be saved."), $e); } return $this->registry[$entity->getEntityId()]; diff --git a/app/code/Magento/Sales/Model/Order/Status.php b/app/code/Magento/Sales/Model/Order/Status.php index bdd15d4d844c6..288955705425f 100644 --- a/app/code/Magento/Sales/Model/Order/Status.php +++ b/app/code/Magento/Sales/Model/Order/Status.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Model\Order; use Magento\Framework\Exception\LocalizedException; @@ -92,10 +93,14 @@ public function assignState($state, $isDefault = false, $visibleOnFront = false) protected function validateBeforeUnassign($state) { if ($this->getResource()->checkIsStateLast($state)) { - throw new LocalizedException(__('The last status can\'t be unassigned from its current state.')); + throw new LocalizedException( + __("The last status can't be changed and needs to stay assigned to its current state.") + ); } if ($this->getResource()->checkIsStatusUsed($this->getStatus())) { - throw new LocalizedException(__('Status can\'t be unassigned, because it is used by existing order(s).')); + throw new LocalizedException( + __("The status can't be unassigned because the status is currently used by an order.") + ); } } diff --git a/app/code/Magento/Sales/Model/Order/Status/History/Validator.php b/app/code/Magento/Sales/Model/Order/Status/History/Validator.php index 0ba5a6aeb11ce..7a4c62089f771 100644 --- a/app/code/Magento/Sales/Model/Order/Status/History/Validator.php +++ b/app/code/Magento/Sales/Model/Order/Status/History/Validator.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Model\Order\Status\History; use Magento\Sales\Model\Order\Status\History; @@ -27,7 +28,7 @@ public function validate(History $history) $warnings = []; foreach ($this->requiredFields as $code => $label) { if (!$history->hasData($code)) { - $warnings[] = sprintf('%s is a required field', $label); + $warnings[] = sprintf('"%s" is required. Enter and try again.', $label); } } return $warnings; diff --git a/app/code/Magento/Sales/Model/OrderRepository.php b/app/code/Magento/Sales/Model/OrderRepository.php index 26e833c44d70a..f5ab45c5eb1ba 100644 --- a/app/code/Magento/Sales/Model/OrderRepository.php +++ b/app/code/Magento/Sales/Model/OrderRepository.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Model; use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; @@ -87,13 +88,15 @@ public function __construct( public function get($id) { if (!$id) { - throw new InputException(__('Id required')); + throw new InputException(__('An ID is needed. Set the ID and try again.')); } if (!isset($this->registry[$id])) { /** @var OrderInterface $entity */ $entity = $this->metadata->getNewInstance()->load($id); if (!$entity->getEntityId()) { - throw new NoSuchEntityException(__('Requested entity doesn\'t exist')); + throw new NoSuchEntityException( + __("The entity that was requested doesn't exist. Verify the entity and try again.") + ); } $this->setShippingAssignments($entity); $this->registry[$id] = $entity; diff --git a/app/code/Magento/Sales/Model/ResourceModel/Order/Status.php b/app/code/Magento/Sales/Model/ResourceModel/Order/Status.php index 140ffdea262be..58284759b2fee 100644 --- a/app/code/Magento/Sales/Model/ResourceModel/Order/Status.php +++ b/app/code/Magento/Sales/Model/ResourceModel/Order/Status.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Model\ResourceModel\Order; use Magento\Framework\App\ResourceConnection; @@ -187,7 +188,7 @@ public function unassignState($status, $state) $this->getConnection()->commit(); } catch (\Exception $e) { $this->getConnection()->rollBack(); - throw new LocalizedException(__('Cannot unassign status from state')); + throw new LocalizedException(__('The status needs to remain assigned to its state.')); } return $this; diff --git a/app/code/Magento/Sales/Model/Validator.php b/app/code/Magento/Sales/Model/Validator.php index f309e00b55cfa..740cfa76afe21 100644 --- a/app/code/Magento/Sales/Model/Validator.php +++ b/app/code/Magento/Sales/Model/Validator.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Model; use Magento\Framework\Exception\ConfigurationMismatchException; @@ -58,9 +59,7 @@ public function validate($entity, array $validators, $context = null) $validator = $this->objectManager->create($validatorName, $validatorArguments); if (!$validator instanceof ValidatorInterface) { throw new ConfigurationMismatchException( - __( - sprintf('Validator %s is not instance of general validator interface', $validatorName) - ) + __('The "%1" validator is not an instance of the general validator interface.', $validatorName) ); } $messages = array_merge($messages, $validator->validate($entity)); diff --git a/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Create/ProcessDataTest.php b/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Create/ProcessDataTest.php index 2b6436395a0cf..85ed8b9470282 100644 --- a/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Create/ProcessDataTest.php +++ b/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Create/ProcessDataTest.php @@ -239,7 +239,7 @@ public function isApplyDiscountDataProvider() { return [ [true, '123', '"%1" coupon code was not applied. Do not apply discount is selected for item(s)', null], - [false, '123', '"%1" coupon code is not valid.', '132'], + [false, '123', 'The "%1" coupon code isn\'t valid. Verify the code and try again.', '132'], ]; } } diff --git a/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Creditmemo/AddCommentTest.php b/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Creditmemo/AddCommentTest.php index 29ae1b94704dc..dce080ad03591 100644 --- a/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Creditmemo/AddCommentTest.php +++ b/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Creditmemo/AddCommentTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Test\Unit\Controller\Adminhtml\Order\Creditmemo; /** @@ -215,7 +216,7 @@ public function testExecuteException() */ public function testExecuteNoComment() { - $message = 'Please enter a comment.'; + $message = 'The comment is missing. Enter and try again.'; $response = ['error' => true, 'message' => $message]; $data = []; diff --git a/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/EmailTest.php b/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/EmailTest.php index 3c87b558bb1c9..bb826be85850c 100644 --- a/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/EmailTest.php +++ b/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/EmailTest.php @@ -195,7 +195,9 @@ public function testEmailNoOrderId() ->method('get') ->with(null) ->willThrowException( - new \Magento\Framework\Exception\NoSuchEntityException(__('Requested entity doesn\'t exist')) + new \Magento\Framework\Exception\NoSuchEntityException( + __("The entity that was requested doesn't exist. Verify the entity and try again.") + ) ); $this->messageManager->expects($this->once()) ->method('addError') diff --git a/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Invoice/SaveTest.php b/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Invoice/SaveTest.php index 6bd02f0c16317..3ffa0971770b1 100644 --- a/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Invoice/SaveTest.php +++ b/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Invoice/SaveTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Test\Unit\Controller\Adminhtml\Order\Invoice; use Magento\Backend\App\Action; @@ -122,7 +123,7 @@ public function testExecuteNotValidPost() ->willReturn(false); $this->messageManagerMock->expects($this->once()) ->method('addError') - ->with('We can\'t save the invoice right now.'); + ->with("The invoice can't be saved at this time. Please try again later."); $redirectMock->expects($this->once()) ->method('setPath') ->with('sales/order/index') diff --git a/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/ViewTest.php b/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/ViewTest.php index 9677ade99c6eb..97b3fe630aa52 100644 --- a/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/ViewTest.php +++ b/app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/ViewTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Test\Unit\Controller\Adminhtml\Order; /** @@ -218,7 +219,9 @@ public function testExecuteNoOrder() ->method('get') ->with($orderIdParam) ->willThrowException( - new \Magento\Framework\Exception\NoSuchEntityException(__('Requested entity doesn\'t exist')) + new \Magento\Framework\Exception\NoSuchEntityException( + __("The entity that was requested doesn't exist. Verify the entity and try again.") + ) ); $this->initOrderFail(); $this->prepareRedirect(); diff --git a/app/code/Magento/Sales/Test/Unit/Model/InvoiceRepositoryTest.php b/app/code/Magento/Sales/Test/Unit/Model/InvoiceRepositoryTest.php index 5309c2064c5a7..56e9a91a52aff 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/InvoiceRepositoryTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/InvoiceRepositoryTest.php @@ -80,7 +80,7 @@ public function testGet() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage ID required + * @expectedExceptionMessage An ID is needed. Set the ID and try again. */ public function testGetNoId() { @@ -89,7 +89,7 @@ public function testGetNoId() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Requested entity doesn't exist + * @expectedExceptionMessage The entity that was requested doesn't exist. Verify the entity and try again. */ public function testGetEntityNoId() { diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Address/ValidatorTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Address/ValidatorTest.php index d83a3e34ec00a..e3a3367858bfd 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Address/ValidatorTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Address/ValidatorTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Test\Unit\Model\Order\Address; /** @@ -125,7 +126,7 @@ public function providerAddressData() 'co.co.co', 'coco-shipping', [ - 'Street is a required field', + '"Street" is required. Enter and try again.', 'Email has a wrong format', 'Address type doesn\'t match required options' ] diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/AddressRepositoryTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/AddressRepositoryTest.php index 87f4a9103be6f..33f1c2f8923af 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/AddressRepositoryTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/AddressRepositoryTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Test\Unit\Model\Order; use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; @@ -176,7 +177,7 @@ public function testDelete() /** * @expectedException \Magento\Framework\Exception\CouldNotDeleteException - * @expectedExceptionMessage Could not delete order address + * @expectedExceptionMessage The order address couldn't be deleted. */ public function testDeleteWithException() { @@ -233,7 +234,7 @@ public function testSave() /** * @expectedException \Magento\Framework\Exception\CouldNotSaveException - * @expectedExceptionMessage Could not save order address + * @expectedExceptionMessage The order address couldn't be saved. */ public function testSaveWithException() { diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Comment/ValidatorTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Comment/ValidatorTest.php index 97526ae544752..673523a70e53c 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Comment/ValidatorTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Comment/ValidatorTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Test\Unit\Model\Order\Creditmemo\Comment; /** @@ -82,7 +83,7 @@ public function providerCommentData() ], [ 'parent_id' => 'Parent Creditmemo Id can not be empty', - 'comment' => 'Comment is a required field' + 'comment' => '"Comment" is required. Enter and try again.' ] ] ]; diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/CreditmemoRepositoryTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/CreditmemoRepositoryTest.php index c27a1b1a4e224..6a4db2e0cf715 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/CreditmemoRepositoryTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/CreditmemoRepositoryTest.php @@ -81,7 +81,7 @@ public function testGet() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Id required + * @expectedExceptionMessage An ID is needed. Set the ID and try again. */ public function testGetNoId() { @@ -90,7 +90,7 @@ public function testGetNoId() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Requested entity doesn't exist + * @expectedExceptionMessage The entity that was requested doesn't exist. Verify the entity and try again. */ public function testGetEntityNoId() { @@ -167,7 +167,7 @@ public function testDelete() /** * @expectedException \Magento\Framework\Exception\CouldNotDeleteException - * @expectedExceptionMessage Could not delete credit memo + * @expectedExceptionMessage The credit memo couldn't be deleted. */ public function testDeleteWithException() { @@ -216,7 +216,7 @@ public function testSave() /** * @expectedException \Magento\Framework\Exception\CouldNotSaveException - * @expectedExceptionMessage Could not save credit memo + * @expectedExceptionMessage The credit memo couldn't be saved. */ public function testSaveWithException() { diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Invoice/Comment/ValidatorTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Invoice/Comment/ValidatorTest.php index 0bc9839e26652..6d2a903f7098c 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Invoice/Comment/ValidatorTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Invoice/Comment/ValidatorTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Test\Unit\Model\Order\Invoice\Comment; /** @@ -82,7 +83,7 @@ public function providerCommentData() ], [ 'parent_id' => 'Parent Invoice Id can not be empty', - 'comment' => 'Comment is a required field' + 'comment' => '"Comment" is required. Enter and try again.' ] ] ]; diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/InvoiceQuantityValidatorTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/InvoiceQuantityValidatorTest.php index 5d3e9ae22e78b..14d6df5c1c8f1 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/InvoiceQuantityValidatorTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/InvoiceQuantityValidatorTest.php @@ -136,7 +136,7 @@ public function testValidateNoOrder() public function testValidateNoInvoiceItems() { - $expectedResult = [__('You can\'t create an invoice without products.')]; + $expectedResult = [__("The invoice can't be created without products. Add products and try again.")]; $orderItemId = 1; $invoiceItemMock = $this->getInvoiceItemMock($orderItemId, 0); $this->invoiceMock->expects($this->once()) diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/ItemRepositoryTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/ItemRepositoryTest.php index 0c34e5bdffd4a..8be2c3c8612d7 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/ItemRepositoryTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/ItemRepositoryTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Test\Unit\Model\Order; use Magento\Sales\Model\Order\ItemRepository; @@ -91,7 +92,7 @@ protected function setUp() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage ID required + * @expectedExceptionMessage An ID is needed. Set the ID and try again. */ public function testGetWithNoId() { @@ -110,7 +111,7 @@ public function testGetWithNoId() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Requested entity doesn't exist + * @expectedExceptionMessage The entity that was requested doesn't exist. Verify the entity and try again. */ public function testGetEmptyEntity() { diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/Comment/ValidatorTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/Comment/ValidatorTest.php index a3de503f2f8c9..ff414f808cfa2 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/Comment/ValidatorTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/Comment/ValidatorTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Test\Unit\Model\Order\Shipment\Comment; /** @@ -82,7 +83,7 @@ public function providerCommentData() ], [ 'parent_id' => 'Parent Shipment Id can not be empty', - 'comment' => 'Comment is a required field' + 'comment' => '"Comment" is required. Enter and try again.' ] ] ]; diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/Track/ValidatorTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/Track/ValidatorTest.php index 5207f951a4a41..77374c29d105d 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/Track/ValidatorTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/Track/ValidatorTest.php @@ -90,9 +90,9 @@ public function providerTrackData() ], [ 'parent_id' => 'Parent Track Id can not be empty', - 'order_id' => 'Order Id is a required field', + 'order_id' => '"Order Id" is required. Enter and try again.', 'track_number' => 'Number can not be empty', - 'carrier_code' => 'Carrier Code is a required field' + 'carrier_code' => '"Carrier Code" is required. Enter and try again.' ] ] ]; diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/ShipmentRepositoryTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/ShipmentRepositoryTest.php index 38097bf4bd562..6785c6c4aec51 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/ShipmentRepositoryTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/ShipmentRepositoryTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Test\Unit\Model\Order; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; @@ -169,7 +170,7 @@ public function testDelete() /** * @expectedException \Magento\Framework\Exception\CouldNotDeleteException - * @expectedExceptionMessage Could not delete shipment + * @expectedExceptionMessage The shipment couldn't be deleted. */ public function testDeleteWithException() { @@ -226,7 +227,7 @@ public function testSave() /** * @expectedException \Magento\Framework\Exception\CouldNotSaveException - * @expectedExceptionMessage Could not save shipment + * @expectedExceptionMessage The shipment couldn't be saved. */ public function testSaveWithException() { diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Status/History/ValidatorTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Status/History/ValidatorTest.php index b72a9363eb8f7..ce9b57436c6e7 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Status/History/ValidatorTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Status/History/ValidatorTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Test\Unit\Model\Order\Status\History; use \Magento\Sales\Model\Order\Status\History\Validator; @@ -27,6 +28,6 @@ public function testValidateNegative() ->with('parent_id') ->will($this->returnValue(false)); $validator = new Validator(); - $this->assertEquals(['Order Id is a required field'], $validator->validate($history)); + $this->assertEquals(['"Order Id" is required. Enter and try again.'], $validator->validate($history)); } } diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/StatusTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/StatusTest.php index 781a55262abf9..d2a08330126dc 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/StatusTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/StatusTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Test\Unit\Model\Order; /** @@ -86,7 +87,7 @@ public function testUnassignStateSuccess() * Test for method unassignState state is last * * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage The last status can't be unassigned from its current state. + * @expectedExceptionMessage The last status can't be changed and needs to stay assigned to its current state. */ public function testUnassignStateStateIsLast() { @@ -105,7 +106,7 @@ public function testUnassignStateStateIsLast() * Test for method unassignState status in use * * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Status can't be unassigned, because it is used by existing order(s). + * @expectedExceptionMessage The status can't be unassigned because the status is currently used by an order. */ public function testUnassignStateStatusUsed() { diff --git a/app/code/Magento/SalesSequence/Model/ResourceModel/Meta.php b/app/code/Magento/SalesSequence/Model/ResourceModel/Meta.php index 10cf903d0baed..be566b6119bdd 100644 --- a/app/code/Magento/SalesSequence/Model/ResourceModel/Meta.php +++ b/app/code/Magento/SalesSequence/Model/ResourceModel/Meta.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\SalesSequence\Model\ResourceModel; use Magento\Framework\Exception\LocalizedException as Exception; @@ -117,7 +118,12 @@ protected function _afterLoad(\Magento\Framework\Model\AbstractModel $object) protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object) { if (!$object->getData('active_profile') instanceof ModelProfile) { - throw new NoSuchEntityException(__('Entity Sequence profile not added to meta active profile')); + throw new NoSuchEntityException( + __( + "The entity sequence profile wasn't added to the meta active profile. " + . "Verify the profile and try again." + ) + ); } if (!$object->getData('entity_type') diff --git a/app/code/Magento/Search/Model/SynonymGroupRepository.php b/app/code/Magento/Search/Model/SynonymGroupRepository.php index 7b924df56a7e0..6c5bdfb597487 100644 --- a/app/code/Magento/Search/Model/SynonymGroupRepository.php +++ b/app/code/Magento/Search/Model/SynonymGroupRepository.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Search\Model; use Magento\Framework\Exception\CouldNotDeleteException; @@ -73,7 +74,7 @@ public function delete(SynonymGroupInterface $synonymGroup) } catch (\Exception $exception) { throw new CouldNotDeleteException( __( - 'Synonym group with id %1 cannot be deleted. %2', + 'The synonym group with the "%1" ID can\'t be deleted. %2', $synonymGroup->getGroupId(), $exception->getMessage() ) diff --git a/app/code/Magento/Security/Model/AdminSessionsManager.php b/app/code/Magento/Security/Model/AdminSessionsManager.php index af690f1899e7b..7503fe04ba480 100644 --- a/app/code/Magento/Security/Model/AdminSessionsManager.php +++ b/app/code/Magento/Security/Model/AdminSessionsManager.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Security\Model; use Magento\Framework\HTTP\PhpEnvironment\RemoteAddress; @@ -205,7 +206,7 @@ public function getLogoutReasonMessageByStatus($statusCode) break; case self::LOGOUT_REASON_USER_LOCKED: $reasonMessage = __( - 'Your account is temporarily disabled.' + 'Your account is temporarily disabled. Please try again later.' ); break; default: diff --git a/app/code/Magento/Security/Model/SecurityChecker/Frequency.php b/app/code/Magento/Security/Model/SecurityChecker/Frequency.php index 5ff06272563a7..5aeb0fca6f0a6 100644 --- a/app/code/Magento/Security/Model/SecurityChecker/Frequency.php +++ b/app/code/Magento/Security/Model/SecurityChecker/Frequency.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Security\Model\SecurityChecker; use Magento\Framework\Exception\SecurityViolationException; @@ -76,7 +77,8 @@ public function check($securityEventType, $accountReference = null, $longIp = nu )) { throw new SecurityViolationException( __( - 'Too many password reset requests. Please wait and try again or contact %1.', + 'We received too many requests for password resets. ' + . 'Please wait and try again later or contact %1.', $this->securityConfig->getCustomerServiceEmail() ) ); diff --git a/app/code/Magento/Security/Model/SecurityChecker/Quantity.php b/app/code/Magento/Security/Model/SecurityChecker/Quantity.php index 7f1d85abeb74b..9d86b55158be5 100644 --- a/app/code/Magento/Security/Model/SecurityChecker/Quantity.php +++ b/app/code/Magento/Security/Model/SecurityChecker/Quantity.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Security\Model\SecurityChecker; use Magento\Framework\Exception\SecurityViolationException; @@ -58,7 +59,8 @@ public function check($securityEventType, $accountReference = null, $longIp = nu if ($collection->count() >= $allowedAttemptsNumber) { throw new SecurityViolationException( __( - 'Too many password reset requests. Please wait and try again or contact %1.', + 'We received too many requests for password resets. ' + . 'Please wait and try again later or contact %1.', $this->securityConfig->getCustomerServiceEmail() ) ); diff --git a/app/code/Magento/Security/Test/Unit/Model/AdminSessionsManagerTest.php b/app/code/Magento/Security/Test/Unit/Model/AdminSessionsManagerTest.php index ddfeaa59ac224..be0bdaecf8de3 100644 --- a/app/code/Magento/Security/Test/Unit/Model/AdminSessionsManagerTest.php +++ b/app/code/Magento/Security/Test/Unit/Model/AdminSessionsManagerTest.php @@ -370,7 +370,7 @@ public function dataProviderLogoutReasonMessage() 'sessionStatus' => \Magento\Security\Model\AdminSessionInfo::LOGGED_OUT ], [ - 'expectedResult' => __('Your account is temporarily disabled.'), + 'expectedResult' => __('Your account is temporarily disabled. Please try again later.'), 'sessionStatus' => \Magento\Security\Model\AdminSessionsManager::LOGOUT_REASON_USER_LOCKED ], [ diff --git a/app/code/Magento/Security/Test/Unit/Model/SecurityChecker/FrequencyTest.php b/app/code/Magento/Security/Test/Unit/Model/SecurityChecker/FrequencyTest.php index b17768bd01f89..732163383f702 100644 --- a/app/code/Magento/Security/Test/Unit/Model/SecurityChecker/FrequencyTest.php +++ b/app/code/Magento/Security/Test/Unit/Model/SecurityChecker/FrequencyTest.php @@ -134,7 +134,6 @@ public function testCheck($securityEventType, $requestsMethod) * @param int $requestsMethod * @dataProvider dataProviderSecurityEventTypeWithRequestsMethod * @expectedException \Magento\Framework\Exception\SecurityViolationException - * @expectedExceptionMessage Too many password reset requests. Please wait and try again or contact test@host.com. */ public function testCheckException($securityEventType, $requestsMethod) { @@ -158,6 +157,11 @@ public function testCheckException($securityEventType, $requestsMethod) ->willReturn($record); $this->model->check($securityEventType); + + $this->expectExceptionMessage( + 'We received too many requests for password resets. ' + . 'Please wait and try again later or contact test@host.com.' + ); } /** diff --git a/app/code/Magento/Security/Test/Unit/Model/SecurityChecker/QuantityTest.php b/app/code/Magento/Security/Test/Unit/Model/SecurityChecker/QuantityTest.php index 94cfde17f5726..e98fd06b9d47e 100644 --- a/app/code/Magento/Security/Test/Unit/Model/SecurityChecker/QuantityTest.php +++ b/app/code/Magento/Security/Test/Unit/Model/SecurityChecker/QuantityTest.php @@ -114,7 +114,6 @@ public function testCheck($securityEventType, $requestsMethod) * @param int $requestsMethod * @dataProvider dataProviderSecurityEventTypeWithRequestsMethod * @expectedException \Magento\Framework\Exception\SecurityViolationException - * @expectedExceptionMessage Too many password reset requests. Please wait and try again or contact test@host.com. */ public function testCheckException($securityEventType, $requestsMethod) { @@ -127,6 +126,11 @@ public function testCheckException($securityEventType, $requestsMethod) ->willReturn($limitNumberPasswordResetRequests); $this->model->check($securityEventType); + + $this->expectExceptionMessage( + 'We received too many requests for password resets. ' + . 'Please wait and try again later or contact test@host.com.' + ); } /** diff --git a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/AddComment.php b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/AddComment.php index 0ac36110d7e6b..483ac21689baf 100644 --- a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/AddComment.php +++ b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/AddComment.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Shipping\Controller\Adminhtml\Order\Shipment; use Magento\Sales\Model\Order\Email\Sender\ShipmentCommentSender; @@ -64,7 +65,7 @@ public function execute() $data = $this->getRequest()->getPost('comment'); if (empty($data['comment'])) { throw new \Magento\Framework\Exception\LocalizedException( - __('Please enter a comment.') + __('The comment is missing. Enter and try again.') ); } $this->shipmentLoader->setOrderId($this->getRequest()->getParam('order_id')); diff --git a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php index d42da53263ca4..8244fcc4bad9d 100644 --- a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php +++ b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Shipping\Model\Carrier; use Magento\Framework\Exception\LocalizedException; @@ -655,7 +656,7 @@ public function getMethodPrice($cost, $method = '') public function parseXml($xmlContent, $customSimplexml = 'SimpleXMLElement') { if (!$this->xmlSecurity->scan($xmlContent)) { - throw new LocalizedException(__('Security validation of XML document has been failed.')); + throw new LocalizedException(__('The security validation of the XML document has failed.')); } $xmlElement = simplexml_load_string($xmlContent, $customSimplexml); diff --git a/app/code/Magento/Shipping/Model/Shipping/Labels.php b/app/code/Magento/Shipping/Model/Shipping/Labels.php index 6a1660c9f02ed..5c796d9fa6897 100644 --- a/app/code/Magento/Shipping/Model/Shipping/Labels.php +++ b/app/code/Magento/Shipping/Model/Shipping/Labels.php @@ -91,7 +91,9 @@ public function requestToShipment(Shipment $orderShipment) $shipmentCarrier = $this->_carrierFactory->create($order->getShippingMethod(true)->getCarrierCode()); $baseCurrencyCode = $this->_storeManager->getStore($shipmentStoreId)->getBaseCurrencyCode(); if (!$shipmentCarrier) { - throw new LocalizedException(__('Invalid carrier: %1', $shippingMethod->getCarrierCode())); + throw new LocalizedException( + __('The "%1" carrier is invalid. Verify and try again.', $shippingMethod->getCarrierCode()) + ); } $shipperRegionCode = $this->_scopeConfig->getValue( Shipment::XML_PATH_STORE_REGION_ID, @@ -138,8 +140,8 @@ public function requestToShipment(Shipment $orderShipment) ) { throw new LocalizedException( __( - 'We don\'t have enough information to create shipping labels.' - . ' Please make sure your store information and settings are complete.' + "Shipping labels can't be created. " + . "Verify that the store information and settings are complete and try again." ) ); } diff --git a/app/code/Magento/Shipping/Test/Unit/Model/Carrier/AbstractCarrierOnlineTest.php b/app/code/Magento/Shipping/Test/Unit/Model/Carrier/AbstractCarrierOnlineTest.php index 499f71a271981..6f87eb171a398 100644 --- a/app/code/Magento/Shipping/Test/Unit/Model/Carrier/AbstractCarrierOnlineTest.php +++ b/app/code/Magento/Shipping/Test/Unit/Model/Carrier/AbstractCarrierOnlineTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Shipping\Test\Unit\Model\Carrier; use \Magento\Shipping\Model\Carrier\AbstractCarrierOnline; @@ -118,7 +119,7 @@ public function testParseXml() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Security validation of XML document has been failed. + * @expectedExceptionMessage The security validation of the XML document has failed. */ public function testParseXmlXXEXml() { @@ -134,7 +135,7 @@ public function testParseXmlXXEXml() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Security validation of XML document has been failed. + * @expectedExceptionMessage The security validation of the XML document has failed. */ public function testParseXmlXQBXml() { diff --git a/app/code/Magento/Store/Controller/Store/SwitchAction.php b/app/code/Magento/Store/Controller/Store/SwitchAction.php index aa023e400460f..f2872a51db6f4 100644 --- a/app/code/Magento/Store/Controller/Store/SwitchAction.php +++ b/app/code/Magento/Store/Controller/Store/SwitchAction.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Store\Controller\Store; use Magento\Framework\App\Action\Action; @@ -81,7 +82,7 @@ public function execute() } catch (StoreIsInactiveException $e) { $error = __('Requested store is inactive'); } catch (NoSuchEntityException $e) { - $error = __('Requested store is not found'); + $error = __("The store that was requested wasn't found. Verify the store and try again."); } if (isset($error)) { diff --git a/app/code/Magento/Store/Model/Config/Importer/Processor/Create.php b/app/code/Magento/Store/Model/Config/Importer/Processor/Create.php index 768482aa44636..edae49b77ff27 100644 --- a/app/code/Magento/Store/Model/Config/Importer/Processor/Create.php +++ b/app/code/Magento/Store/Model/Config/Importer/Processor/Create.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Store\Model\Config\Importer\Processor; use Magento\Framework\Event\ManagerInterface; @@ -243,7 +244,7 @@ private function detectWebsiteById(array $data, $websiteId) } } - throw new NotFoundException(__('Website was not found')); + throw new NotFoundException(__("The website wasn't found. Verify the website and try again.")); } /** @@ -266,7 +267,7 @@ private function detectGroupById(array $data, $groupId) } } - throw new NotFoundException(__('Group was not found')); + throw new NotFoundException(__("The group wasn't found. Verify the group and try again.")); } /** @@ -289,6 +290,6 @@ private function detectStoreById(array $data, $storeId) } } - throw new NotFoundException(__('Store was not found')); + throw new NotFoundException(__("The store wasn't found. Verify the store and try again.")); } } diff --git a/app/code/Magento/Store/Model/Config/Importer/Processor/ProcessorFactory.php b/app/code/Magento/Store/Model/Config/Importer/Processor/ProcessorFactory.php index 796d3849a740f..3af10deb69590 100644 --- a/app/code/Magento/Store/Model/Config/Importer/Processor/ProcessorFactory.php +++ b/app/code/Magento/Store/Model/Config/Importer/Processor/ProcessorFactory.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Store\Model\Config\Importer\Processor; use Magento\Framework\Exception\ConfigurationMismatchException; @@ -57,7 +58,9 @@ public function __construct( public function create($processorName) { if (!isset($this->processors[$processorName])) { - throw new ConfigurationMismatchException(__('Class for type "%1" was not declared', $processorName)); + throw new ConfigurationMismatchException( + __('The class for "%1" type wasn\'t declared. Enter the class and try again.', $processorName) + ); } $object = $this->objectManager->create($this->processors[$processorName]); diff --git a/app/code/Magento/Store/Model/Resolver/Group.php b/app/code/Magento/Store/Model/Resolver/Group.php index 3235b9c61a8bd..fba1701a53fdd 100644 --- a/app/code/Magento/Store/Model/Resolver/Group.php +++ b/app/code/Magento/Store/Model/Resolver/Group.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Store\Model\Resolver; use Magento\Framework\App\ScopeInterface; @@ -33,7 +34,7 @@ public function getScope($scopeId = null) { $scope = $this->storeManager->getGroup($scopeId); if (!$scope instanceof ScopeInterface) { - throw new InitException(__('Invalid scope object')); + throw new InitException(__('The scope object is invalid. Verify the scope object and try again.')); } return $scope; diff --git a/app/code/Magento/Store/Model/Resolver/Store.php b/app/code/Magento/Store/Model/Resolver/Store.php index afbe10d8e25cb..c01e49cd644a5 100644 --- a/app/code/Magento/Store/Model/Resolver/Store.php +++ b/app/code/Magento/Store/Model/Resolver/Store.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Store\Model\Resolver; class Store implements \Magento\Framework\App\ScopeResolverInterface @@ -28,7 +29,9 @@ public function getScope($scopeId = null) { $scope = $this->_storeManager->getStore($scopeId); if (!$scope instanceof \Magento\Framework\App\ScopeInterface) { - throw new \Magento\Framework\Exception\State\InitException(__('Invalid scope object')); + throw new \Magento\Framework\Exception\State\InitException( + __('The scope object is invalid. Verify the scope object and try again.') + ); } return $scope; diff --git a/app/code/Magento/Store/Model/Resolver/Website.php b/app/code/Magento/Store/Model/Resolver/Website.php index a8b88551d5e9d..87c2664bd1022 100644 --- a/app/code/Magento/Store/Model/Resolver/Website.php +++ b/app/code/Magento/Store/Model/Resolver/Website.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Store\Model\Resolver; class Website implements \Magento\Framework\App\ScopeResolverInterface @@ -29,7 +30,9 @@ public function getScope($scopeId = null) { $scope = $this->_storeManager->getWebsite($scopeId); if (!($scope instanceof \Magento\Framework\App\ScopeInterface)) { - throw new \Magento\Framework\Exception\State\InitException(__('Invalid scope object')); + throw new \Magento\Framework\Exception\State\InitException( + __('The scope object is invalid. Verify the scope object and try again.') + ); } return $scope; diff --git a/app/code/Magento/Store/Model/StoreRepository.php b/app/code/Magento/Store/Model/StoreRepository.php index 35871312da816..7e6773c2d24a3 100644 --- a/app/code/Magento/Store/Model/StoreRepository.php +++ b/app/code/Magento/Store/Model/StoreRepository.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Store\Model; use Magento\Framework\App\ObjectManager; @@ -71,7 +72,9 @@ public function get($code) ]); if ($store->getId() === null) { - throw new NoSuchEntityException(__('Requested store is not found')); + throw new NoSuchEntityException( + __("The store that was requested wasn't found. Verify the store and try again.") + ); } $this->entities[$code] = $store; $this->entitiesById[$store->getId()] = $store; @@ -106,7 +109,9 @@ public function getById($id) ]); if ($store->getId() === null) { - throw new NoSuchEntityException(__('Requested store is not found')); + throw new NoSuchEntityException( + __("The store that was requested wasn't found. Verify the store and try again.") + ); } $this->entitiesById[$id] = $store; diff --git a/app/code/Magento/Store/Model/WebsiteRepository.php b/app/code/Magento/Store/Model/WebsiteRepository.php index 94fd59c7634df..b58936c32f593 100644 --- a/app/code/Magento/Store/Model/WebsiteRepository.php +++ b/app/code/Magento/Store/Model/WebsiteRepository.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Store\Model; use Magento\Framework\App\ObjectManager; @@ -141,7 +142,7 @@ public function getDefault() $this->initDefaultWebsite(); } if (!$this->default) { - throw new \DomainException(__('Default website is not defined')); + throw new \DomainException(__("The default website isn't defined. Set the website and try again.")); } } @@ -183,7 +184,12 @@ private function initDefaultWebsite() foreach ($websites as $data) { if (isset($data['is_default']) && $data['is_default'] == 1) { if ($this->default) { - throw new \DomainException(__('More than one default website is defined')); + throw new \DomainException( + __( + 'The default website is invalid. ' + . 'Make sure no more than one default is defined and try again.' + ) + ); } $website = $this->factory->create([ 'data' => $data diff --git a/app/code/Magento/Store/Test/Unit/Model/Config/Importer/Processor/ProcessorFactoryTest.php b/app/code/Magento/Store/Test/Unit/Model/Config/Importer/Processor/ProcessorFactoryTest.php index b1042aea78add..7de97407ebc19 100644 --- a/app/code/Magento/Store/Test/Unit/Model/Config/Importer/Processor/ProcessorFactoryTest.php +++ b/app/code/Magento/Store/Test/Unit/Model/Config/Importer/Processor/ProcessorFactoryTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Store\Test\Unit\Model\Config\Importer\Processor; use Magento\Framework\ObjectManagerInterface; @@ -62,7 +63,7 @@ public function testCreate() /** * @expectedException \Magento\Framework\Exception\ConfigurationMismatchException - * @expectedExceptionMessage Class for type "dummyType" was not declared + * @expectedExceptionMessage The class for "dummyType" type wasn't declared. Enter the class and try again. */ public function testCreateNonExisted() { diff --git a/app/code/Magento/Store/Test/Unit/Model/StoreRepositoryTest.php b/app/code/Magento/Store/Test/Unit/Model/StoreRepositoryTest.php index 03b886459a7cc..59a433a76a08b 100644 --- a/app/code/Magento/Store/Test/Unit/Model/StoreRepositoryTest.php +++ b/app/code/Magento/Store/Test/Unit/Model/StoreRepositoryTest.php @@ -76,7 +76,7 @@ private function initDistroList() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Requested store is not found + * @expectedExceptionMessage The store that was requested wasn't found. Verify the store and try again. */ public function testGetWithException() { @@ -128,7 +128,7 @@ public function testGetByIdWithAvailableStoreFromScope() /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage Requested store is not found + * @expectedExceptionMessage The store that was requested wasn't found. Verify the store and try again. */ public function testGetByIdWithException() { diff --git a/app/code/Magento/Store/Test/Unit/Model/WebsiteRepositoryTest.php b/app/code/Magento/Store/Test/Unit/Model/WebsiteRepositoryTest.php index 80e4973bbe7fe..bd8ac4b6048cf 100644 --- a/app/code/Magento/Store/Test/Unit/Model/WebsiteRepositoryTest.php +++ b/app/code/Magento/Store/Test/Unit/Model/WebsiteRepositoryTest.php @@ -94,7 +94,6 @@ public function testGetDefault() /** * @expectedException \DomainException - * @expectedExceptionMessage More than one default website is defined */ public function testGetDefaultIsSeveral() { @@ -118,11 +117,15 @@ public function testGetDefaultIsSeveral() $this->websiteFactoryMock->expects($this->any())->method('create')->willReturn($websiteMock); $this->model->getDefault(); + + $this->expectExceptionMessage( + "The default website is invalid. Make sure no more than one default is defined and try again." + ); } /** * @expectedException \DomainException - * @expectedExceptionMessage Default website is not defined + * @expectedExceptionMessage The default website isn't defined. Set the website and try again. */ public function testGetDefaultIsZero() { diff --git a/app/code/Magento/Swagger/view/frontend/templates/swagger-ui/index.phtml b/app/code/Magento/Swagger/view/frontend/templates/swagger-ui/index.phtml index 6e8ad08efbf6b..27b3767f274bc 100644 --- a/app/code/Magento/Swagger/view/frontend/templates/swagger-ui/index.phtml +++ b/app/code/Magento/Swagger/view/frontend/templates/swagger-ui/index.phtml @@ -12,7 +12,7 @@ * Modified by Magento, Modifications Copyright © Magento, Inc. All rights reserved. */ -/** @var \Magento\Framework\View\Element\Template $block */ +/** @var \Magento\Swagger\Block\Index $block */ $schemaUrl = $block->getSchemaUrl(); ?> diff --git a/app/code/Magento/Swatches/Helper/Media.php b/app/code/Magento/Swatches/Helper/Media.php index c04b0ca945cec..baa90343cc4ab 100644 --- a/app/code/Magento/Swatches/Helper/Media.php +++ b/app/code/Magento/Swatches/Helper/Media.php @@ -68,9 +68,9 @@ class Media extends \Magento\Framework\App\Helper\AbstractHelper protected $swatchImageTypes = ['swatch_image', 'swatch_thumb']; /** - * @var \Magento\Theme\Model\ResourceModel\Theme\Collection + * @var array */ - private $registeredThemesCache; + private $imageConfig; /** * @param \Magento\Catalog\Model\Product\Media\Config $mediaConfig @@ -256,18 +256,14 @@ public function getFolderNameSize($swatchType, $imageConfig = null) */ public function getImageConfig() { - $imageConfig = []; - foreach ($this->getRegisteredThemes() as $theme) { - $config = $this->viewConfig->getViewConfig([ - 'area' => Area::AREA_FRONTEND, - 'themeModel' => $theme, - ]); - $imageConfig = array_merge( - $imageConfig, - $config->getMediaEntities('Magento_Catalog', Image::MEDIA_TYPE_CONFIG_NODE) + if (!$this->imageConfig) { + $this->imageConfig = $this->viewConfig->getViewConfig()->getMediaEntities( + 'Magento_Catalog', + Image::MEDIA_TYPE_CONFIG_NODE ); } - return $imageConfig; + + return $this->imageConfig; } /** @@ -338,16 +334,4 @@ protected function prepareFile($file) { return ltrim(str_replace('\\', '/', $file), '/'); } - - /** - * @return \Magento\Theme\Model\ResourceModel\Theme\Collection - */ - private function getRegisteredThemes() - { - if ($this->registeredThemesCache === null) { - $this->registeredThemesCache = $this->themeCollection->loadRegisteredThemes(); - } - - return $this->registeredThemesCache; - } } diff --git a/app/code/Magento/Swatches/Test/Unit/Helper/MediaTest.php b/app/code/Magento/Swatches/Test/Unit/Helper/MediaTest.php index 920c35e44ebde..7ecfeab53b90d 100644 --- a/app/code/Magento/Swatches/Test/Unit/Helper/MediaTest.php +++ b/app/code/Magento/Swatches/Test/Unit/Helper/MediaTest.php @@ -30,9 +30,6 @@ class MediaTest extends \PHPUnit\Framework\TestCase /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Image\Factory */ protected $imageFactoryMock; - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Theme\Model\ResourceModel\Theme\Collection */ - protected $themeCollectionMock; - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\View\Config */ protected $viewConfigMock; @@ -59,10 +56,6 @@ protected function setUp() $this->storeManagerMock = $this->createPartialMock(\Magento\Store\Model\StoreManager::class, ['getStore']); $this->imageFactoryMock = $this->createMock(\Magento\Framework\Image\Factory::class); - $this->themeCollectionMock = $this->createPartialMock( - \Magento\Theme\Model\ResourceModel\Theme\Collection::class, - ['loadRegisteredThemes'] - ); $this->viewConfigMock = $this->createMock(\Magento\Framework\View\Config::class); @@ -83,7 +76,6 @@ protected function setUp() 'fileStorageDb' => $this->fileStorageDbMock, 'storeManager' => $this->storeManagerMock, 'imageFactory' => $this->imageFactoryMock, - 'themeCollection' => $this->themeCollectionMock, 'configInterface' => $this->viewConfigMock, ] ); @@ -248,10 +240,6 @@ public function testGetImageConfig() protected function generateImageConfig() { - $themeMock = $this->createMock(\Magento\Theme\Model\Theme::class); - $themesArrayMock = [$themeMock]; - $this->themeCollectionMock->expects($this->any())->method('loadRegisteredThemes')->willReturn($themesArrayMock); - $configMock = $this->createMock(\Magento\Framework\Config\View::class); $this->viewConfigMock diff --git a/app/code/Magento/Tax/Model/Calculation/Rate.php b/app/code/Magento/Tax/Model/Calculation/Rate.php index 1930ee8ec380d..e848afd7f3eca 100644 --- a/app/code/Magento/Tax/Model/Calculation/Rate.php +++ b/app/code/Magento/Tax/Model/Calculation/Rate.php @@ -124,13 +124,13 @@ public function beforeSave() if ($isEmptyValues || $isWrongRange) { throw new \Magento\Framework\Exception\LocalizedException( - __('Make sure all required information is valid.') + __('The required information is invalid. Verify the information and try again.') ); } if (!is_numeric($this->getRate()) || $this->getRate() < 0) { throw new \Magento\Framework\Exception\LocalizedException( - __('The Rate Percent should be a positive number.') + __('The Rate Percent is invalid. Enter a positive number and try again.') ); } @@ -139,12 +139,17 @@ public function beforeSave() $zipTo = $this->getZipTo(); if (strlen($zipFrom) > 9 || strlen($zipTo) > 9) { - throw new \Magento\Framework\Exception\LocalizedException(__('Maximum zip code length is 9.')); + throw new \Magento\Framework\Exception\LocalizedException( + __( + 'The ZIP Code length is invalid. ' + . 'Verify that the length is nine characters or fewer and try again.' + ) + ); } if (!is_numeric($zipFrom) || !is_numeric($zipTo) || $zipFrom < 0 || $zipTo < 0) { throw new \Magento\Framework\Exception\LocalizedException( - __('Use digits only for the zip code.') + __('The ZIP Code is invalid. Use numbers only.') ); } @@ -199,7 +204,7 @@ public function beforeDelete() { if ($this->_isInRule()) { throw new CouldNotDeleteException( - __('The tax rate cannot be removed. It exists in a tax rule.') + __("The tax rate can't be removed because it exists in a tax rule.") ); } return parent::beforeDelete(); diff --git a/app/code/Magento/Tax/Model/Calculation/RateRepository.php b/app/code/Magento/Tax/Model/Calculation/RateRepository.php index 3e7c24ce81015..f8afdf625fd87 100644 --- a/app/code/Magento/Tax/Model/Calculation/RateRepository.php +++ b/app/code/Magento/Tax/Model/Calculation/RateRepository.php @@ -232,7 +232,7 @@ private function validate(\Magento\Tax\Api\Data\TaxRateInterface $taxRate) $countryCode = $taxRate->getTaxCountryId(); if (!\Zend_Validate::is($countryCode, 'NotEmpty')) { - $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'country_id'])); + $exception->addError(__('"%fieldName" is required. Enter and try again.', ['fieldName' => 'country_id'])); } elseif (!\Zend_Validate::is( $this->countryFactory->create()->loadByCode($countryCode)->getId(), 'NotEmpty' @@ -265,11 +265,13 @@ private function validate(\Magento\Tax\Api\Data\TaxRateInterface $taxRate) } if (!is_numeric($taxRate->getRate()) || $taxRate->getRate() < 0) { - $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'percentage_rate'])); + $exception->addError( + __('"%fieldName" is required. Enter and try again.', ['fieldName' => 'percentage_rate']) + ); } if (!\Zend_Validate::is(trim($taxRate->getCode()), 'NotEmpty')) { - $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'code'])); + $exception->addError(__('"%fieldName" is required. Enter and try again.', ['fieldName' => 'code'])); } if ($taxRate->getZipIsRange()) { @@ -292,7 +294,7 @@ private function validate(\Magento\Tax\Api\Data\TaxRateInterface $taxRate) } } else { if (!\Zend_Validate::is(trim($taxRate->getTaxPostcode()), 'NotEmpty')) { - $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'postcode'])); + $exception->addError(__('"%fieldName" is required. Enter and try again.', ['fieldName' => 'postcode'])); } } diff --git a/app/code/Magento/Tax/Model/Calculation/Rule/Validator.php b/app/code/Magento/Tax/Model/Calculation/Rule/Validator.php index 75923748e14cf..2149a0c3c3ca2 100644 --- a/app/code/Magento/Tax/Model/Calculation/Rule/Validator.php +++ b/app/code/Magento/Tax/Model/Calculation/Rule/Validator.php @@ -43,7 +43,11 @@ public function isValid($value) // Position is required and must be 0 or greater if (!\Zend_Validate::is(trim($value->getPosition()), 'NotEmpty')) { - $this->addErrorMessage($messages, '%fieldName is a required field.', ['fieldName' => 'position']); + $this->addErrorMessage( + $messages, + '"%fieldName" is required. Enter and try again.', + ['fieldName' => 'position'] + ); } if (!\Zend_Validate::is(trim($value->getPosition()), 'GreaterThan', [-1])) { $this->addErrorMessage( @@ -55,7 +59,11 @@ public function isValid($value) // Priority is required and must be 0 or greater if (!\Zend_Validate::is(trim($value->getPriority()), 'NotEmpty')) { - $this->addErrorMessage($messages, '%fieldName is a required field.', ['fieldName' => 'priority']); + $this->addErrorMessage( + $messages, + '"%fieldName" is required. Enter and try again.', + ['fieldName' => 'priority'] + ); } if (!\Zend_Validate::is(trim($value->getPriority()), 'GreaterThan', [-1])) { $this->addErrorMessage( @@ -67,14 +75,18 @@ public function isValid($value) // Code is required if (!\Zend_Validate::is(trim($value->getCode()), 'NotEmpty')) { - $this->addErrorMessage($messages, '%fieldName is a required field.', ['fieldName' => 'code']); + $this->addErrorMessage( + $messages, + '"%fieldName" is required. Enter and try again.', + ['fieldName' => 'code'] + ); } // customer tax class ids is required if (($value->getCustomerTaxClassIds() === null) || !$value->getCustomerTaxClassIds()) { $this->addErrorMessage( $messages, - '%fieldName is a required field.', + '"%fieldName" is required. Enter and try again.', ['fieldName' => 'customer_tax_class_ids'] ); } else { // see if the customer tax class ids exist @@ -106,7 +118,7 @@ public function isValid($value) if (($value->getProductTaxClassIds() === null) || !$value->getProductTaxClassIds()) { $this->addErrorMessage( $messages, - '%fieldName is a required field.', + '"%fieldName" is required. Enter and try again.', ['fieldName' => 'product_tax_class_ids'] ); } else { // see if the product tax class ids exist @@ -136,7 +148,11 @@ public function isValid($value) // tax rate ids is required if (($value->getTaxRateIds() === null) || !$value->getTaxRateIds()) { - $this->addErrorMessage($messages, '%fieldName is a required field.', ['fieldName' => 'tax_rate_ids']); + $this->addErrorMessage( + $messages, + '"%fieldName" is required. Enter and try again.', + ['fieldName' => 'tax_rate_ids'] + ); } $this->_addMessages($messages); return empty($messages); diff --git a/app/code/Magento/Tax/Model/TaxClass/Repository.php b/app/code/Magento/Tax/Model/TaxClass/Repository.php index 245fc6964c205..cfb8f82cf0f11 100644 --- a/app/code/Magento/Tax/Model/TaxClass/Repository.php +++ b/app/code/Magento/Tax/Model/TaxClass/Repository.php @@ -179,12 +179,16 @@ protected function validateTaxClassData(\Magento\Tax\Api\Data\TaxClassInterface $exception = new InputException(); if (!\Zend_Validate::is(trim($taxClass->getClassName()), 'NotEmpty')) { - $exception->addError(__('%fieldName is a required field.', ['fieldName' => ClassModel::KEY_NAME])); + $exception->addError( + __('"%fieldName" is required. Enter and try again.', ['fieldName' => ClassModel::KEY_NAME]) + ); } $classType = $taxClass->getClassType(); if (!\Zend_Validate::is(trim($classType), 'NotEmpty')) { - $exception->addError(__('%fieldName is a required field.', ['fieldName' => ClassModel::KEY_TYPE])); + $exception->addError( + __('"%fieldName" is required. Enter and try again.', ['fieldName' => ClassModel::KEY_TYPE]) + ); } elseif ($classType !== TaxClassManagementInterface::TYPE_CUSTOMER && $classType !== TaxClassManagementInterface::TYPE_PRODUCT ) { diff --git a/app/code/Magento/Tax/Test/Unit/Model/Calculation/RateRepositoryTest.php b/app/code/Magento/Tax/Test/Unit/Model/Calculation/RateRepositoryTest.php index db2053efd41f6..82a1f1803e903 100644 --- a/app/code/Magento/Tax/Test/Unit/Model/Calculation/RateRepositoryTest.php +++ b/app/code/Magento/Tax/Test/Unit/Model/Calculation/RateRepositoryTest.php @@ -391,7 +391,7 @@ public function testValidate() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage percentage_rate is a required field. + * @expectedExceptionMessage "percentage_rate" is required. Enter and try again. */ public function testValidateWithNoRate() { @@ -429,7 +429,7 @@ public function testValidateWithNoRate() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage percentage_rate is a required field. + * @expectedExceptionMessage "percentage_rate" is required. Enter and try again. */ public function testValidateWithWrongRate() { diff --git a/app/code/Magento/Tax/Test/Unit/Model/Calculation/RateTest.php b/app/code/Magento/Tax/Test/Unit/Model/Calculation/RateTest.php index 5a5abfd828d88..4edb0328b73c2 100644 --- a/app/code/Magento/Tax/Test/Unit/Model/Calculation/RateTest.php +++ b/app/code/Magento/Tax/Test/Unit/Model/Calculation/RateTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Tax\Test\Unit\Model\Calculation; class RateTest extends \PHPUnit\Framework\TestCase @@ -66,33 +67,77 @@ public function exceptionOfValidationDataProvider() { return [ 'fill all required fields 1' => [ - 'exceptionMessage' => 'Make sure all required information is valid.', - 'data' => ['zip_is_range' => true, 'zip_from' => '0111', 'zip_to' => '', - 'code' => '', 'tax_country_id' => '', 'rate' => '', 'tax_postcode' => '', ], + 'exceptionMessage' => 'The required information is invalid. Verify the information and try again.', + 'data' => [ + 'zip_is_range' => true, + 'zip_from' => '0111', + 'zip_to' => '', + 'code' => '', + 'tax_country_id' => '', + 'rate' => '', + 'tax_postcode' => '', + ], ], 'fill all required fields 2' => [ - 'exceptionMessage' => 'Make sure all required information is valid.', - 'data' => ['zip_is_range' => '', 'zip_from' => '', 'zip_to' => '', - 'code' => '', 'tax_country_id' => '', 'rate' => '0.2', 'tax_postcode' => '1234', ], ], + 'exceptionMessage' => 'The required information is invalid. Verify the information and try again.', + 'data' => [ + 'zip_is_range' => '', + 'zip_from' => '', + 'zip_to' => '', + 'code' => '', + 'tax_country_id' => '', + 'rate' => '0.2', + 'tax_postcode' => '1234', + ], + ], 'positive number' => [ - 'exceptionMessage' => 'The Rate Percent should be a positive number.', - 'data' => ['zip_is_range' => '', 'zip_from' => '', 'zip_to' => '', 'code' => 'code', - 'tax_country_id' => 'US', 'rate' => '-1', 'tax_postcode' => '1234', ], + 'exceptionMessage' => 'The Rate Percent is invalid. Enter a positive number and try again.', + 'data' => [ + 'zip_is_range' => '', + 'zip_from' => '', + 'zip_to' => '', + 'code' => 'code', + 'tax_country_id' => 'US', + 'rate' => '-1', + 'tax_postcode' => '1234', + ], ], 'zip code length' => [ - 'exceptionMessage' => 'Maximum zip code length is 9.', - 'data' => ['zip_is_range' => true, 'zip_from' => '1234567890', 'zip_to' => '1234', - 'code' => 'code', 'tax_country_id' => 'US', 'rate' => '1.1', 'tax_postcode' => '1234', ], + 'exceptionMessage' => 'The ZIP Code length is invalid. ' + . 'Verify that the length is nine characters or fewer and try again.', + 'data' => [ + 'zip_is_range' => true, + 'zip_from' => '1234567890', + 'zip_to' => '1234', + 'code' => 'code', + 'tax_country_id' => 'US', + 'rate' => '1.1', + 'tax_postcode' => '1234', + ], ], 'contain characters' => [ - 'exceptionMessage' => 'Use digits only for the zip code.', - 'data' => ['zip_is_range' => true, 'zip_from' => 'foo', 'zip_to' => '1234', 'code' => 'code', - 'tax_country_id' => 'US', 'rate' => '1.1', 'tax_postcode' => '1234', ], + 'exceptionMessage' => 'The ZIP Code is invalid. Use numbers only.', + 'data' => [ + 'zip_is_range' => true, + 'zip_from' => 'foo', + 'zip_to' => '1234', + 'code' => 'code', + 'tax_country_id' => 'US', + 'rate' => '1.1', + 'tax_postcode' => '1234', + ], ], 'equal or greater' => [ 'exceptionMessage' => 'Range To should be equal or greater than Range From.', - 'data' => ['zip_is_range' => true, 'zip_from' => '321', 'zip_to' => '123', 'code' => 'code', - 'tax_country_id' => 'US', 'rate' => '1.1', 'tax_postcode' => '1234', ], + 'data' => [ + 'zip_is_range' => true, + 'zip_from' => '321', + 'zip_to' => '123', + 'code' => 'code', + 'tax_country_id' => 'US', + 'rate' => '1.1', + 'tax_postcode' => '1234', + ], ], ]; } diff --git a/app/code/Magento/Theme/Model/Data/Design/ConfigFactory.php b/app/code/Magento/Theme/Model/Data/Design/ConfigFactory.php index 84aae4f7e51fe..e0b77a1657447 100644 --- a/app/code/Magento/Theme/Model/Data/Design/ConfigFactory.php +++ b/app/code/Magento/Theme/Model/Data/Design/ConfigFactory.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Theme\Model\Data\Design; use Magento\Framework\App\ScopeValidatorInterface; @@ -88,7 +89,7 @@ public function __construct( public function create($scope, $scopeId, array $data = []) { if (!$this->scopeValidator->isValidScope($scope, $scopeId)) { - throw new LocalizedException(__('Invalid scope or scope id')); + throw new LocalizedException(__('The scope or scope ID is invalid. Verify both and try again.')); } $designConfigData = $this->getDesignConfigData($scope, $scopeId); diff --git a/app/code/Magento/Theme/Model/Design/Config/FileUploader/FileProcessor.php b/app/code/Magento/Theme/Model/Design/Config/FileUploader/FileProcessor.php index 1e574d525b457..ecf5bcbea6dfc 100644 --- a/app/code/Magento/Theme/Model/Design/Config/FileUploader/FileProcessor.php +++ b/app/code/Magento/Theme/Model/Design/Config/FileUploader/FileProcessor.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Theme\Model\Design\Config\FileUploader; use Magento\Framework\Exception\LocalizedException; @@ -160,7 +161,7 @@ protected function getBackendModel($code) { $metadata = $this->metadataProvider->get(); if (!(isset($metadata[$code]) && isset($metadata[$code]['backend_model']))) { - throw new LocalizedException(__('Backend model is not specified for %1', $code)); + throw new LocalizedException(__('The backend model isn\'t specified for "%1".', $code)); } return $this->backendModelFactory->createByPath($metadata[$code]['path']); } diff --git a/app/code/Magento/Theme/Model/Design/Config/Validator.php b/app/code/Magento/Theme/Model/Design/Config/Validator.php index 8ac36a31d2ef5..9fed5be6201b4 100644 --- a/app/code/Magento/Theme/Model/Design/Config/Validator.php +++ b/app/code/Magento/Theme/Model/Design/Config/Validator.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Theme\Model\Design\Config; use \Magento\Framework\Exception\LocalizedException; @@ -74,8 +75,8 @@ public function validate(DesignConfigInterface $designConfig) if (isset($params['config_path']) && $params['config_path'] == $data['config_path']) { throw new LocalizedException( __( - "The %templateName contains an incorrect configuration. The template has " . - "a reference to itself. Either remove or change the reference.", + 'The "%templateName" template contains an incorrect configuration, with a reference ' + . 'to itself. Remove or change the reference, then try again.', ["templateName" => $name] ) ); diff --git a/app/code/Magento/Theme/Model/DesignConfigRepository.php b/app/code/Magento/Theme/Model/DesignConfigRepository.php index 9664a4eb6fa79..3a81b8c24b455 100644 --- a/app/code/Magento/Theme/Model/DesignConfigRepository.php +++ b/app/code/Magento/Theme/Model/DesignConfigRepository.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Theme\Model; use Magento\Framework\Indexer\IndexerRegistry; @@ -85,7 +86,9 @@ public function save(DesignConfigInterface $designConfig) if (!($designConfig->getExtensionAttributes() && $designConfig->getExtensionAttributes()->getDesignConfigData()) ) { - throw new LocalizedException(__('Can not save empty config')); + throw new LocalizedException( + __("The config can't be saved because it's empty. Complete the config and try again.") + ); } $this->getValidator()->validate($designConfig); @@ -105,7 +108,9 @@ public function delete(DesignConfigInterface $designConfig) if (!($designConfig->getExtensionAttributes() && $designConfig->getExtensionAttributes()->getDesignConfigData()) ) { - throw new LocalizedException(__('Can not save empty config')); + throw new LocalizedException( + __("The config can't be saved because it's empty. Complete the config and try again.") + ); } $this->configStorage->delete($designConfig); diff --git a/app/code/Magento/Theme/Test/Unit/Model/Config/ValidatorTest.php b/app/code/Magento/Theme/Test/Unit/Model/Config/ValidatorTest.php index 4dbc96d84d187..4a1a1982ea653 100644 --- a/app/code/Magento/Theme/Test/Unit/Model/Config/ValidatorTest.php +++ b/app/code/Magento/Theme/Test/Unit/Model/Config/ValidatorTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Theme\Test\Unit\Model\Config; /** @@ -39,7 +40,6 @@ protected function setUp() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage The email_header_template contains an incorrect configuration. The template has a */ public function testValidateHasRecursiveReference() { @@ -79,6 +79,11 @@ public function testValidateHasRecursiveReference() ); $this->model->validate($designConfigMock); + + $this->expectExceptionMessage( + 'The "email_header_template" template contains an incorrect configuration, with a reference to itself. ' + . 'Remove or change the reference, then try again.' + ); } public function testValidateNoRecursiveReference() diff --git a/app/code/Magento/Theme/Test/Unit/Model/DesignConfigRepositoryTest.php b/app/code/Magento/Theme/Test/Unit/Model/DesignConfigRepositoryTest.php index b8c72867e8cc2..7ed4f5f656822 100644 --- a/app/code/Magento/Theme/Test/Unit/Model/DesignConfigRepositoryTest.php +++ b/app/code/Magento/Theme/Test/Unit/Model/DesignConfigRepositoryTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Theme\Test\Unit\Model; use Magento\Theme\Model\Data\Design\Config; @@ -115,7 +116,7 @@ public function testSave() } /** - * @expectedExceptionMessage Can not save empty config + * @expectedExceptionMessage The config can't be saved because it's empty. Complete the config and try again. * @expectedException \Magento\Framework\Exception\LocalizedException */ public function testSaveWithoutConfig() diff --git a/app/code/Magento/Ui/Component/Form/Field.php b/app/code/Magento/Ui/Component/Form/Field.php index 48ca012f56953..e7a627743b63a 100644 --- a/app/code/Magento/Ui/Component/Form/Field.php +++ b/app/code/Magento/Ui/Component/Form/Field.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Ui\Component\Form; use Magento\Framework\Exception\LocalizedException; @@ -73,7 +74,7 @@ public function prepare() $formElement = $this->getData('config/formElement'); if (null === $formElement) { throw new LocalizedException(__( - 'The configuration parameter "formElement" is a required for "%1" field.', + 'The "formElement" configuration parameter is required for the "%1" field.', $this->getName() )); } diff --git a/app/code/Magento/Ui/Component/MassAction/Filter.php b/app/code/Magento/Ui/Component/MassAction/Filter.php index 6b089233c210a..6877303f5c491 100644 --- a/app/code/Magento/Ui/Component/MassAction/Filter.php +++ b/app/code/Magento/Ui/Component/MassAction/Filter.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Ui\Component\MassAction; use Magento\Framework\Api\FilterBuilder; @@ -95,7 +96,7 @@ public function getCollection(AbstractDb $collection) if ('false' !== $excluded) { if (!$isExcludedIdsValid && !$isSelectedIdsValid) { - throw new LocalizedException(__('Please select item(s).')); + throw new LocalizedException(__('An item needs to be selected. Select and try again.')); } } /** @var \Magento\Customer\Model\ResourceModel\Customer\Collection $collection */ @@ -162,7 +163,7 @@ protected function applySelection(AbstractDb $collection) } elseif (is_array($selected) && !empty($selected)) { $collection->addFieldToFilter($collection->getIdFieldName(), ['in' => $selected]); } else { - throw new LocalizedException(__('Please select item(s).')); + throw new LocalizedException(__('An item needs to be selected. Select and try again.')); } } catch (\Exception $e) { throw new LocalizedException(__($e->getMessage())); diff --git a/app/code/Magento/Ui/Config/Reader.php b/app/code/Magento/Ui/Config/Reader.php index 8ff779f63d6e1..f7a781d103c05 100644 --- a/app/code/Magento/Ui/Config/Reader.php +++ b/app/code/Magento/Ui/Config/Reader.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Ui\Config; use Magento\Framework\Config\ConverterInterface as ConfigConverter; @@ -125,7 +126,12 @@ private function readFiles($fileList) ); $output = array_replace_recursive($output, $this->converter->convert($configMerger->getDom())); } catch (ValidationException $e) { - throw new LocalizedException(new Phrase("Invalid XML in file %1:\n%2", [$key, $e->getMessage()])); + throw new LocalizedException( + new Phrase( + 'The XML in file "%1" is invalid:' . "\n%2\nVerify the XML and try again.", + [$key, $e->getMessage()] + ) + ); } } diff --git a/app/code/Magento/Ui/Config/Reader/Definition.php b/app/code/Magento/Ui/Config/Reader/Definition.php index d4a53c584308e..782a75187190b 100644 --- a/app/code/Magento/Ui/Config/Reader/Definition.php +++ b/app/code/Magento/Ui/Config/Reader/Definition.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Ui\Config\Reader; use Magento\Framework\Config\Dom\ValidationException; @@ -53,7 +54,10 @@ private function readFiles($fileList) } } catch (ValidationException $e) { throw new LocalizedException( - new Phrase("Invalid XML in file %1:\n%2", [$key, $e->getMessage()]) + new Phrase( + 'The XML in file "%1" is invalid.' . "\n%2\nVerify the XML and try again.", + [$key, $e->getMessage()] + ) ); } } diff --git a/app/code/Magento/Ui/DataProvider/Modifier/Pool.php b/app/code/Magento/Ui/DataProvider/Modifier/Pool.php index e8ac4d9b362ec..34a24499834d2 100644 --- a/app/code/Magento/Ui/DataProvider/Modifier/Pool.php +++ b/app/code/Magento/Ui/DataProvider/Modifier/Pool.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Ui\DataProvider\Modifier; use Magento\Framework\Exception\LocalizedException; @@ -63,11 +64,13 @@ public function getModifiersInstances() foreach ($this->modifiers as $modifier) { if (empty($modifier['class'])) { - throw new LocalizedException(__('Parameter "class" must be present.')); + throw new LocalizedException(__('The parameter "class" is missing. Set the "class" and try again.')); } if (empty($modifier['sortOrder'])) { - throw new LocalizedException(__('Parameter "sortOrder" must be present.')); + throw new LocalizedException( + __('The parameter "sortOrder" is missing. Set the "sortOrder" and try again.') + ); } $this->modifiersInstances[$modifier['class']] = $this->factory->create($modifier['class']); diff --git a/app/code/Magento/Ui/Model/Manager.php b/app/code/Magento/Ui/Model/Manager.php index 6dca4632fe7fc..e3c56418c8425 100644 --- a/app/code/Magento/Ui/Model/Manager.php +++ b/app/code/Magento/Ui/Model/Manager.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Ui\Model; use ArrayObject; @@ -165,7 +166,10 @@ public function prepareData($name) { if ($name === null || $this->hasData($name)) { throw new LocalizedException( - new \Magento\Framework\Phrase("Invalid UI Component element name: '%1'", [$name]) + new \Magento\Framework\Phrase( + 'The "%1" UI component element name is invalid. Verify the name and try again.', + [$name] + ) ); } $this->componentsPool = $this->arrayObjectFactory->create(); diff --git a/app/code/Magento/Ui/Model/ResourceModel/BookmarkRepository.php b/app/code/Magento/Ui/Model/ResourceModel/BookmarkRepository.php index 1b03b7c402680..3e738baa404c8 100644 --- a/app/code/Magento/Ui/Model/ResourceModel/BookmarkRepository.php +++ b/app/code/Magento/Ui/Model/ResourceModel/BookmarkRepository.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Ui\Model\ResourceModel; use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; @@ -91,7 +92,9 @@ public function getById($bookmarkId) $bookmark = $this->bookmarkFactory->create(); $this->bookmarkResourceModel->load($bookmark, $bookmarkId); if (!$bookmark->getId()) { - throw new NoSuchEntityException(__('Bookmark with id "%1" does not exist.', $bookmarkId)); + throw new NoSuchEntityException( + __('The bookmark with "%1" ID doesn\'t exist. Verify your information and try again.', $bookmarkId) + ); } return $bookmark; } diff --git a/app/code/Magento/Ui/Test/Unit/Component/Form/FieldTest.php b/app/code/Magento/Ui/Test/Unit/Component/Form/FieldTest.php index 02db643c321d8..d794208f95778 100644 --- a/app/code/Magento/Ui/Test/Unit/Component/Form/FieldTest.php +++ b/app/code/Magento/Ui/Test/Unit/Component/Form/FieldTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Ui\Test\Unit\Component\Form; use Magento\Ui\Component\Form\Field; @@ -169,7 +170,7 @@ protected function getComponentsMock() * @return void * * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage The configuration parameter "formElement" is a required for "test-name" field. + * @expectedExceptionMessage The "formElement" configuration parameter is required for the "test-name" field. */ public function testPrepareException() { diff --git a/app/code/Magento/Ui/Test/Unit/DataProvider/Modifier/PoolTest.php b/app/code/Magento/Ui/Test/Unit/DataProvider/Modifier/PoolTest.php index e411220596028..23e65d1f4c1cc 100644 --- a/app/code/Magento/Ui/Test/Unit/DataProvider/Modifier/PoolTest.php +++ b/app/code/Magento/Ui/Test/Unit/DataProvider/Modifier/PoolTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Ui\Test\Unit\DataProvider\Modifier; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; @@ -100,7 +101,7 @@ public function testWithFewmodifiers() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Parameter "sortOrder" must be present. + * @expectedExceptionMessage The parameter "sortOrder" is missing. Set the "sortOrder" and try again. */ public function testWithSortOrderException() { @@ -119,7 +120,7 @@ public function testWithSortOrderException() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Parameter "class" must be present. + * @expectedExceptionMessage The parameter "class" is missing. Set the "class" and try again. */ public function testWithClassException() { diff --git a/app/code/Magento/Ui/Test/Unit/Model/ManagerTest.php b/app/code/Magento/Ui/Test/Unit/Model/ManagerTest.php index 96468b63314b4..414f52037542d 100644 --- a/app/code/Magento/Ui/Test/Unit/Model/ManagerTest.php +++ b/app/code/Magento/Ui/Test/Unit/Model/ManagerTest.php @@ -154,7 +154,7 @@ public function testPrepareDataWithoutName() { $this->expectException( \Magento\Framework\Exception\LocalizedException::class, - __("Invalid UI Component element name: ''") + __('The "" UI component element name is invalid. Verify the name and try again.') ); $this->manager->prepareData(null); } diff --git a/app/code/Magento/Ui/Test/Unit/Model/ResourceModel/BookmarkRepositoryTest.php b/app/code/Magento/Ui/Test/Unit/Model/ResourceModel/BookmarkRepositoryTest.php index 00a88437c8cb1..5ba14d15f6b06 100644 --- a/app/code/Magento/Ui/Test/Unit/Model/ResourceModel/BookmarkRepositoryTest.php +++ b/app/code/Magento/Ui/Test/Unit/Model/ResourceModel/BookmarkRepositoryTest.php @@ -123,7 +123,7 @@ public function testGetByIdWithException() ->willReturn($this->bookmarkMock); $this->expectException( \Magento\Framework\Exception\NoSuchEntityException::class, - __('Bookmark with id "%1" does not exist.', $notExistsBookmarkId) + __('The bookmark with "%1" ID doesn\'t exist. Verify your information and try again.', $notExistsBookmarkId) ); $this->bookmarkRepository->getById($notExistsBookmarkId); } diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js index ad82879bcd115..dc5c2389ba8e5 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js @@ -23,10 +23,12 @@ define([ value: '', $wysiwygEditorButton: '', links: { - value: '${ $.provider }:${ $.dataScope }' + value: '${ $.provider }:${ $.dataScope }', + stageActive: false }, template: 'ui/form/field', elementTmpl: 'ui/form/element/wysiwyg', + stageActive: false, content: '', showSpinner: false, loading: false, diff --git a/app/code/Magento/UrlRewrite/Controller/Adminhtml/Url/Rewrite/Save.php b/app/code/Magento/UrlRewrite/Controller/Adminhtml/Url/Rewrite/Save.php index 27b2d5088a1c3..6325fe162d9e7 100644 --- a/app/code/Magento/UrlRewrite/Controller/Adminhtml/Url/Rewrite/Save.php +++ b/app/code/Magento/UrlRewrite/Controller/Adminhtml/Url/Rewrite/Save.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\UrlRewrite\Controller\Adminhtml\Url\Rewrite; use Magento\Framework\Exception\LocalizedException; @@ -96,8 +97,8 @@ protected function getTargetPath($model) $rewrite = $this->urlFinder->findOneByData($data); if (!$rewrite) { $message = $model->getEntityType() === self::ENTITY_TYPE_PRODUCT - ? __('The product you chose is not associated with the selected store or category.') - : __('The category you chose is not associated with the selected store.'); + ? __("The selected product isn't associated with the selected store or category.") + : __("The selected category isn't associated with the selected store."); throw new LocalizedException($message); } $targetPath = $rewrite->getRequestPath(); @@ -174,7 +175,10 @@ public function execute() $this->messageManager->addError($e->getMessage()); $session->setUrlRewriteData($data); } catch (\Exception $e) { - $this->messageManager->addException($e, __('Something went wrong while saving URL Rewrite.')); + $this->messageManager->addException( + $e, + __('An error occurred while saving the URL rewrite. Please try to save again.') + ); $session->setUrlRewriteData($data); } } diff --git a/app/code/Magento/User/Controller/Adminhtml/Auth.php b/app/code/Magento/User/Controller/Adminhtml/Auth.php index aaa2681a50790..173fdcc764f6f 100644 --- a/app/code/Magento/User/Controller/Adminhtml/Auth.php +++ b/app/code/Magento/User/Controller/Adminhtml/Auth.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\User\Controller\Adminhtml; use Magento\Framework\Encryption\Helper\Security; @@ -49,7 +50,9 @@ protected function _validateResetPasswordLinkToken($userId, $resetPasswordToken) $resetPasswordToken ) || empty($resetPasswordToken) || empty($userId) || $userId < 0 ) { - throw new \Magento\Framework\Exception\LocalizedException(__('Please correct the password reset token.')); + throw new \Magento\Framework\Exception\LocalizedException( + __('The password reset token is incorrect. Verify the token and try again.') + ); } /** @var $user \Magento\User\Model\User */ diff --git a/app/code/Magento/User/Controller/Adminhtml/User/Delete.php b/app/code/Magento/User/Controller/Adminhtml/User/Delete.php index e5fb1590a8cc1..4e7d18774c2f9 100644 --- a/app/code/Magento/User/Controller/Adminhtml/User/Delete.php +++ b/app/code/Magento/User/Controller/Adminhtml/User/Delete.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\User\Controller\Adminhtml\User; use Magento\User\Block\User\Edit\Tab\Main as UserEdit; @@ -29,7 +30,9 @@ public function execute() try { $currentUserPassword = (string)$this->getRequest()->getPost(UserEdit::CURRENT_USER_PASSWORD_FIELD); if (empty($currentUserPassword)) { - throw new AuthenticationException(__('You have entered an invalid password for current user.')); + throw new AuthenticationException( + __('The password entered for the current user is invalid. Verify the password and try again.') + ); } $currentUser->performIdentityCheck($currentUserPassword); /** @var \Magento\User\Model\User $model */ diff --git a/app/code/Magento/User/Controller/Adminhtml/User/Role/SaveRole.php b/app/code/Magento/User/Controller/Adminhtml/User/Role/SaveRole.php index c21e0ba7845a7..9dfe34e435385 100644 --- a/app/code/Magento/User/Controller/Adminhtml/User/Role/SaveRole.php +++ b/app/code/Magento/User/Controller/Adminhtml/User/Role/SaveRole.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\User\Controller\Adminhtml\User\Role; use Magento\Authorization\Model\Acl\Role\Group as RoleGroup; @@ -117,7 +118,9 @@ public function execute() ); return $resultRedirect->setPath('*'); } catch (\Magento\Framework\Exception\AuthenticationException $e) { - $this->messageManager->addError(__('You have entered an invalid password for current user.')); + $this->messageManager->addError( + __('The password entered for the current user is invalid. Verify the password and try again.') + ); return $this->saveDataToSessionAndRedirect($role, $this->getRequest()->getPostValue(), $resultRedirect); } catch (\Magento\Framework\Exception\LocalizedException $e) { $this->messageManager->addError($e->getMessage()); diff --git a/app/code/Magento/User/Controller/Adminhtml/User/Save.php b/app/code/Magento/User/Controller/Adminhtml/User/Save.php index 3b37ce10c0151..4b984b761c1fe 100644 --- a/app/code/Magento/User/Controller/Adminhtml/User/Save.php +++ b/app/code/Magento/User/Controller/Adminhtml/User/Save.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\User\Controller\Adminhtml\User; use Magento\Framework\Exception\AuthenticationException; @@ -79,7 +80,9 @@ public function execute() && !empty($data[$currentUserPasswordField]) && is_string($data[$currentUserPasswordField]); try { if (!($isCurrentUserPasswordValid)) { - throw new AuthenticationException(__('You have entered an invalid password for current user.')); + throw new AuthenticationException( + __('The password entered for the current user is invalid. Verify the password and try again.') + ); } $currentUser->performIdentityCheck($data[$currentUserPasswordField]); $model->save(); @@ -96,7 +99,9 @@ public function execute() ); $this->_redirect('adminhtml/*/'); } catch (\Magento\Framework\Exception\AuthenticationException $e) { - $this->messageManager->addError(__('You have entered an invalid password for current user.')); + $this->messageManager->addError( + __('The password entered for the current user is invalid. Verify the password and try again.') + ); $this->redirectToEdit($model, $data); } catch (\Magento\Framework\Validator\Exception $e) { $messages = $e->getMessages(); diff --git a/app/code/Magento/User/Model/User.php b/app/code/Magento/User/Model/User.php index 2a7d43008f2ad..a5dd6ac2e7813 100644 --- a/app/code/Magento/User/Model/User.php +++ b/app/code/Magento/User/Model/User.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\User\Model; use Magento\Backend\App\Area\FrontNameResolver; @@ -580,11 +581,14 @@ public function verifyIdentity($password) if ($this->_encryptor->validateHash($password, $this->getPassword())) { if ($this->getIsActive() != '1') { throw new AuthenticationException( - __('You did not sign in correctly or your account is temporarily disabled.') + __( + 'The account sign-in was incorrect or your account is disabled temporarily. ' + . 'Please wait and try again later.' + ) ); } if (!$this->hasAssigned2Role($this->getId())) { - throw new AuthenticationException(__('You need more permissions to access this.')); + throw new AuthenticationException(__('More permissions are needed to access this.')); } $result = true; } @@ -669,7 +673,9 @@ protected function _getEncodedPassword($password) public function changeResetPasswordLinkToken($newToken) { if (!is_string($newToken) || empty($newToken)) { - throw new \Magento\Framework\Exception\LocalizedException(__('Please correct the password reset token.')); + throw new \Magento\Framework\Exception\LocalizedException( + __('The password reset token is incorrect. Verify the token and try again.') + ); } $this->setRpToken($newToken); $this->setRpTokenCreatedAt((new \DateTime())->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT)); @@ -903,13 +909,13 @@ public function performIdentityCheck($passwordString) $clonedUser->reload(); if ($clonedUser->getLockExpires()) { throw new \Magento\Framework\Exception\State\UserLockedException( - __('Your account is temporarily disabled.') + __('Your account is temporarily disabled. Please try again later.') ); } if (!$isCheckSuccessful) { throw new \Magento\Framework\Exception\AuthenticationException( - __('You have entered an invalid password for current user.') + __('The password entered for the current user is invalid. Verify the password and try again.') ); } diff --git a/app/code/Magento/User/Model/UserValidationRules.php b/app/code/Magento/User/Model/UserValidationRules.php index b878d60356300..e40c785749e03 100644 --- a/app/code/Magento/User/Model/UserValidationRules.php +++ b/app/code/Magento/User/Model/UserValidationRules.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\User\Model; use Magento\Framework\Validator\EmailAddress; @@ -32,13 +33,25 @@ class UserValidationRules public function addUserInfoRules(\Magento\Framework\Validator\DataObject $validator) { $userNameNotEmpty = new NotEmpty(); - $userNameNotEmpty->setMessage(__('User Name is a required field.'), \Zend_Validate_NotEmpty::IS_EMPTY); + $userNameNotEmpty->setMessage( + __('"User Name" is required. Enter and try again.'), + \Zend_Validate_NotEmpty::IS_EMPTY + ); $firstNameNotEmpty = new NotEmpty(); - $firstNameNotEmpty->setMessage(__('First Name is a required field.'), \Zend_Validate_NotEmpty::IS_EMPTY); + $firstNameNotEmpty->setMessage( + __('"First Name" is required. Enter and try again.'), + \Zend_Validate_NotEmpty::IS_EMPTY + ); $lastNameNotEmpty = new NotEmpty(); - $lastNameNotEmpty->setMessage(__('Last Name is a required field.'), \Zend_Validate_NotEmpty::IS_EMPTY); + $lastNameNotEmpty->setMessage( + __('"Last Name" is required. Enter and try again.'), + \Zend_Validate_NotEmpty::IS_EMPTY + ); $emailValidity = new EmailAddress(); - $emailValidity->setMessage(__('Please enter a valid email.'), \Zend_Validate_EmailAddress::INVALID); + $emailValidity->setMessage( + __('Please enter a valid email.'), + \Zend_Validate_EmailAddress::INVALID + ); /** @var $validator \Magento\Framework\Validator\DataObject */ $validator->addRule( diff --git a/app/code/Magento/User/Observer/Backend/AuthObserver.php b/app/code/Magento/User/Observer/Backend/AuthObserver.php index bc5d6af615f13..6021302a5aeb7 100644 --- a/app/code/Magento/User/Observer/Backend/AuthObserver.php +++ b/app/code/Magento/User/Observer/Backend/AuthObserver.php @@ -125,7 +125,10 @@ public function execute(EventObserver $observer) $lockExpires = new \DateTime($lockExpires); if ($lockExpires > new \DateTime()) { throw new UserLockedException( - __('You did not sign in correctly or your account is temporarily disabled.') + __( + 'The account sign-in was incorrect or your account is disabled temporarily. ' + . 'Please wait and try again later.' + ) ); } } diff --git a/app/code/Magento/User/Test/Unit/Model/UserTest.php b/app/code/Magento/User/Test/Unit/Model/UserTest.php index 1d63d1aed3e1a..c00325da00c37 100644 --- a/app/code/Magento/User/Test/Unit/Model/UserTest.php +++ b/app/code/Magento/User/Test/Unit/Model/UserTest.php @@ -352,7 +352,8 @@ public function testVerifyIdentityInactiveRecord() $this->model->setIsActive(false); $this->expectException( \Magento\Framework\Exception\AuthenticationException::class, - 'You did not sign in correctly or your account is temporarily disabled.' + 'The account sign-in was incorrect or your account is disabled temporarily. ' + . 'Please wait and try again later.' ); $this->model->verifyIdentity($password); } @@ -372,7 +373,7 @@ public function testVerifyIdentityNoAssignedRoles() $this->resourceMock->expects($this->once())->method('hasAssigned2Role')->willReturn(false); $this->expectException( \Magento\Framework\Exception\AuthenticationException::class, - 'You need more permissions to access this.' + 'More permissions are needed to access this.' ); $this->model->verifyIdentity($password); } @@ -783,14 +784,14 @@ public function testPerformIdentityCheck($verifyIdentityResult, $lockExpires) if ($lockExpires) { $this->expectException( \Magento\Framework\Exception\State\UserLockedException::class, - __('Your account is temporarily disabled.') + __('Your account is temporarily disabled. Please try again later.') ); } if (!$verifyIdentityResult) { $this->expectException( \Magento\Framework\Exception\AuthenticationException::class, - __('You have entered an invalid password for current user.') + __('The password entered for the current user is invalid. Verify the password and try again.') ); } diff --git a/app/code/Magento/Vault/Model/Ui/Adminhtml/TokensConfigProvider.php b/app/code/Magento/Vault/Model/Ui/Adminhtml/TokensConfigProvider.php index 0cb3182980f55..d79d4ff98f0c8 100644 --- a/app/code/Magento/Vault/Model/Ui/Adminhtml/TokensConfigProvider.php +++ b/app/code/Magento/Vault/Model/Ui/Adminhtml/TokensConfigProvider.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Vault\Model\Ui\Adminhtml; use Magento\Framework\Api\FilterBuilder; @@ -227,7 +228,7 @@ private function getPaymentTokenEntityId() { $paymentToken = $this->getPaymentTokenManagement()->getByPaymentId($this->getOrderPaymentEntityId()); if ($paymentToken === null) { - throw new NoSuchEntityException(__('No available payment tokens for specified order payment.')); + throw new NoSuchEntityException(__('No payment tokens are available for the specified order payment.')); } return $paymentToken->getEntityId(); } diff --git a/app/code/Magento/Webapi/Controller/Rest.php b/app/code/Magento/Webapi/Controller/Rest.php index dc061aeea99e7..3c0bf85eb5247 100644 --- a/app/code/Magento/Webapi/Controller/Rest.php +++ b/app/code/Magento/Webapi/Controller/Rest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Webapi\Controller; use Magento\Framework\App\DeploymentConfig; @@ -284,7 +285,7 @@ protected function checkPermissions() if (!$this->authorization->isAllowed($route->getAclResources())) { $params = ['resources' => implode(', ', $route->getAclResources())]; throw new AuthorizationException( - __('Consumer is not authorized to access %resources', $params) + __("The consumer isn't authorized to access %resources.", $params) ); } } diff --git a/app/code/Magento/Webapi/Controller/Rest/RequestValidator.php b/app/code/Magento/Webapi/Controller/Rest/RequestValidator.php index 07e3e7791103c..048c0d86bc312 100644 --- a/app/code/Magento/Webapi/Controller/Rest/RequestValidator.php +++ b/app/code/Magento/Webapi/Controller/Rest/RequestValidator.php @@ -84,7 +84,7 @@ private function checkPermissions() if (!$this->authorization->isAllowed($route->getAclResources())) { $params = ['resources' => implode(', ', $route->getAclResources())]; throw new AuthorizationException( - __('Consumer is not authorized to access %resources', $params) + __("The consumer isn't authorized to access %resources.", $params) ); } } diff --git a/app/code/Magento/Webapi/Controller/Soap/Request/Handler.php b/app/code/Magento/Webapi/Controller/Soap/Request/Handler.php index 0e87805daf60a..72cbbe7481cfa 100644 --- a/app/code/Magento/Webapi/Controller/Soap/Request/Handler.php +++ b/app/code/Magento/Webapi/Controller/Soap/Request/Handler.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Webapi\Controller\Soap\Request; use Magento\Framework\Api\ExtensibleDataInterface; @@ -126,7 +127,7 @@ public function __call($operation, $arguments) if (!$this->authorization->isAllowed($serviceMethodInfo[ServiceMetadata::KEY_ACL_RESOURCES])) { throw new AuthorizationException( __( - 'Consumer is not authorized to access %resources', + "The consumer isn't authorized to access %resources.", ['resources' => implode(', ', $serviceMethodInfo[ServiceMetadata::KEY_ACL_RESOURCES])] ) ); diff --git a/app/code/Magento/Webapi/Model/Soap/Wsdl/Generator.php b/app/code/Magento/Webapi/Model/Soap/Wsdl/Generator.php index fe6a2a353ff57..e14b4a05f41fd 100644 --- a/app/code/Magento/Webapi/Model/Soap/Wsdl/Generator.php +++ b/app/code/Magento/Webapi/Model/Soap/Wsdl/Generator.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Webapi\Model\Soap\Wsdl; use Magento\Webapi\Model\AbstractSchemaGenerator; @@ -375,7 +376,7 @@ protected function getAllowedServicesMetadata($requestedServices) if (!$allowedServicesMetadata) { throw new AuthorizationException( __( - 'Consumer is not authorized to access %resources', + "The consumer isn't authorized to access %resources.", ['resources' => implode(', ', $requestedServices)] ) ); diff --git a/app/code/Magento/Webapi/Test/Unit/Controller/Rest/RequestValidatorTest.php b/app/code/Magento/Webapi/Test/Unit/Controller/Rest/RequestValidatorTest.php index 9d57db911fd51..a0dadd345dd72 100644 --- a/app/code/Magento/Webapi/Test/Unit/Controller/Rest/RequestValidatorTest.php +++ b/app/code/Magento/Webapi/Test/Unit/Controller/Rest/RequestValidatorTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Webapi\Test\Unit\Controller\Rest; class RequestValidatorTest extends \PHPUnit\Framework\TestCase @@ -131,7 +132,7 @@ public function testInSecureRequestOverSecureRoute() /** * @expectedException \Magento\Framework\Exception\AuthorizationException - * @expectedExceptionMessage Consumer is not authorized to access 5, 6 + * @expectedExceptionMessage The consumer isn't authorized to access 5, 6. */ public function testAuthorizationFailed() { diff --git a/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php b/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php index dfa40a166ba99..11b976a640b07 100644 --- a/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php +++ b/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Weee\Model\Attribute\Backend\Weee; use Magento\Framework\Exception\LocalizedException; @@ -90,7 +91,8 @@ public function validate($object) $key1 = implode('-', [$tax['website_id'], $tax['country'], $state]); if (!empty($dup[$key1])) { throw new LocalizedException( - __('You must set unique country-state combinations within the same fixed product tax') + __('Set unique country-state combinations within the same fixed product tax. ' + . 'Verify the combinations and try again.') ); } $dup[$key1] = 1; diff --git a/app/code/Magento/Weee/Test/Unit/Model/Attribute/Backend/Weee/TaxTest.php b/app/code/Magento/Weee/Test/Unit/Model/Attribute/Backend/Weee/TaxTest.php index 28850fa2b84d8..dea5ae513ca31 100644 --- a/app/code/Magento/Weee/Test/Unit/Model/Attribute/Backend/Weee/TaxTest.php +++ b/app/code/Magento/Weee/Test/Unit/Model/Attribute/Backend/Weee/TaxTest.php @@ -97,7 +97,8 @@ public function dataProviderValidate() ['state' => 12, 'country' => 'US', 'website_id' => '1'], ['state' => null, 'country' => 'ES', 'website_id' => '1'] ], - 'expected' => 'You must set unique country-state combinations within the same fixed product tax', + 'expected' => 'Set unique country-state combinations within the same fixed product tax. ' + . 'Verify the combinations and try again.', ] ]; } diff --git a/app/code/Magento/Weee/view/adminhtml/web/js/fpt-group.js b/app/code/Magento/Weee/view/adminhtml/web/js/fpt-group.js index b034ae376f596..dc13c93888efd 100644 --- a/app/code/Magento/Weee/view/adminhtml/web/js/fpt-group.js +++ b/app/code/Magento/Weee/view/adminhtml/web/js/fpt-group.js @@ -34,7 +34,10 @@ define([ } return true; - }, $t('You must set unique country-state combinations within the same fixed product tax')); + }, $t( + 'Set unique country-state combinations within the same fixed product tax. ' + + 'Verify the combinations and try again.' + )); this._super(); }, diff --git a/app/code/Magento/Wishlist/Controller/Index/Configure.php b/app/code/Magento/Wishlist/Controller/Index/Configure.php index 7e6f4d3ed7939..93a05ffc0ec93 100644 --- a/app/code/Magento/Wishlist/Controller/Index/Configure.php +++ b/app/code/Magento/Wishlist/Controller/Index/Configure.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Wishlist\Controller\Index; use Magento\Framework\App\Action; @@ -66,7 +67,7 @@ public function execute() $item->loadWithOptions($id); if (!$item->getId()) { throw new \Magento\Framework\Exception\LocalizedException( - __('We can\'t load the Wish List item right now.') + __("The Wish List item can't load at this time. Please try again later.") ); } $wishlist = $this->wishlistProvider->getWishlist($item->getWishlistId()); diff --git a/app/code/Magento/Wishlist/Controller/Index/Fromcart.php b/app/code/Magento/Wishlist/Controller/Index/Fromcart.php index 994da75073e96..49396004427f2 100644 --- a/app/code/Magento/Wishlist/Controller/Index/Fromcart.php +++ b/app/code/Magento/Wishlist/Controller/Index/Fromcart.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Wishlist\Controller\Index; use Magento\Checkout\Helper\Cart as CartHelper; @@ -104,7 +105,7 @@ public function execute() $item = $this->cart->getQuote()->getItemById($itemId); if (!$item) { throw new LocalizedException( - __('The requested cart item doesn\'t exist.') + __("The cart item doesn't exist.") ); } diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/FromcartTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/FromcartTest.php index 704d4088130f3..52af38dee0ed3 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/FromcartTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/FromcartTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Wishlist\Test\Unit\Controller\Index; use Magento\Checkout\Helper\Cart as CartHelper; @@ -197,7 +198,7 @@ public function testExecuteNoCartItem() $this->messageManager->expects($this->once()) ->method('addErrorMessage') - ->with(__('The requested cart item doesn\'t exist.')) + ->with(__("The cart item doesn't exist.")) ->willReturnSelf(); $this->resultRedirect->expects($this->once()) diff --git a/dev/tests/acceptance/composer.lock b/dev/tests/acceptance/composer.lock index 0ebeeb018e7bd..29cfc59adce97 100644 --- a/dev/tests/acceptance/composer.lock +++ b/dev/tests/acceptance/composer.lock @@ -1641,11 +1641,11 @@ }, { "name": "magento/magento2-functional-testing-framework", - "version": "2.0.2", + "version": "2.0.3", "source": { "type": "git", "url": "git@github.com:magento/magento2-functional-testing-framework.git", - "reference": "4ecb0ae9e6ac43e56d8a93c44406ccf7accdc21d" + "reference": "22c803fc16024d417d920d03fdd95dea84779dd6" }, "require": { "codeception/codeception": "~2.3.4", @@ -1659,6 +1659,7 @@ "brainmaestro/composer-git-hooks": "^2.3", "codacy/coverage": "^1.4", "codeception/aspect-mock": "^2.0", + "goaop/framework": "2.1.2", "phpmd/phpmd": "^2.6.0", "rregeer/phpunit-coverage-check": "^0.1.4", "sebastian/phpcpd": "~3.0", diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationEnableDisableAnalyticsCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationEnableDisableAnalyticsCest.xml index 3380f6e771c05..c7ca8b799d243 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationEnableDisableAnalyticsCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationEnableDisableAnalyticsCest.xml @@ -6,41 +6,39 @@ */ --> - - - - - - - <description value="An admin user can enable/disable Advanced Reporting."/> - <severity value="NORMAL"/> - <testCaseId value="MAGETWO-66465"/> - <group value="analytics"/> - </annotations> - <after> - <amOnPage stepKey="amOnLogoutPage" url="admin/admin/auth/logout/"/> - </after> - <actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/> - <!--Goto admin stores configure page --> - <amOnPage stepKey="amOnAdminConfig" url="{{AdminConfigPage.url}}"/> - <!--Enable Advanced Reporting--> - <click stepKey="clickAdvancedReportingConfigMenu" selector="{{AdminConfigSection.advancedReportingMenuItem}}"/> - <see stepKey="seeAdvancedReportingServiceLabel" selector="{{AdminConfigSection.advancedReportingServiceLabel}}" userInput="Advanced Reporting Service"/> - <selectOption stepKey="selectAdvancedReportingService" selector="{{AdminConfigSection.advancedReportingService}}" userInput="Enable"/> - <see stepKey="seeAdvancedReportingIndustryLabel" selector="{{AdminConfigSection.advancedReportingIndustryLabel}}" userInput="Industry"/> - <selectOption stepKey="selectAdvancedReportingIndustry" selector="{{AdminConfigSection.advancedReportingIndustry}}" userInput="Apps and Games"/> - <click stepKey="clickSaveConfigButton" selector="{{AdminConfigSection.saveButton}}"/> - <see stepKey="seeSaveConfigurationMessage" selector="{{AdminConfigSection.advancedReportingSuccessMessage}}" userInput="You saved the configuration."/> - <see stepKey="seeAdvancedReportingService" selector="{{AdminConfigSection.advancedReportingService}}" userInput="Enable"/> - <see stepKey="seeAdvancedReportingServiceStatus" selector="{{AdminConfigSection.advancedReportingServiceStatus}}" userInput="Subscription status: Pending"/> - <!--Disable Advanced Reporting--> - <see stepKey="seeAdvancedReportingServiceLabel" selector="{{AdminConfigSection.advancedReportingServiceLabel}}" userInput="Advanced Reporting Service"/> - <selectOption stepKey="selectAdvancedReportingService" selector="{{AdminConfigSection.advancedReportingService}}" userInput="Disable"/> - <click stepKey="clickSaveConfigButton" selector="{{AdminConfigSection.saveButton}}"/> - <see stepKey="seeSaveConfigurationMessage" selector="{{AdminConfigSection.advancedReportingSuccessMessage}}" userInput="You saved the configuration."/> - <see stepKey="seeAdvancedReportingService" selector="{{AdminConfigSection.advancedReportingService}}" userInput="Disable"/> - <see stepKey="seeAdvancedReportingServiceStatus" selector="{{AdminConfigSection.advancedReportingServiceStatus}}" userInput="Subscription status: Disabled"/> - - </test> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="EnableDisableAdvancedReporting"> + <annotations> + <features value="Analytics"/> + <stories value="Enable/disable Advanced Reporting"/> + <title value="Enable Disable Advanced Reporting"/> + <description value="An admin user can enable/disable Advanced Reporting."/> + <severity value="NORMAL"/> + <testCaseId value="MAGETWO-66465"/> + <group value="analytics"/> + </annotations> + <after> + <amOnPage stepKey="amOnLogoutPage" url="admin/admin/auth/logout/"/> + </after> + <actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/> + <!--Goto admin stores configure page --> + <amOnPage stepKey="amOnAdminConfig" url="{{AdminConfigPage.url}}"/> + <!--Enable Advanced Reporting--> + <click stepKey="clickAdvancedReportingConfigMenu" selector="{{AdminConfigSection.advancedReportingMenuItem}}"/> + <see stepKey="seeAdvancedReportingServiceLabelEnabled" selector="{{AdminConfigSection.advancedReportingServiceLabel}}" userInput="Advanced Reporting Service"/> + <selectOption stepKey="selectAdvancedReportingServiceEnabled" selector="{{AdminConfigSection.advancedReportingService}}" userInput="Enable"/> + <see stepKey="seeAdvancedReportingIndustryLabel" selector="{{AdminConfigSection.advancedReportingIndustryLabel}}" userInput="Industry"/> + <selectOption stepKey="selectAdvancedReportingIndustry" selector="{{AdminConfigSection.advancedReportingIndustry}}" userInput="Apps and Games"/> + <click stepKey="clickSaveConfigButtonEnabled" selector="{{AdminConfigSection.saveButton}}"/> + <see stepKey="seeSaveConfigurationMessageEnabled" selector="{{AdminConfigSection.advancedReportingSuccessMessage}}" userInput="You saved the configuration."/> + <see stepKey="seeAdvancedReportingServiceEnabled" selector="{{AdminConfigSection.advancedReportingService}}" userInput="Enable"/> + <see stepKey="seeAdvancedReportingServiceStatusEnabled" selector="{{AdminConfigSection.advancedReportingServiceStatus}}" userInput="Subscription status: Pending"/> + <!--Disable Advanced Reporting--> + <see stepKey="seeAdvancedReportingServiceLabelDisabled" selector="{{AdminConfigSection.advancedReportingServiceLabel}}" userInput="Advanced Reporting Service"/> + <selectOption stepKey="selectAdvancedReportingServiceDisabled" selector="{{AdminConfigSection.advancedReportingService}}" userInput="Disable"/> + <click stepKey="clickSaveConfigButtonDisabled" selector="{{AdminConfigSection.saveButton}}"/> + <see stepKey="seeSaveConfigurationMessageDisabled" selector="{{AdminConfigSection.advancedReportingSuccessMessage}}" userInput="You saved the configuration."/> + <see stepKey="seeAdvancedReportingServiceDisabled" selector="{{AdminConfigSection.advancedReportingService}}" userInput="Disable"/> + <see stepKey="seeAdvancedReportingServiceStatusDisabled" selector="{{AdminConfigSection.advancedReportingServiceStatus}}" userInput="Subscription status: Disabled"/> + </test> </tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationPermissionCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationPermissionCest.xml index b0c3754b0527c..c5f070dd4cadb 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationPermissionCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Test/AdminConfigurationPermissionCest.xml @@ -55,7 +55,7 @@ <fillField stepKey="fillUsernameNoReport" selector="{{AdminLoginFormSection.username}}" userInput="$$noReportUser.username$$"/> <fillField stepKey="fillPasswordNoReport" selector="{{AdminLoginFormSection.password}}" userInput="$$noReportUser.password$$"/> <click stepKey="clickOnSignIn2" selector="{{AdminLoginFormSection.signIn}}"/> - <waitForPageLoad stepKey="wait3" time="10"/> + <waitForPageLoad stepKey="wait5" time="10"/> <amOnPage stepKey="amOnAdminConfig2" url="{{AdminConfigPage.url}}"/> <dontSee stepKey="dontSeeAdvancedReportingConfigMenuItem" selector="{{AdminConfigSection.advancedReportingMenuItem}}" userInput="Advanced Reporting"/> </test> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGProductCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGProductCest.xml index f8e6aa33c96d8..572c535eabd54 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGProductCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageToWYSIWYGProductCest.xml @@ -48,9 +48,9 @@ <conditionalClick selector="{{ProductDescriptionWYSIWYGToolbarSection.StorageRootArrow}}" dependentSelector="{{ProductDescriptionWYSIWYGToolbarSection.checkIfArrowExpand}}" stepKey="clickArrowIfCloses1" visible="true"/> <waitForText userInput="{{ImageFolder.name}}" stepKey="waitForNewFolder1" /> <click userInput="{{ImageFolder.name}}" stepKey="clickOnCreatedFolder1" /> - <waitForLoadingMaskToDisappear stepKey="waitForLoading5" /> + <waitForLoadingMaskToDisappear stepKey="waitForLoading4" /> <attachFile selector="{{ProductDescriptionWYSIWYGToolbarSection.BrowseUploadImage}}" userInput="{{ImageUpload.file}}" stepKey="uploadImage1"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoading6" /> + <waitForLoadingMaskToDisappear stepKey="waitForLoading5" /> <waitForElementVisible selector="{{ProductDescriptionWYSIWYGToolbarSection.image(ImageUpload.file)}}" stepKey="waitForUploadImage1" /> <seeElement selector="{{ProductDescriptionWYSIWYGToolbarSection.imageSelected(ImageUpload.file)}}" stepKey="seeImageSelected1" /> <see selector="{{ProductDescriptionWYSIWYGToolbarSection.DeleteSelectedBtn}}" userInput="Delete Selected" stepKey="seeDeleteBtn1"/> @@ -60,10 +60,10 @@ <waitForElementNotVisible selector="{{ProductDescriptionWYSIWYGToolbarSection.image(ImageUpload.file)}}" stepKey="waitForImageDeleted1" /> <dontSeeElement selector="{{ProductDescriptionWYSIWYGToolbarSection.image(ImageUpload.file)}}" stepKey="dontSeeImage1" /> <attachFile selector="{{ProductDescriptionWYSIWYGToolbarSection.BrowseUploadImage}}" userInput="{{ImageUpload.file}}" stepKey="uploadImage2"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoading7" /> + <waitForLoadingMaskToDisappear stepKey="waitForLoading6" /> <waitForElementVisible selector="{{ProductDescriptionWYSIWYGToolbarSection.image(ImageUpload.file)}}" stepKey="waitForUploadImage2" /> <click selector="{{ProductDescriptionWYSIWYGToolbarSection.InsertFile}}" stepKey="clickInsertBtn1" /> - <waitForLoadingMaskToDisappear stepKey="waitForLoading8" /> + <waitForLoadingMaskToDisappear stepKey="waitForLoading7" /> <waitForElementVisible selector="{{ProductDescriptionWYSIWYGToolbarSection.OkBtn}}" stepKey="waitForOkBtn1" /> <fillField selector="{{ProductDescriptionWYSIWYGToolbarSection.ImageDescription}}" userInput="{{ImageUpload.content}}" stepKey="fillImageDescription1" /> <fillField selector="{{ProductDescriptionWYSIWYGToolbarSection.Height}}" userInput="{{ImageUpload.height}}" stepKey="fillImageHeight1" /> @@ -74,14 +74,13 @@ <waitForPageLoad stepKey="waitForPageLoad4" /> <click selector="{{ProductShortDescriptionWYSIWYGToolbarSection.Browse}}" stepKey="clickBrowse2" /> <waitForPageLoad stepKey="waitForPageLoad5" /> - <waitForLoadingMaskToDisappear stepKey="waitForLoading9" /> - <waitForLoadingMaskToDisappear stepKey="waitForLoading10" /> + <waitForLoadingMaskToDisappear stepKey="waitForLoading8" /> <see selector="{{ProductShortDescriptionWYSIWYGToolbarSection.CancelBtn}}" userInput="Cancel" stepKey="seeCancelBtn2" /> <see selector="{{ProductShortDescriptionWYSIWYGToolbarSection.CreateFolder}}" userInput="Create Folder" stepKey="seeCreateFolderBtn2" /> <see selector="{{ProductShortDescriptionWYSIWYGToolbarSection.InsertFile}}" userInput="Add Selected" stepKey="seeAddSelectedBtn2" /> <attachFile selector="{{ProductShortDescriptionWYSIWYGToolbarSection.BrowseUploadImage}}" userInput="{{ImageUpload1.file}}" stepKey="uploadImage3"/> <waitForElementVisible selector="{{ProductShortDescriptionWYSIWYGToolbarSection.image(ImageUpload1.file)}}" stepKey="waitForUploadImage3" /> - <waitForLoadingMaskToDisappear stepKey="waitForLoading13" /> + <waitForLoadingMaskToDisappear stepKey="waitForLoading9" /> <wait time="3" stepKey="waitMore" /> <waitForElement selector="{{ProductShortDescriptionWYSIWYGToolbarSection.DeleteSelectedBtn}}" stepKey="waitForDeletebtn" /> <see selector="{{ProductShortDescriptionWYSIWYGToolbarSection.DeleteSelectedBtn}}" userInput="Delete Selected" stepKey="seeDeleteBtn2"/> @@ -89,19 +88,19 @@ <waitForText userInput="OK" stepKey="waitForConfirm3" /> <click selector="{{ProductShortDescriptionWYSIWYGToolbarSection.confirmDelete}}" stepKey="confirmDelete2" /> <attachFile selector="{{ProductShortDescriptionWYSIWYGToolbarSection.BrowseUploadImage}}" userInput="{{ImageUpload1.file}}" stepKey="uploadImage4"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoading14" /> + <waitForLoadingMaskToDisappear stepKey="waitForLoading10" /> <waitForElementVisible selector="{{ProductShortDescriptionWYSIWYGToolbarSection.image(ImageUpload1.file)}}" stepKey="waitForUploadImage4" /> <click selector="{{ProductShortDescriptionWYSIWYGToolbarSection.InsertFile}}" stepKey="clickInsertBtn" /> - <waitForLoadingMaskToDisappear stepKey="waitForLoading15" /> + <waitForLoadingMaskToDisappear stepKey="waitForLoading11" /> <waitForElementVisible selector="{{ProductShortDescriptionWYSIWYGToolbarSection.OkBtn}}" stepKey="waitForOkBtn2" /> <fillField selector="{{ProductShortDescriptionWYSIWYGToolbarSection.ImageDescription}}" userInput="{{ImageUpload1.content}}" stepKey="fillImageDescription2" /> <fillField selector="{{ProductShortDescriptionWYSIWYGToolbarSection.Height}}" userInput="{{ImageUpload1.height}}" stepKey="fillImageHeight2" /> <click selector="{{ProductShortDescriptionWYSIWYGToolbarSection.OkBtn}}" stepKey="clickOkBtn2" /> <waitForPageLoad stepKey="waitForPageLoad6"/> <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoading13" /> + <waitForLoadingMaskToDisappear stepKey="waitForLoading12" /> <amOnPage url="{{_defaultProduct.name}}.html" stepKey="navigateToProductPage"/> - <waitForPageLoad stepKey="waitForPageLoad2"/> + <waitForPageLoad stepKey="waitForPageLoad7"/> <seeElement selector="{{StorefrontProductInfoMainSection.mediaDescription}}" stepKey="assertMediaDescription"/> <seeElement selector="{{StorefrontProductInfoMainSection.mediaShortDescription}}" stepKey="assertMediaShortDescription"/> <after> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyDefaultWYSIWYGToolbarOnProductCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyDefaultWYSIWYGToolbarOnProductCest.xml index 7b0b4e95dd4e6..26852d17e6440 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyDefaultWYSIWYGToolbarOnProductCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/VerifyDefaultWYSIWYGToolbarOnProductCest.xml @@ -80,7 +80,7 @@ <seeElement selector="{{ProductShortDescriptionWYSIWYGToolbarSection.InsertLink}}" stepKey="assertInfo25"/> <seeElement selector="{{ProductShortDescriptionWYSIWYGToolbarSection.InsertImageIcon}}" stepKey="assertInfo26"/> <seeElement selector="{{ProductShortDescriptionWYSIWYGToolbarSection.InsertTable}}" stepKey="assertInfo27"/> - <seeElement selector="{{ProductShortDescriptionWYSIWYGToolbarSection.SpecialCharacter}}" stepKey="assertInfo27"/> + <seeElement selector="{{ProductShortDescriptionWYSIWYGToolbarSection.SpecialCharacter}}" stepKey="assertInfo28"/> <after> <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> <actionGroup ref="logout" stepKey="logout"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/CMSActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/CMSActionGroup.xml new file mode 100644 index 0000000000000..0c3706b9a633b --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/ActionGroup/CMSActionGroup.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd"> + <actionGroup name="navigateToCreatedCMSPage"> + <arguments> + <argument name="CMSPage" defaultValue=""/> + </arguments> + <amOnPage url="{{CmsPagesPage.url}}" stepKey="navigateToCMSPagesGrid"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <conditionalClick selector="{{BlockPageActionsSection.clearAll}}" dependentSelector="{{BlockPageActionsSection.activeFilters}}" stepKey="clickToResetFilter" visible="true"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> + <conditionalClick selector="//div[contains(@data-role, 'grid-wrapper')]/table/thead/tr/th/span[contains(text(), 'ID')]" dependentSelector="//span[contains(text(), 'ID')]/parent::th[not(contains(@class, '_descend'))]/parent::tr/parent::thead/parent::table/parent::div[contains(@data-role, 'grid-wrapper')]" stepKey="clickToAttemptSortByIdDescending" visible="true"/> + <waitForLoadingMaskToDisappear stepKey="waitForFirstIdSortDescendingToFinish" /> + <!-- Conditional Click again in case it goes from default state to ascending on first click --> + <conditionalClick selector="//div[contains(@data-role, 'grid-wrapper')]/table/thead/tr/th/span[contains(text(), 'ID')]" dependentSelector="//span[contains(text(), 'ID')]/parent::th[not(contains(@class, '_descend'))]/parent::tr/parent::thead/parent::table/parent::div[contains(@data-role, 'grid-wrapper')]" stepKey="secondClickToAttemptSortByIdDescending" visible="true"/> + <waitForLoadingMaskToDisappear stepKey="waitForSecondIdSortDescendingToFinish" /> + <click selector="{{CmsPagesPageActionsSection.select(CMSPage.identifier)}}" stepKey="clickSelectCreatedCMSPage" /> + <click selector="{{CmsPagesPageActionsSection.edit(CMSPage.identifier)}}" stepKey="navigateToCreatedCMSPage" /> + <waitForPageLoad stepKey="waitForPageLoad3"/> + <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickExpandContentTabForPage"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskOfStagingSection" /> + </actionGroup> + <actionGroup name="navigateToCreatedCMSBlockPage"> + <arguments> + <argument name="CMSBlockPage" defaultValue=""/> + </arguments> + <amOnPage url="{{CmsBlocksPage.url}}" stepKey="navigateToCMSBlocksGrid"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <conditionalClick selector="{{BlockPageActionsSection.idColumn}}" dependentSelector="//span[contains(text(), 'ID')]/parent::th[not(contains(@class, '_descend'))]/parent::tr/parent::thead/parent::table/parent::div[contains(@data-role, 'grid-wrapper')]" stepKey="clickToAttemptSortByIdDescending" visible="true"/> + <waitForLoadingMaskToDisappear stepKey="waitForFirstIdSortDescendingToFinish" /> + <!-- Conditional Click again in case it goes from default state to ascending on first click --> + <conditionalClick selector="{{BlockPageActionsSection.idColumn}}" dependentSelector="//span[contains(text(), 'ID')]/parent::th[not(contains(@class, '_descend'))]/parent::tr/parent::thead/parent::table/parent::div[contains(@data-role, 'grid-wrapper')]" stepKey="secondClickToAttemptSortByIdDescending" visible="true"/> + <waitForLoadingMaskToDisappear stepKey="waitForSecondIdSortDescendingToFinish" /> + <click selector="{{BlockPageActionsSection.select(CMSBlockPage.identifier)}}" stepKey="clickSelectCreatedCMSBlock" /> + <click selector="{{BlockPageActionsSection.edit(CMSBlockPage.identifier)}}" stepKey="navigateToCreatedCMSBlock" /> + <waitForPageLoad stepKey="waitForPageLoad2"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskOfStagingSection" /> + </actionGroup> +</actionGroups> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Page/BlockPage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Page/CmsBlocksPage.xml similarity index 84% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Page/BlockPage.xml rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Page/CmsBlocksPage.xml index c9715d766ac96..e3ce452abbf01 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Page/BlockPage.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Page/CmsBlocksPage.xml @@ -8,7 +8,7 @@ <pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd"> - <page name="BlocksPage" url="cms/block/new/" area="admin" module="Magento_Block"> + <page name="CmsBlocksPage" url="cms/block" area="admin" module="Magento_Block"> <section name="BlockPageActionsSection"/> </page> </pages> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/BlockPageActionsSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/BlockPageActionsSection.xml index 498de3b667f5c..4d69570e5994e 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/BlockPageActionsSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/BlockPageActionsSection.xml @@ -10,5 +10,10 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> <section name="BlockPageActionsSection"> <element name="addNewBlock" type="button" selector="#add" timeout="30"/> + <element name="select" type="button" selector="//div[text()='{{var1}}']//parent::td//following-sibling::td//button[text()='Select']" parameterized="true"/> + <element name="edit" type="button" selector="//div[text()='{{var1}}']//parent::td//following-sibling::td//a[text()='Edit']" parameterized="true"/> + <element name="idColumn" type="button" selector="//div[contains(@data-role, 'grid-wrapper')]/table/thead/tr/th/span[contains(text(), 'ID')]"/> + <element name="clearAll" type="button" selector="//div[@class='admin__data-grid-header']//button[contains(text(), 'Clear all')]"/> + <element name="activeFilters" type="button" selector="//div[@class='admin__data-grid-header']//span[contains(text(), 'Active filters:')]" /> </section> </sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageActionsSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageActionsSection.xml index d888debead363..68242033d8c18 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageActionsSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageActionsSection.xml @@ -10,5 +10,6 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> <section name="CmsNewPagePageActionsSection"> <element name="savePage" type="button" selector="#save" timeout="30"/> + <element name="saveAndContinueEdit" type="button" selector="#save_and_continue" timeout="30"/> </section> </sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageContentSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageContentSection.xml index addc466c4b026..4e794aa412e1b 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageContentSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageContentSection.xml @@ -12,6 +12,7 @@ <element name="header" type="button" selector="div[data-index=content]"/> <element name="contentHeading" type="input" selector="input[name=content_heading]"/> <element name="content" type="input" selector="#cms_page_form_content"/> + <element name="TextArea" type="text" selector="#text_form_content"/> </section> <section name="CmsWYSIWYGSection"> <element name="CheckIfTabExpand" type="button" selector="//div[@data-state-collapsible='closed']//span[text()='Content']"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml index f01d4fdfa472d..aff3a399f4753 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddImageToWYSIWYGBlockCest.xml @@ -23,7 +23,7 @@ <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> - <amOnPage url="{{BlocksPage.url}}" stepKey="amOnNewBlockPage"/> + <amOnPage url="{{CmsNewBlock.url}}" stepKey="amOnNewBlockPage"/> <waitForPageLoad stepKey="waitForPageLoad1"/> <fillField selector="{{BlockNewPageBasicFieldsSection.blockTitle}}" userInput="{{_defaultBlock.title}}" stepKey="fillFieldTitle1"/> <fillField selector="{{BlockNewPageBasicFieldsSection.identifier}}" userInput="{{_defaultBlock.identifier}}" stepKey="fillFieldIdentifier"/> @@ -76,7 +76,7 @@ <click selector="{{CmsPagesPageActionsSection.FilterBtn}}" stepKey="clickFiltersBtn" /> <fillField selector="{{CmsPagesPageActionsSection.URLKey}}" userInput="$$createCMSPage.identifier$$" stepKey="fillOutURLKey" /> <click selector="{{CmsPagesPageActionsSection.ApplyFiltersBtn}}" stepKey="clickApplyBtn" /> - <waitForLoadingMaskToDisappear stepKey="waitForLoading9" /> + <waitForLoadingMaskToDisappear stepKey="waitForLoading7" /> <actionGroup ref="SortByIdDescendingActionGroup" stepKey="sortByIdDescending" /> <waitForElementVisible selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="waitForCMSPageGrid" /> <click selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="clickSelect" /> @@ -89,16 +89,16 @@ <click selector="{{TinyMCESection.InsertWidgetIcon}}" stepKey="clickInsertWidgetIcon" /> <waitForPageLoad stepKey="waitForPageLoad8" /> <selectOption selector="{{WidgetSection.WidgetType}}" userInput="CMS Static Block" stepKey="selectCMSStaticBlock" /> - <waitForLoadingMaskToDisappear stepKey="waitForLoading7" /> + <waitForLoadingMaskToDisappear stepKey="waitForLoading8" /> <selectOption selector="{{WidgetSection.WidgetTemplate}}" userInput="CMS Static Block Default Template" stepKey="selectTemplate" /> <click selector="{{WidgetSection.BtnChooser}}" stepKey="clickSelectPageBtn" /> - <waitForLoadingMaskToDisappear stepKey="waitForLoading8" /> + <waitForLoadingMaskToDisappear stepKey="waitForLoading9" /> <actionGroup ref="SortByIdDescendingActionGroup" stepKey="sortByIdDescending2" /> <waitForElementVisible selector="{{WidgetSection.BlockPage(_defaultBlock.identifier)}}" stepKey="waitForBlockTitle" /> <click selector="{{WidgetSection.BlockPage(_defaultBlock.identifier)}}" stepKey="selectPreCreateBlock" /> <wait time="3" stepKey="wait1" /> <click selector="{{WidgetSection.InsertWidget}}" stepKey="clickInsertWidgetBtn" /> - <waitForLoadingMaskToDisappear stepKey="waitForLoading9" /> + <waitForLoadingMaskToDisappear stepKey="waitForLoading10" /> <waitForPageLoad stepKey="waitForPageLoad9" /> <click selector="{{CmsNewPagePageActionsSection.savePage}}" stepKey="clickSavePage"/> <waitForPageLoad stepKey="waitForPageLoad10"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml index 5f92a5766a65c..cdabb43bd4658 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGBlockCest.xml @@ -32,8 +32,8 @@ <fillField selector="{{StoreConfigSection.City}}" userInput="{{_defaultVariable.city}}" stepKey="fillCity" /> <click selector="{{StoreConfigSection.Save}}" stepKey="saveConfig"/> <!--Main test--> - <amOnPage url="{{BlocksPage.url}}" stepKey="amOnNewBlockPage"/> - <waitForPageLoad stepKey="waitForPageLoad2"/> + <amOnPage url="{{CmsNewBlock.url}}" stepKey="amOnNewBlockPage"/> + <waitForPageLoad stepKey="waitForGridToLoad"/> <fillField selector="{{BlockNewPageBasicFieldsSection.blockTitle}}" userInput="{{_defaultBlock.title}}" stepKey="fillFieldTitle1"/> <fillField selector="{{BlockNewPageBasicFieldsSection.identifier}}" userInput="{{_defaultBlock.identifier}}" stepKey="fillFieldIdentifier"/> <selectOption selector="{{BlockNewPageBasicFieldsSection.storeView}}" userInput="All Store View" stepKey="selectAllStoreView" /> @@ -78,6 +78,8 @@ <click selector="{{BlockNewPagePageActionsSection.saveBlock}}" stepKey="clickSaveBlock"/> <amOnPage url="{{CmsPagesPage.url}}" stepKey="amOnEditPage"/> <waitForPageLoad stepKey="waitForPageLoad7"/> + <conditionalClick selector="{{BlockPageActionsSection.clearAll}}" dependentSelector="{{BlockPageActionsSection.activeFilters}}" stepKey="clickToResetFilter1" visible="true"/> + <waitForPageLoad stepKey="waitForFilterReload"/> <click selector="{{CmsPagesPageActionsSection.FilterBtn}}" stepKey="clickFiltersBtn" /> <fillField selector="{{CmsPagesPageActionsSection.URLKey}}" userInput="$$createCMSPage.identifier$$" stepKey="fillOutURLKey" /> <click selector="{{CmsPagesPageActionsSection.ApplyFiltersBtn}}" stepKey="clickApplyBtn" /> @@ -109,6 +111,8 @@ <click selector="{{CmsNewPagePageActionsSection.savePage}}" stepKey="clickSavePage"/> <waitForPageLoad stepKey="waitForPageLoadAfterSaveCmsPage" /> <see userInput="You saved the page." stepKey="seeSuccessMessage"/> + <conditionalClick selector="{{BlockPageActionsSection.clearAll}}" dependentSelector="{{BlockPageActionsSection.activeFilters}}" stepKey="clickToResetFilter" visible="true"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> <amOnPage url="$$createCMSPage.identifier$$" stepKey="amOnPageTestPage1"/> <waitForPageLoad stepKey="waitForPageLoad11" /> <!--see Default Variable on Storefront--> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml index 23384f1c04a73..36f997cfd3849 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddVariableToWYSIWYGCMSCest.xml @@ -86,8 +86,9 @@ <see userInput="{{customVariable.html}}" stepKey="seeCustomVariable2" /> <!--Delete Custom Variable--> <actionGroup ref="DeleteCustomVariableActionGroup" stepKey="deleteCustomVariable" /> + <actionGroup ref="ClearCacheActionGroup" stepKey="clearCache" /> <!--Refresh Storefront--> - <amOnPage url="{{_defaultCmsPage.identifier}}" stepKey="amOnPageTestPage"/> + <amOnPage url="{{_defaultCmsPage.identifier}}" stepKey="amOnPageTestPageRefresh"/> <waitForPageLoad stepKey="waitForPageLoad7" /> <!--see custom variable blank--> <dontSee userInput="{{customVariable.html}}" stepKey="dontSeeCustomVariableName" /> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml index e6963d5b9def4..22d7661b2b952 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGBlockCest.xml @@ -24,7 +24,7 @@ <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> - <amOnPage url="{{BlocksPage.url}}" stepKey="amOnNewBlockPage"/> + <amOnPage url="{{CmsNewBlock.url}}" stepKey="amOnNewBlockPage"/> <waitForPageLoad stepKey="waitForPageLoad1"/> <fillField selector="{{BlockNewPageBasicFieldsSection.blockTitle}}" userInput="{{_defaultBlock.title}}" stepKey="fillFieldTitle"/> <fillField selector="{{BlockNewPageBasicFieldsSection.identifier}}" userInput="{{_defaultBlock.identifier}}" stepKey="fillFieldIdentifier"/> @@ -50,7 +50,7 @@ <click selector="{{CmsPagesPageActionsSection.FilterBtn}}" stepKey="clickFiltersBtn" /> <fillField selector="{{CmsPagesPageActionsSection.URLKey}}" userInput="$$createCMSPage.identifier$$" stepKey="fillOutURLKey" /> <click selector="{{CmsPagesPageActionsSection.ApplyFiltersBtn}}" stepKey="clickApplyBtn" /> - <waitForLoadingMaskToDisappear stepKey="waitForLoading3" /> + <waitForLoadingMaskToDisappear stepKey="waitForLoading1" /> <actionGroup ref="SortByIdDescendingActionGroup" stepKey="sortByIdDescending" /> <waitForElementVisible selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="waitForCMSPageGrid" /> <click selector="{{CmsPagesPageActionsSection.select('$$createCMSPage.identifier$$')}}" stepKey="clickSelect" /> @@ -72,7 +72,7 @@ <click selector="{{WidgetSection.BlockPage(_defaultBlock.identifier)}}" stepKey="selectPreCreateBlock" /> <wait time="3" stepKey="wait1" /> <click selector="{{WidgetSection.InsertWidget}}" stepKey="clickInsertWidgetBtn" /> - <waitForLoadingMaskToDisappear stepKey="waitForLoading" /> + <waitForLoadingMaskToDisappear stepKey="waitForLoading2" /> <waitForPageLoad stepKey="waitForPageLoad6" /> <click selector="{{CmsNewPagePageActionsSection.savePage}}" stepKey="clickSavePage"/> <see userInput="You saved the page." stepKey="seeSuccessMessage"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeCest.xml index 3e50ce671cd3c..bbcca1571db54 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeCest.xml @@ -53,6 +53,7 @@ <waitForLoadingMaskToDisappear stepKey="waitForLoading" /> <scrollTo selector="{{CmsNewPagePageSeoSection.header}}" stepKey="scrollToSearchEngineTab" /> <click selector="{{CmsNewPagePageSeoSection.header}}" stepKey="clickExpandSearchEngineOptimisation"/> + <wait stepKey="waitForPageLoad5" time="10" /> <fillField selector="{{CmsNewPagePageSeoSection.urlKey}}" userInput="{{_defaultCmsPage.identifier}}" stepKey="fillFieldUrlKey"/> <click selector="{{CmsNewPagePageActionsSection.savePage}}" stepKey="clickSavePage"/> <see userInput="You saved the page." stepKey="seeSuccessMessage"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml index 66ae4a5d1cc53..102de9727adb6 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeCest.xml @@ -64,13 +64,13 @@ <waitForPageLoad stepKey="waitForPage" /> <click selector="{{WidgetSection.CompareBtn}}" stepKey="clickCompareBtn" /> <amOnPage url="$$createPreReqCategory.name$$.html" stepKey="amOnCatalogPage" /> - <waitForPageLoad stepKey="waitForPage" /> <waitForPageLoad stepKey="waitForPage1" /> + <waitForPageLoad stepKey="waitForPage2" /> <waitForElementVisible selector="{{WidgetSection.ClearCompare}}" stepKey="waitForClearBtn" /> <click selector="{{WidgetSection.ClearCompare}}" stepKey="clickClearCompareBtn" /> <waitForElementVisible selector="{{WidgetSection.AcceptClear}}" stepKey=""/> <click selector="{{WidgetSection.AcceptClear}}" stepKey="acceptClearCompare" /> - <waitForPageLoad stepKey="waitForPage2" /> + <waitForPageLoad stepKey="waitForPage3" /> <amOnPage url="{{_defaultCmsPage.identifier}}" stepKey="amOnPageTestPage"/> <waitForPageLoad stepKey="wait5" /> <!--see widget on Storefront--> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminCreateCmsPageTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminCreateCmsPageTest.xml index bbbb282c17678..f8b3c3733a827 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminCreateCmsPageTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminCreateCmsPageTest.xml @@ -16,13 +16,15 @@ <description value="You should be able to create a CMS Page via the Admin."/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-25580"/> - <group value="cms"/> + <group value="Cms"/> </annotations> + <before> + <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> + <actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/> + </before> <after> <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> </after> - - <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> <amOnPage url="{{CmsPagesPage.url}}" stepKey="amOnPagePagesGrid"/> <waitForPageLoad stepKey="waitForPageLoad1"/> <click selector="{{CmsPagesPageActionsSection.addNewPage}}" stepKey="clickAddNewPage"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml index c6faf6bdce28f..7e9685814348f 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockCest.xml @@ -24,7 +24,7 @@ <actionGroup ref="EnabledWYSIWYG" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> - <amOnPage url="{{BlocksPage.url}}" stepKey="amOnNewBlockPage"/> + <amOnPage url="{{CmsNewBlock.url}}" stepKey="amOnNewBlockPage"/> <waitForPageLoad stepKey="waitForPageLoad1"/> <fillField selector="{{BlockNewPageBasicFieldsSection.blockTitle}}" userInput="{{_defaultBlock.title}}" stepKey="fillFieldTitle"/> <fillField selector="{{BlockNewPageBasicFieldsSection.identifier}}" userInput="{{_defaultBlock.identifier}}" stepKey="fillFieldIdentifier"/> @@ -41,6 +41,8 @@ <click selector="{{BlockNewPagePageActionsSection.saveBlock}}" stepKey="clickSaveBlock"/> <amOnPage url="{{CmsPagesPage.url}}" stepKey="amOnEditPage"/> <waitForPageLoad stepKey="waitForPageLoad2"/> + <conditionalClick selector="{{BlockPageActionsSection.clearAll}}" dependentSelector="{{BlockPageActionsSection.activeFilters}}" stepKey="clickToResetFilter" visible="true"/> + <waitForPageLoad stepKey="waitForGridReload"/> <click selector="{{CmsPagesPageActionsSection.FilterBtn}}" stepKey="clickFiltersBtn" /> <fillField selector="{{CmsPagesPageActionsSection.URLKey}}" userInput="$$createPreReqCMSPage.identifier$$" stepKey="fillOutURLKey" /> <click selector="{{CmsPagesPageActionsSection.ApplyFiltersBtn}}" stepKey="clickApplyBtn" /> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/Page/AdminConfigPage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/Page/AdminConfigPage.xml index 870a172b38dcf..9ae1ecab1c26e 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/Page/AdminConfigPage.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Config/Page/AdminConfigPage.xml @@ -9,4 +9,7 @@ <page name="AdminConfigPage" url="admin/system_config/" area="admin" module="Magento_Config"> <section name="AdminConfigSection"/> </page> + <page name="AdminContentManagementPage" url="admin/system_config/edit/section/cms/" area="admin" module="Magento_Config"> + <section name="ContentManagementSection"/> + </page> </pages> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Section/NewsletterTemplateSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Section/NewsletterTemplateSection.xml index bda79f52a131a..53b44ddd33527 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Section/NewsletterTemplateSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Section/NewsletterTemplateSection.xml @@ -15,6 +15,7 @@ <element name="save" type="button" selector="button[data-role='template-save']"/> </section> <section name="NewsletterWYSIWYGSection"> + <element name="TextArea" type="text" selector="#text" /> <element name="TinyMCE4" type="text" selector=".mce-branding-powered-by" /> <element name="TinyMCE3" type="text" selector="#cms_page_form_content_tbl"/> <element name="ShowHideBtn" type="button" selector="#toggletext"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddVariableToWYSIWYGNewsletterCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddVariableToWYSIWYGNewsletterCest.xml index fa40177cc9fa3..ae2f33f92bace 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddVariableToWYSIWYGNewsletterCest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Test/AdminAddVariableToWYSIWYGNewsletterCest.xml @@ -32,7 +32,7 @@ <click selector="{{StoreConfigSection.Save}}" stepKey="saveConfig"/> <!--Main test--> <amOnPage url="{{NewsletterTemplateForm.url}}" stepKey="amOnNewsletterTemplatePage"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> + <waitForPageLoad stepKey="waitForPageLoad2"/> <fillField selector="{{BasicFieldNewsletterSection.templateName}}" userInput="{{_defaultNewsletter.name}}" stepKey="fillTemplateName" /> <fillField selector="{{BasicFieldNewsletterSection.templateSubject}}" userInput="{{_defaultNewsletter.subject}}" stepKey="fillTemplateSubject" /> <fillField selector="{{BasicFieldNewsletterSection.senderName}}" userInput="{{_defaultNewsletter.senderName}}" stepKey="fillSenderName" /> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SampleTemplates/Test/TemplateTestFile.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SampleTemplates/Test/TemplateTestFile.xml index 8b7270673aba0..1610e4dfa2cbb 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SampleTemplates/Test/TemplateTestFile.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SampleTemplates/Test/TemplateTestFile.xml @@ -8,7 +8,7 @@ <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name=""> + <test name="templateTestName"> <annotations> <features value=""/> <stories value=""/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SampleTests/Test/SampleTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SampleTests/Test/SampleTest.xml index 955958a5cf722..9e4a470b88950 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SampleTests/Test/SampleTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SampleTests/Test/SampleTest.xml @@ -56,7 +56,7 @@ <dontSeeCookie userInput="cookieName" stepKey="dontSeeCookie1"/> <dontSeeCookie userInput="cookieName" parameterArray="['domainName' => 'stuff']" stepKey="dontSeeCookie2"/> <dontSeeCurrentUrlEquals url="/stuff" stepKey="dontSeeCurrentUrlEquals"/> - <dontSeeCurrentUrlMatches url="~$/users/(\d+)~" stepKey="dontSeeCurrentUrlMatches"/> + <dontSeeCurrentUrlMatches regex="~$/users/(\d+)~" stepKey="dontSeeCurrentUrlMatches"/> <dontSeeElement selector=".error" stepKey="dontSeeElement1"/> <dontSeeElement selector="input" parameterArray="['name' => 'login']" stepKey="dontSeeElement2"/> <dontSeeElementInDOM selector="#stuff" stepKey="dontSeeElementInDOM1"/> @@ -79,7 +79,7 @@ <fillField selectorArray="['name' => 'email']" userInput="stuff" stepKey="fillField2"/> <grabAttributeFrom selector="#target" userInput="title" stepKey="grabAttributeFrom"/> <grabCookie userInput="cookie" parameterArray="['domain' => 'www.google.com']" stepKey="grabCookie"/> - <grabFromCurrentUrl url="~$/user/(\d+)/~" stepKey="grabFromCurrentUrl"/> + <grabFromCurrentUrl regex="~$/user/(\d+)/~" stepKey="grabFromCurrentUrl"/> <grabMultiple selector="a" userInput="href" stepKey="grabMultiple"/> <grabPageSource stepKey="grabPageSource1"/> <grabTextFrom selector="h1" stepKey="grabTextFrom1"/> @@ -119,7 +119,7 @@ <seeCookie userInput="PHPSESSID" stepKey="seeCookie1"/> <seeCookie userInput="PHPSESSID" parameterArray="['domainName' => 'www.google.com']" stepKey="seeCookie2"/> <seeCurrentUrlEquals url="/" stepKey="seeCurrentUrlEquals"/> - <seeCurrentUrlMatches url="~$/users/(\d+)~" stepKey="seeCurrentUrlMatches"/> + <seeCurrentUrlMatches regex="~$/users/(\d+)~" stepKey="seeCurrentUrlMatches"/> <seeElement selector=".error" stepKey="seeElement1"/> <seeElement selectorArray="['css' => 'form input']" stepKey="seeElement2"/> <seeElement selector=".error" parameterArray="['name' => 'login']" stepKey="seeElement3"/> @@ -217,7 +217,7 @@ <dontSee userInput="{$randomStuff}" stepKey="dontSee1"/> <dontSeeCookie userInput="{$randomStuff}" stepKey="dontSeeCookie1"/> <dontSeeCurrentUrlEquals url="{$randomStuff}" stepKey="dontSeeCurrentUrlEquals1"/> - <dontSeeCurrentUrlMatches url="{$randomStuff}" stepKey="dontSeeCurrentUrlMatches1"/> + <dontSeeCurrentUrlMatches regex="{$randomStuff}" stepKey="dontSeeCurrentUrlMatches1"/> <dontSeeInCurrentUrl url="{$randomStuff}" stepKey="dontSeeInCurrentUrl1"/> <dontSeeInField selector="#stuff" userInput="{$randomStuff}" stepKey="dontSeeInField1"/> <dontSeeInPageSource userInput="{$randomStuff}" stepKey="dontSeeInPageSource1"/> @@ -227,7 +227,7 @@ <fillField userInput="{$randomStuff}" selector="#field" stepKey="fillField1"/> <grabAttributeFrom selector="#stuff" userInput="{$randomStuff}" stepKey="grabAttributeFrom1"/> <grabCookie userInput="{$randomStuff}" stepKey="grabValueFrom1"/> - <grabFromCurrentUrl url="{$randomStuff}" stepKey="grabFromCurrentUrl"/> + <grabFromCurrentUrl regex="{$randomStuff}" stepKey="grabFromCurrentUrl"/> <grabMultiple selector="a" userInput="{$randomStuff}" stepKey="grabMultiple1"/> <loadSessionSnapshot userInput="{$randomStuff}" stepKey="loadSessionSnapshot"/> <pressKey selector="a" userInput="{$randomStuff}" stepKey="pressKey1"/> @@ -235,7 +235,7 @@ <see userInput="{$randomStuff}" stepKey="see1"/> <seeCookie userInput="{$randomStuff}" stepKey="seeCookie1"/> <seeCurrentUrlEquals url="{$randomStuff}" stepKey="seeCurrentUrlEquals1"/> - <seeCurrentUrlMatches url="{$randomStuff}" stepKey="seeCurrentUrlMatches1"/> + <seeCurrentUrlMatches regex="{$randomStuff}" stepKey="seeCurrentUrlMatches1"/> <seeInCurrentUrl url="{$randomStuff}" stepKey="seeInCurrentUrl1"/> <seeInField selector="a" userInput="{$randomStuff}" stepKey="seeInField1"/> <seeInPopup userInput="{$randomStuff}" stepKey="seeInPopup"/> @@ -245,9 +245,9 @@ <seeOptionIsSelected selector="#stuff" userInput="{$randomStuff}" stepKey="seeOptionIsSelected1"/> <selectOption selector="#stuff" userInput="{$randomStuff}" stepKey="selectOption1"/> <switchToIFrame userInput="{$randomStuff}" stepKey="switchToIFrame1"/> - <switchToNextTab userInput="{$randomStuff}" stepKey="switchToNextTab1"/> + <switchToNextTab userInput="{$randomStuff}" stepKey="switchToNextTab2"/> <switchToPreviousTab userInput="{$randomStuff}" stepKey="switchToPreviousTab1"/> - <switchToNextTab userInput="{$randomStuff}" stepKey="switchToNextTab1"/> + <switchToNextTab userInput="{$randomStuff}" stepKey="switchToNextTab3"/> <switchToWindow userInput="{$randomStuff}" stepKey="switchToWindow1"/> <typeInPopup userInput="{$randomStuff}" stepKey="typeInPopup"/> <unselectOption selector="#option" userInput="{$randomStuff}" stepKey="unselectOption1"/> diff --git a/dev/tests/api-functional/_files/Magento/TestModule3/Service/V1/Error.php b/dev/tests/api-functional/_files/Magento/TestModule3/Service/V1/Error.php index 6e681fbdd4687..3713396e5dd26 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule3/Service/V1/Error.php +++ b/dev/tests/api-functional/_files/Magento/TestModule3/Service/V1/Error.php @@ -5,6 +5,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\TestModule3\Service\V1; use Magento\Framework\Exception\AuthorizationException; @@ -63,7 +64,7 @@ public function serviceException() */ public function authorizationException() { - throw new AuthorizationException(__('Consumer is not authorized to access %1', 'resourceN')); + throw new AuthorizationException(__("The consumer isn't authorized to access %1.", 'resourceN')); } /** diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/AttributeSetManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/AttributeSetManagementTest.php index c645712dafca1..8ad55207b5f8b 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/AttributeSetManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/AttributeSetManagementTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Api; use Magento\TestFramework\Helper\Bootstrap; @@ -82,7 +83,6 @@ public function testCreateThrowsExceptionIfGivenAttributeSetAlreadyHasId() /** * @expectedException \Exception - * @expectedExceptionMessage Can not create attribute set based on not existing attribute set */ public function testCreateThrowsExceptionIfGivenSkeletonIdIsInvalid() { @@ -95,11 +95,14 @@ public function testCreateThrowsExceptionIfGivenSkeletonIdIsInvalid() 'skeletonId' => 0, ]; $this->_webApiCall($this->createServiceInfo, $arguments); + + $this->expectExceptionMessage( + "The attribute set couldn't be created because it's based on a non-existing attribute set." + ); } /** * @expectedException \Exception - * @expectedExceptionMessage Can not create attribute set based on non product attribute set. */ public function testCreateThrowsExceptionIfGivenSkeletonIdHasWrongEntityType() { @@ -112,11 +115,14 @@ public function testCreateThrowsExceptionIfGivenSkeletonIdHasWrongEntityType() 'skeletonId' => 7, ]; $this->_webApiCall($this->createServiceInfo, $arguments); + + $this->expectExceptionMessage( + "The attribute set couldn't be created because it's based on a non-product attribute set." + ); } /** * @expectedException \Exception - * @expectedExceptionMessage Can not create attribute set based on not existing attribute set */ public function testCreateThrowsExceptionIfGivenSkeletonAttributeSetDoesNotExist() { @@ -129,11 +135,15 @@ public function testCreateThrowsExceptionIfGivenSkeletonAttributeSetDoesNotExist 'skeletonId' => 9999, ]; $this->_webApiCall($this->createServiceInfo, $arguments); + + $this->expectExceptionMessage( + "The attribute set couldn't be created because it's based on a non-existing attribute set." + ); } /** * @expectedException \Exception - * @expectedExceptionMessage Attribute set name is empty. + * @expectedExceptionMessage The attribute set name is empty. Enter the name and try again. */ public function testCreateThrowsExceptionIfAttributeSetNameIsEmpty() { @@ -156,7 +166,7 @@ public function testCreateThrowsExceptionIfAttributeSetWithGivenNameAlreadyExist $entityTypeCode = 'catalog_product'; $entityType = $this->getEntityTypeByCode($entityTypeCode); $attributeSetName = 'Default'; - $expectedMessage = 'An attribute set named "Default" already exists.'; + $expectedMessage = 'A "Default" attribute set name already exists. Create a new name and try again.'; $arguments = [ 'attributeSet' => [ diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeManagementTest.php index 13e927be66d66..810e533f1f2f8 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeManagementTest.php @@ -57,7 +57,7 @@ public function testAssignAttributeWrongAttributeSet() $payload = $this->getAttributeData(); $payload['attributeSetId'] = -1; - $expectedMessage = 'AttributeSet with id "%1" does not exist.'; + $expectedMessage = 'The AttributeSet with a "%1" ID doesn\'t exist. Verify the attributeSet and try again.'; try { $this->_webApiCall($this->getAssignServiceInfo(), $payload); @@ -80,7 +80,7 @@ public function testAssignAttributeWrongAttributeGroup() { $payload = $this->getAttributeData(); $payload['attributeGroupId'] = -1; - $expectedMessage = 'Group with id "%1" does not exist.'; + $expectedMessage = 'The group with the "%1" ID doesn\'t exist. Verify the ID and try again.'; try { $this->_webApiCall($this->getAssignServiceInfo(), $payload); @@ -103,7 +103,8 @@ public function testAssignAttributeWrongAttribute() { $payload = $this->getAttributeData(); $payload['attributeCode'] = 'badCode'; - $expectedMessage = 'Attribute with attributeCode "%1" does not exist.'; + $expectedMessage = + 'The attribute with a "%1" attributeCode doesn\'t exist. Verify the attribute and try again.'; try { $this->_webApiCall($this->getAssignServiceInfo(), $payload); 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..0a990ab8d6a6b 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeMediaGalleryManagementInterfaceTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeMediaGalleryManagementInterfaceTest.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Api; use Magento\Framework\Api\Data\ImageContentInterface; @@ -384,7 +385,7 @@ public function testCreateThrowsExceptionIfProvidedImageHasWrongMimeType() /** * @expectedException \Exception - * @expectedExceptionMessage Requested product doesn't exist + * @expectedExceptionMessage The product that was requested doesn't exist. Verify the product and try again. */ public function testCreateThrowsExceptionIfTargetProductDoesNotExist() { @@ -433,7 +434,7 @@ public function testCreateThrowsExceptionIfProvidedImageNameContainsForbiddenCha /** * @expectedException \Exception - * @expectedExceptionMessage Requested product doesn't exist + * @expectedExceptionMessage The product that was requested doesn't exist. Verify the product and try again. */ public function testUpdateThrowsExceptionIfTargetProductDoesNotExist() { @@ -457,7 +458,7 @@ public function testUpdateThrowsExceptionIfTargetProductDoesNotExist() /** * @magentoApiDataFixture Magento/Catalog/_files/product_with_image.php * @expectedException \Exception - * @expectedExceptionMessage There is no image with provided ID. + * @expectedExceptionMessage No image with the provided ID was found. Verify the ID and try again. */ public function testUpdateThrowsExceptionIfThereIsNoImageWithGivenId() { @@ -481,7 +482,7 @@ public function testUpdateThrowsExceptionIfThereIsNoImageWithGivenId() /** * @expectedException \Exception - * @expectedExceptionMessage Requested product doesn't exist + * @expectedExceptionMessage The product that was requested doesn't exist. Verify the product and try again. */ public function testDeleteThrowsExceptionIfTargetProductDoesNotExist() { @@ -497,7 +498,7 @@ public function testDeleteThrowsExceptionIfTargetProductDoesNotExist() /** * @magentoApiDataFixture Magento/Catalog/_files/product_with_image.php * @expectedException \Exception - * @expectedExceptionMessage There is no image with provided ID. + * @expectedExceptionMessage No image with the provided ID was found. Verify the ID and try again. */ public function testDeleteThrowsExceptionIfThereIsNoImageWithGivenId() { @@ -609,7 +610,10 @@ public function testGetListForAbsentSku() 'sku' => $productSku, ]; if (TESTS_WEB_API_ADAPTER == self::ADAPTER_SOAP) { - $this->expectException('SoapFault', 'Requested product doesn\'t exist'); + $this->expectException( + 'SoapFault', + "The product that was requested doesn't exist. Verify the product and try again." + ); } else { $this->expectException('Exception', '', 404); } diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeRepositoryTest.php index e48c5ad018db4..5241e281b342d 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeRepositoryTest.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Api; use Magento\Framework\Webapi\Exception as HTTPExceptionCodes; @@ -243,7 +244,8 @@ public function testDeleteById() public function testDeleteNoSuchEntityException() { $attributeCode = 'some_test_code'; - $expectedMessage = 'Attribute with attributeCode "%1" does not exist.'; + $expectedMessage = + 'The attribute with a "%1" attributeCode doesn\'t exist. Verify the attribute and try again.'; $serviceInfo = [ 'rest' => [ 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 8791a47cef396..4f430d19a0a97 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Api; use Magento\Catalog\Api\Data\ProductInterface; @@ -100,7 +101,7 @@ public function testGetNoSuchEntityException() ], ]; - $expectedMessage = 'Requested product doesn\'t exist'; + $expectedMessage = "The product that was requested doesn't exist. Verify the product and try again."; try { $this->_webApiCall($serviceInfo, ['sku' => $invalidSku]); @@ -291,7 +292,7 @@ public function testCreateInvalidPriceFormat() { $this->_markTestAsRestOnly("In case of SOAP type casting is handled by PHP SoapServer, no need to test it"); $expectedMessage = 'Error occurred during "price" processing. ' - . 'Invalid type for value: "invalid_format". Expected Type: "float".'; + . 'The "invalid_format" value\'s type is invalid. The "float" type was expected. Verify and try again.'; try { $this->saveProduct(['name' => 'simple', 'price' => 'invalid_format', 'sku' => 'simple']); @@ -313,7 +314,10 @@ public function testDeleteAllStoreCode($fixtureProduct) { $sku = $fixtureProduct[ProductInterface::SKU]; $this->saveProduct($fixtureProduct); - $this->expectException('Exception', 'Requested product doesn\'t exist'); + $this->expectException( + 'Exception', + "The product that was requested doesn't exist. Verify the product and try again." + ); // Delete all with 'all' store code $this->deleteProduct($sku); diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/_files/product_options_update_negative.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/_files/product_options_update_negative.php index 1e713424f8047..2f9888b95b843 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/_files/product_options_update_negative.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/_files/product_options_update_negative.php @@ -17,6 +17,6 @@ 'sku' => 'sku1', 'max_characters' => 10, ], - 'ProductSku should be specified', + 'The ProductSku is empty. Set the ProductSku and try again.', ] ]; diff --git a/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/CartItemRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/CartItemRepositoryTest.php index 0ab81de07818a..c9cad5d597e65 100644 --- a/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/CartItemRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/CartItemRepositoryTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\ConfigurableProduct\Api; use Magento\TestFramework\TestCase\WebapiAbstract; @@ -105,7 +106,7 @@ public function testAddProductWithIncorrectOptions() /** * @magentoApiDataFixture Magento/ConfigurableProduct/_files/quote_with_configurable_product.php * @expectedException \Exception - * @expectedExceptionMessage Cart %1 does not contain item %2 + * @expectedExceptionMessage The %1 Cart doesn't contain the %2 item. */ public function testUpdateIncorrectItem() { diff --git a/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/OptionRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/OptionRepositoryTest.php index aac8be194d791..9c1caefd174e0 100644 --- a/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/OptionRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/OptionRepositoryTest.php @@ -85,7 +85,7 @@ public function testGetList() /** * @expectedException \Exception - * @expectedExceptionMessage Requested product doesn't exist + * @expectedExceptionMessage The product that was requested doesn't exist. Verify the product and try again. */ public function testGetUndefinedProduct() { @@ -98,7 +98,7 @@ public function testGetUndefinedProduct() */ public function testGetUndefinedOption() { - $expectedMessage = 'Requested option doesn\'t exist: %1'; + $expectedMessage = 'The "%1" entity that was requested doesn\'t exist. Verify the entity and try again.'; $productSku = 'configurable'; $attributeId = -42; try { diff --git a/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/ProductRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/ProductRepositoryTest.php index 40ebe0873ec3d..dc32bb2fc129a 100644 --- a/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/ProductRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/ProductRepositoryTest.php @@ -286,7 +286,7 @@ public function testUpdateConfigurableProductLinksWithNonExistingProduct() $productId1, $nonExistingId ]; - $expectedMessage = 'Unable to save product'; + $expectedMessage = 'The product was unable to be saved. Please try again.'; try { $this->saveProduct($response); $this->fail("Expected exception"); @@ -362,7 +362,7 @@ public function testUpdateConfigurableProductLinksWithWithoutVariationAttributes $productId1, $productId2 ]; - $expectedMessage = 'Unable to save product'; + $expectedMessage = 'The product was unable to be saved. Please try again.'; try { $this->saveProduct($response); $this->fail("Expected exception"); diff --git a/dev/tests/api-functional/testsuite/Magento/Customer/Api/AccountManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Customer/Api/AccountManagementTest.php index 452a59d7e702c..b0d1647d8b837 100644 --- a/dev/tests/api-functional/testsuite/Magento/Customer/Api/AccountManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Customer/Api/AccountManagementTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Customer\Api; use Magento\Customer\Api\Data\CustomerInterface as Customer; @@ -322,7 +323,7 @@ public function testValidateResetPasswordLinkTokenInvalidToken() ], ]; - $expectedMessage = 'Reset password token mismatch.'; + $expectedMessage = 'The password token is mismatched. Reset and try again.'; try { if (TESTS_WEB_API_ADAPTER == self::ADAPTER_SOAP) { @@ -366,13 +367,13 @@ public function testInitiatePasswordMissingRequiredFields() 'message' => 'One or more input exceptions have occurred.', 'errors' => [ [ - 'message' => '%fieldName is a required field.', + 'message' => '"%fieldName" is required. Enter and try again.', 'parameters' => [ 'fieldName' => 'email', ], ], [ - 'message' => '%fieldName is a required field.', + 'message' => '"%fieldName" is required. Enter and try again.', 'parameters' => [ 'fieldName' => 'template', ] @@ -575,8 +576,14 @@ public function testValidateCustomerData() $validationResponse = $this->_webApiCall($serviceInfo, $requestData); $this->assertFalse($validationResponse['valid']); - $this->assertEquals('The value of attribute "First Name" must be set', $validationResponse['messages'][0]); - $this->assertEquals('The value of attribute "Last Name" must be set', $validationResponse['messages'][1]); + $this->assertEquals( + 'The "First Name" attribute value is empty. Set the attribute and try again.', + $validationResponse['messages'][0] + ); + $this->assertEquals( + 'The "Last Name" attribute value is empty. Set the attribute and try again.', + $validationResponse['messages'][1] + ); } public function testIsReadonly() diff --git a/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerRepositoryTest.php index 5ddd077c7f40e..8da91a3dffc0e 100644 --- a/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerRepositoryTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Customer\Api; use Magento\Customer\Api\Data\CustomerInterface as Customer; @@ -146,7 +147,7 @@ public function tearDown() * Validate update by invalid customer. * * @expectedException \Exception - * @expectedExceptionMessage Consumer is not authorized to access %resources + * @expectedExceptionMessage The consumer isn't authorized to access %resources. */ public function testInvalidCustomerUpdate() { @@ -432,7 +433,7 @@ public function testCreateCustomerWithoutAddressRequiresException() $expectedException = new InputException(); $expectedException->addError( __( - '%fieldName is a required field.', + '"%fieldName" is required. Enter and try again.', ['fieldName' => Address::FIRSTNAME] ) ); @@ -447,7 +448,7 @@ public function testCreateCustomerWithoutAddressRequiresException() $this->assertEquals(HTTPExceptionCodes::HTTP_BAD_REQUEST, $e->getCode()); $exceptionData = $this->processRestExceptionResult($e); $expectedExceptionData = [ - 'message' => '%fieldName is a required field.', + 'message' => '"%fieldName" is required. Enter and try again.', 'parameters' => ['fieldName' => Address::FIRSTNAME], ]; $this->assertEquals($expectedExceptionData, $exceptionData); @@ -554,7 +555,7 @@ public function testSearchCustomersUsingGETEmptyFilter() $this->assertEquals(HTTPExceptionCodes::HTTP_BAD_REQUEST, $e->getCode()); $exceptionData = $this->processRestExceptionResult($e); $expectedExceptionData = [ - 'message' => '%fieldName is a required field.', + 'message' => '"%fieldName" is required. Enter and try again.', 'parameters' => [ 'fieldName' => 'searchCriteria' ], diff --git a/dev/tests/api-functional/testsuite/Magento/Customer/Api/GroupRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Customer/Api/GroupRepositoryTest.php index 7dfa5f7086857..999a2daa26065 100644 --- a/dev/tests/api-functional/testsuite/Magento/Customer/Api/GroupRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Customer/Api/GroupRepositoryTest.php @@ -279,7 +279,7 @@ public function testCreateGroupNoCodeExpectExceptionRest() } catch (\Exception $e) { // @codingStandardsIgnoreStart $this->assertContains( - '{"message":"%fieldName is a required field.","parameters":{"fieldName":"code"}', + '\"%fieldName\" is required. Enter and try again.","parameters":{"fieldName":"code"}', $e->getMessage(), "Exception does not contain expected message." ); @@ -606,7 +606,7 @@ public function testCreateGroupNoCodeExpectExceptionSoap() $this->fail("Expected exception"); } catch (\SoapFault $e) { $this->assertContains( - '%fieldName is a required field.', + '"%fieldName" is required. Enter and try again.', $e->getMessage(), "SoapFault does not contain expected message." ); diff --git a/dev/tests/api-functional/testsuite/Magento/Downloadable/Api/LinkRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Downloadable/Api/LinkRepositoryTest.php index 2cc528af3e84e..c881969a3b679 100644 --- a/dev/tests/api-functional/testsuite/Magento/Downloadable/Api/LinkRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Downloadable/Api/LinkRepositoryTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Downloadable\Api; use Magento\Catalog\Api\ProductRepositoryInterface; @@ -240,7 +241,7 @@ public function testCreateSavesProvidedUrls() /** * @magentoApiDataFixture Magento/Downloadable/_files/product_downloadable.php * @expectedException \Exception - * @expectedExceptionMessage Invalid link type. + * @expectedExceptionMessage The link type is invalid. Verify and try again. */ public function testCreateThrowsExceptionIfLinkTypeIsNotSpecified() { @@ -542,7 +543,7 @@ public function getInvalidNumberOfDownloads() /** * @magentoApiDataFixture Magento/Catalog/_files/product_simple.php * @expectedException \Exception - * @expectedExceptionMessage Provided product must be type 'downloadable'. + * @expectedExceptionMessage The product needs to be the downloadable type. Verify the product and try again. */ public function testCreateThrowsExceptionIfTargetProductTypeIsNotDownloadable() { @@ -567,7 +568,7 @@ public function testCreateThrowsExceptionIfTargetProductTypeIsNotDownloadable() /** * @expectedException \Exception - * @expectedExceptionMessage Requested product doesn't exist + * @expectedExceptionMessage The product that was requested doesn't exist. Verify the product and try again. */ public function testCreateThrowsExceptionIfTargetProductDoesNotExist() { @@ -662,7 +663,7 @@ public function testUpdateSavesDataInGlobalScopeAndDoesNotAffectValuesStoredInSt /** * @expectedException \Exception - * @expectedExceptionMessage Requested product doesn't exist + * @expectedExceptionMessage The product that was requested doesn't exist. Verify the product and try again. */ public function testUpdateThrowsExceptionIfTargetProductDoesNotExist() { @@ -687,7 +688,7 @@ public function testUpdateThrowsExceptionIfTargetProductDoesNotExist() /** * @magentoApiDataFixture Magento/Downloadable/_files/product_downloadable.php * @expectedException \Exception - * @expectedExceptionMessage There is no downloadable link with provided ID. + * @expectedExceptionMessage No downloadable link with the provided ID was found. Verify the ID and try again. */ public function testUpdateThrowsExceptionIfThereIsNoDownloadableLinkWithGivenId() { @@ -815,7 +816,7 @@ public function testDelete() /** * @expectedException \Exception - * @expectedExceptionMessage There is no downloadable link with provided ID. + * @expectedExceptionMessage No downloadable link with the provided ID was found. Verify the ID and try again. */ public function testDeleteThrowsExceptionIfThereIsNoDownloadableLinkWithGivenId() { @@ -849,7 +850,7 @@ public function testGetListForAbsentProduct($urlTail, $method) $requestData = ['sku' => $sku]; - $expectedMessage = 'Requested product doesn\'t exist'; + $expectedMessage = "The product that was requested doesn't exist. Verify the product and try again."; try { $this->_webApiCall($serviceInfo, $requestData); } catch (\SoapFault $e) { diff --git a/dev/tests/api-functional/testsuite/Magento/Downloadable/Api/SampleRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Downloadable/Api/SampleRepositoryTest.php index c3f9473d8f094..b537947d5e4db 100644 --- a/dev/tests/api-functional/testsuite/Magento/Downloadable/Api/SampleRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Downloadable/Api/SampleRepositoryTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Downloadable\Api; use Magento\Catalog\Model\Product; @@ -205,7 +206,7 @@ public function testCreateSavesProvidedUrls() /** * @magentoApiDataFixture Magento/Downloadable/_files/product_downloadable.php * @expectedException \Exception - * @expectedExceptionMessage Invalid sample type. + * @expectedExceptionMessage The sample type is invalid. Verify the sample type and try again. */ public function testCreateThrowsExceptionIfSampleTypeIsInvalid() { @@ -325,7 +326,7 @@ public function getInvalidSortOrder() /** * @magentoApiDataFixture Magento/Catalog/_files/product_simple.php * @expectedException \Exception - * @expectedExceptionMessage Provided product must be type 'downloadable'. + * @expectedExceptionMessage The product needs to be the downloadable type. Verify the product and try again. */ public function testCreateThrowsExceptionIfTargetProductTypeIsNotDownloadable() { @@ -345,7 +346,7 @@ public function testCreateThrowsExceptionIfTargetProductTypeIsNotDownloadable() /** * @expectedException \Exception - * @expectedExceptionMessage Requested product doesn't exist + * @expectedExceptionMessage The product that was requested doesn't exist. Verify the product and try again. */ public function testCreateThrowsExceptionIfTargetProductDoesNotExist() { @@ -422,7 +423,7 @@ public function testUpdateSavesDataInGlobalScopeAndDoesNotAffectValuesStoredInSt /** * @expectedException \Exception - * @expectedExceptionMessage Requested product doesn't exist + * @expectedExceptionMessage The product that was requested doesn't exist. Verify the product and try again. */ public function testUpdateThrowsExceptionIfTargetProductDoesNotExist() { @@ -443,7 +444,7 @@ public function testUpdateThrowsExceptionIfTargetProductDoesNotExist() /** * @magentoApiDataFixture Magento/Downloadable/_files/product_downloadable_with_files.php * @expectedException \Exception - * @expectedExceptionMessage There is no downloadable sample with provided ID. + * @expectedExceptionMessage No downloadable sample with the provided ID was found. Verify the ID and try again. */ public function testUpdateThrowsExceptionIfThereIsNoDownloadableSampleWithGivenId() { @@ -506,7 +507,7 @@ public function testDelete() /** * @expectedException \Exception - * @expectedExceptionMessage There is no downloadable sample with provided ID. + * @expectedExceptionMessage No downloadable sample with the provided ID was found. Verify the ID and try again. */ public function testDeleteThrowsExceptionIfThereIsNoDownloadableSampleWithGivenId() { diff --git a/dev/tests/api-functional/testsuite/Magento/Eav/Api/AttributeSetManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Eav/Api/AttributeSetManagementTest.php index 91576b7b049a2..17fc436b2e401 100644 --- a/dev/tests/api-functional/testsuite/Magento/Eav/Api/AttributeSetManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Eav/Api/AttributeSetManagementTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Eav\Api; use Magento\TestFramework\Helper\Bootstrap; @@ -145,7 +146,7 @@ public function testCreateThrowsExceptionIfGivenEntityTypeDoesNotExist() /** * @expectedException \Exception - * @expectedExceptionMessage Attribute set name is empty. + * @expectedExceptionMessage The attribute set name is empty. Enter the name and try again. */ public function testCreateThrowsExceptionIfAttributeSetNameIsEmpty() { @@ -169,7 +170,7 @@ public function testCreateThrowsExceptionIfAttributeSetWithGivenNameAlreadyExist $entityTypeCode = 'catalog_product'; $entityType = $this->getEntityTypeByCode($entityTypeCode); $attributeSetName = 'Default'; - $expectedMessage = 'An attribute set named "Default" already exists.'; + $expectedMessage = 'A "Default" attribute set name already exists. Create a new name and try again.'; $arguments = [ 'entityTypeCode' => $entityTypeCode, diff --git a/dev/tests/api-functional/testsuite/Magento/Eav/Api/AttributeSetRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Eav/Api/AttributeSetRepositoryTest.php index 611234ce9a54e..4e2d98279a4c4 100644 --- a/dev/tests/api-functional/testsuite/Magento/Eav/Api/AttributeSetRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Eav/Api/AttributeSetRepositoryTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Eav\Api; use Magento\Framework\Api\FilterBuilder; @@ -140,7 +141,7 @@ public function testDeleteById() /** * @expectedException \Exception - * @expectedExceptionMessage Default attribute set can not be deleted + * @expectedExceptionMessage The default attribute set can't be deleted. */ public function testDeleteByIdDefaultAttributeSet() { diff --git a/dev/tests/api-functional/testsuite/Magento/Integration/Model/AdminTokenServiceTest.php b/dev/tests/api-functional/testsuite/Magento/Integration/Model/AdminTokenServiceTest.php index 3fb7b3417b679..4b09361fe023b 100644 --- a/dev/tests/api-functional/testsuite/Magento/Integration/Model/AdminTokenServiceTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Integration/Model/AdminTokenServiceTest.php @@ -302,13 +302,13 @@ private function assertInputExceptionMessages($exception) 'message' => 'One or more input exceptions have occurred.', 'errors' => [ [ - 'message' => '%fieldName is a required field.', + 'message' => '"%fieldName" is required. Enter and try again.', 'parameters' => [ 'fieldName' => 'username', ], ], [ - 'message' => '%fieldName is a required field.', + 'message' => '"%fieldName" is required. Enter and try again.', 'parameters' => [ 'fieldName' => 'password', ] @@ -332,7 +332,8 @@ private function assertInvalidCredentialsException($exception) ); $exceptionData = $this->processRestExceptionResult($exception); $expectedExceptionData = [ - 'message' => 'You did not sign in correctly or your account is temporarily disabled.' + 'message' => 'The account sign-in was incorrect or your account is disabled temporarily. ' + . 'Please wait and try again later.' ]; $this->assertEquals($expectedExceptionData, $exceptionData, "Exception message is invalid."); } @@ -351,7 +352,7 @@ private function assertUnauthorizedAccessException($exception) ); $exceptionData = $this->processRestExceptionResult($exception); $expectedExceptionData = [ - 'message' => 'Consumer is not authorized to access %resources', + 'message' => "The consumer isn't authorized to access %resources.", 'parameters' => [ 'resources' => 'Magento_Backend::store' ] diff --git a/dev/tests/api-functional/testsuite/Magento/Integration/Model/CustomerTokenServiceTest.php b/dev/tests/api-functional/testsuite/Magento/Integration/Model/CustomerTokenServiceTest.php index 1e0a0cb49acc8..05e97a307fec1 100644 --- a/dev/tests/api-functional/testsuite/Magento/Integration/Model/CustomerTokenServiceTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Integration/Model/CustomerTokenServiceTest.php @@ -168,13 +168,13 @@ private function assertInputExceptionMessages($e) 'message' => 'One or more input exceptions have occurred.', 'errors' => [ [ - 'message' => '%fieldName is a required field.', + 'message' => '"%fieldName" is required. Enter and try again.', 'parameters' => [ 'fieldName' => 'username', ], ], [ - 'message' => '%fieldName is a required field.', + 'message' => '"%fieldName" is required. Enter and try again.', 'parameters' => [ 'fieldName' => 'password', ] @@ -286,7 +286,8 @@ private function assertInvalidCredentialsException($e) $this->assertEquals(HTTPExceptionCodes::HTTP_UNAUTHORIZED, $e->getCode(), "Response HTTP code is invalid."); $exceptionData = $this->processRestExceptionResult($e); $expectedExceptionData = [ - 'message' => 'You did not sign in correctly or your account is temporarily disabled.' + 'message' => 'The account sign-in was incorrect or your account is disabled temporarily. ' + . 'Please wait and try again later.' ]; $this->assertEquals($expectedExceptionData, $exceptionData, "Exception message is invalid."); } diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartManagementTest.php index 66102699bb8fd..80a4acbc563d6 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartManagementTest.php @@ -237,7 +237,7 @@ public function testAssignCustomerThrowsExceptionIfThereIsNoCartWithGivenId() /** * @magentoApiDataFixture Magento/Sales/_files/quote_with_customer.php * @expectedException \Exception - * @expectedExceptionMessage Cannot assign customer to the given cart. The cart is not anonymous. + * @expectedExceptionMessage The customer can't be assigned to the cart because the cart isn't anonymous. */ public function testAssignCustomerThrowsExceptionIfTargetCartIsNotAnonymous() { @@ -272,7 +272,7 @@ public function testAssignCustomerThrowsExceptionIfTargetCartIsNotAnonymous() * @magentoApiDataFixture Magento/Sales/_files/quote.php * @magentoApiDataFixture Magento/Customer/_files/customer_non_default_website_id.php * @expectedException \Exception - * @expectedExceptionMessage Cannot assign customer to the given cart. The cart belongs to different store. + * @expectedExceptionMessage The customer can't be assigned to the cart. The cart belongs to a different store. */ public function testAssignCustomerThrowsExceptionIfCartIsAssignedToDifferentStore() { @@ -309,7 +309,6 @@ public function testAssignCustomerThrowsExceptionIfCartIsAssignedToDifferentStor * @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php * @magentoApiDataFixture Magento/Sales/_files/quote.php * @expectedException \Exception - * @expectedExceptionMessage Cannot assign customer to the given cart. Customer already has active cart. */ public function testAssignCustomerThrowsExceptionIfCustomerAlreadyHasActiveCart() { @@ -344,6 +343,10 @@ public function testAssignCustomerThrowsExceptionIfCustomerAlreadyHasActiveCart( 'storeId' => 1, ]; $this->_webApiCall($serviceInfo, $requestData); + + $this->expectExceptionMessage( + "The customer can't be assigned to the cart because the customer already has an active cart." + ); } /** diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/CouponManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/CouponManagementTest.php index f50276fd6ce60..1aee493d8e0cb 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/CouponManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/CouponManagementTest.php @@ -80,7 +80,7 @@ public function testDelete() /** * @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php * @expectedException \Exception - * @expectedExceptionMessage Coupon code is not valid + * @expectedExceptionMessage The coupon code isn't valid. Verify the code and try again. */ public function testSetCouponThrowsExceptionIfCouponDoesNotExist() { @@ -215,7 +215,7 @@ public function testDeleteMyCoupon() /** * @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php * @expectedException \Exception - * @expectedExceptionMessage Coupon code is not valid + * @expectedExceptionMessage The coupon code isn't valid. Verify the code and try again. */ public function testSetMyCouponThrowsExceptionIfCouponDoesNotExist() { diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartManagementTest.php index e579fb3f62036..bbd1e59f83f90 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartManagementTest.php @@ -182,7 +182,7 @@ public function testAssignCustomerThrowsExceptionIfThereIsNoCartWithGivenId() /** * @magentoApiDataFixture Magento/Sales/_files/quote_with_customer.php * @expectedException \Exception - * @expectedExceptionMessage Cannot assign customer to the given cart. The cart is not anonymous. + * @expectedExceptionMessage The customer can't be assigned to the cart because the cart isn't anonymous. */ public function testAssignCustomerThrowsExceptionIfTargetCartIsNotAnonymous() { @@ -234,7 +234,6 @@ public function testAssignCustomerThrowsExceptionIfTargetCartIsNotAnonymous() * @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php * @magentoApiDataFixture Magento/Sales/_files/quote.php * @expectedException \Exception - * @expectedExceptionMessage Cannot assign customer to the given cart. Customer already has active cart. */ public function testAssignCustomerThrowsExceptionIfCustomerAlreadyHasActiveCart() { @@ -286,6 +285,10 @@ public function testAssignCustomerThrowsExceptionIfCustomerAlreadyHasActiveCart( 'storeId' => 1, ]; $this->_webApiCall($serviceInfo, $requestData); + + $this->expectExceptionMessage( + "The customer can't be assigned to the cart because the customer already has an active cart." + ); } /** @@ -330,7 +333,7 @@ public function testPlaceOrder() * @magentoApiDataFixture Magento/Sales/_files/quote.php * @magentoApiDataFixture Magento/Customer/_files/customer.php * @expectedException \Exception - * @expectedExceptionMessage Cannot assign customer to the given cart. You don't have permission for this operation. + * @expectedExceptionMessage You don't have the correct permissions to assign the customer to the cart. */ public function testAssignCustomerByGuestUser() { diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCouponManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCouponManagementTest.php index 8dddf99868e4a..9815cf888ff95 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCouponManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCouponManagementTest.php @@ -105,7 +105,7 @@ public function testDelete() /** * @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php * @expectedException \Exception - * @expectedExceptionMessage Coupon code is not valid + * @expectedExceptionMessage The coupon code isn't valid. Verify the code and try again. */ public function testSetCouponThrowsExceptionIfCouponDoesNotExist() { diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestPaymentMethodManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestPaymentMethodManagementTest.php index d0d0f865164c3..e8fa3a6dabce3 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestPaymentMethodManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestPaymentMethodManagementTest.php @@ -156,7 +156,7 @@ public function testSetPaymentWithSimpleProduct() /** * @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php * @expectedException \Exception - * @expectedExceptionMessage Shipping address is not set + * @expectedExceptionMessage The shipping address is missing. Set the address and try again. */ public function testSetPaymentWithSimpleProductWithoutAddress() { diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/PaymentMethodManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/PaymentMethodManagementTest.php index 6fa83f58587ad..64d5290d5c511 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/PaymentMethodManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/PaymentMethodManagementTest.php @@ -122,7 +122,7 @@ public function testSetPaymentWithSimpleProduct() /** * @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php * @expectedException \Exception - * @expectedExceptionMessage Shipping address is not set + * @expectedExceptionMessage The shipping address is missing. Set the address and try again. */ public function testSetPaymentWithSimpleProductWithoutAddress() { diff --git a/dev/tests/api-functional/testsuite/Magento/Tax/Api/TaxRateRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Tax/Api/TaxRateRepositoryTest.php index ffd6a3fe39043..3b379fc7e0eb0 100644 --- a/dev/tests/api-functional/testsuite/Magento/Tax/Api/TaxRateRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Tax/Api/TaxRateRepositoryTest.php @@ -171,7 +171,7 @@ public function testCreateTaxRateWithoutValue() ); } catch (\Exception $e) { $errorObj = $this->processRestExceptionResult($e); - $this->assertEquals('%fieldName is a required field.', $errorObj['message']); + $this->assertEquals('"%fieldName" is required. Enter and try again.', $errorObj['message']); $this->assertEquals(['fieldName' => 'percentage_rate'], $errorObj['parameters']); } } @@ -491,7 +491,7 @@ public function testCannotDeleteTaxRate() $this->_webApiCall($serviceInfo, ['rateId' => $taxRateId]); $this->fail('Expected exception was not raised'); } catch (\Exception $e) { - $expectedMessage = 'The tax rate cannot be removed. It exists in a tax rule.'; + $expectedMessage = "The tax rate can't be removed because it exists in a tax rule."; $this->assertContains( $expectedMessage, diff --git a/dev/tests/api-functional/testsuite/Magento/Webapi/DeserializationTest.php b/dev/tests/api-functional/testsuite/Magento/Webapi/DeserializationTest.php index 98ba33f940f2c..1e870204f00c1 100644 --- a/dev/tests/api-functional/testsuite/Magento/Webapi/DeserializationTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Webapi/DeserializationTest.php @@ -38,7 +38,8 @@ public function testPostRequestWithEmptyBody() 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, ], ]; - $expectedMessage = '{"message":"%fieldName is a required field.","parameters":{"fieldName":"item"}}'; + $expectedMessage = + '{"message":"\"%fieldName\" is required. Enter and try again.","parameters":{"fieldName":"item"}}'; try { $this->_webApiCall($serviceInfo, RestClient::EMPTY_REQUEST_BODY); } catch (\Exception $e) { @@ -64,7 +65,8 @@ public function testPutRequestWithEmptyBody() 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT, ], ]; - $expectedMessage = '{"message":"%fieldName is a required field.","parameters":{"fieldName":"entityItem"}}'; + $expectedMessage = + '{"message":"\"%fieldName\" is required. Enter and try again.","parameters":{"fieldName":"entityItem"}}'; try { $this->_webApiCall($serviceInfo, RestClient::EMPTY_REQUEST_BODY); } catch (\Exception $e) { diff --git a/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/BaseService.php b/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/BaseService.php index 853c92499aeed..8d59598d7ccc7 100644 --- a/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/BaseService.php +++ b/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/BaseService.php @@ -25,7 +25,7 @@ protected function assertUnauthorizedException($serviceInfo, $requestData = null $this->_assertSoapException( $serviceInfo, $requestData, - 'Consumer is not authorized to access %resources' + "The consumer isn't authorized to access %resources." ); } elseif (TESTS_WEB_API_ADAPTER == self::ADAPTER_REST) { $this->_assertRestUnauthorizedException($serviceInfo, $requestData); @@ -44,7 +44,7 @@ protected function _assertRestUnauthorizedException($serviceInfo, $requestData = $this->_webApiCall($serviceInfo, $requestData); } catch (\Exception $e) { $this->assertContains( - '{"message":"Consumer is not authorized to access %resources"', + '{"message":"The consumer isn\'t authorized to access %resources.', $e->getMessage(), sprintf( 'REST routing did not fail as expected for the method "%s" of service "%s"', diff --git a/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/RestErrorHandlingTest.php b/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/RestErrorHandlingTest.php index 29bb630ff6cd3..62400b1f30ce5 100644 --- a/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/RestErrorHandlingTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/RestErrorHandlingTest.php @@ -5,6 +5,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Webapi\Routing; use Magento\TestFramework\Helper\Bootstrap; @@ -72,7 +73,7 @@ public function testUnauthorized() $serviceInfo, [], WebapiException::HTTP_UNAUTHORIZED, - 'Consumer is not authorized to access %1', + "The consumer isn't authorized to access %1.", ['resourceN'] ); } diff --git a/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/SoapErrorHandlingTest.php b/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/SoapErrorHandlingTest.php index ffcb2e52acb72..61ba247645b31 100644 --- a/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/SoapErrorHandlingTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/SoapErrorHandlingTest.php @@ -110,7 +110,7 @@ public function testUnauthorized() } catch (\SoapFault $e) { $this->checkSoapFault( $e, - 'Consumer is not authorized to access %resources', + "The consumer isn't authorized to access %resources.", 'env:Sender' ); } diff --git a/dev/tests/api-functional/testsuite/Magento/Webapi/WsdlGenerationFromDataObjectTest.php b/dev/tests/api-functional/testsuite/Magento/Webapi/WsdlGenerationFromDataObjectTest.php index 840649cec8db8..86f27908a96d5 100644 --- a/dev/tests/api-functional/testsuite/Magento/Webapi/WsdlGenerationFromDataObjectTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Webapi/WsdlGenerationFromDataObjectTest.php @@ -71,7 +71,7 @@ public function testNoAuthorizedServices() curl_setopt($connection, CURLOPT_RETURNTRANSFER, 1); $responseContent = curl_exec($connection); $this->assertEquals(curl_getinfo($connection, CURLINFO_HTTP_CODE), 401); - $this->assertContains("Consumer is not authorized to access %resources", $responseContent); + $this->assertContains("The consumer isn't authorized to access %resources.", $responseContent); } public function testInvalidWsdlUrlNoServices() diff --git a/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli/Config.php b/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli/Config.php new file mode 100644 index 0000000000000..e7ce89a2c4ce9 --- /dev/null +++ b/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli/Config.php @@ -0,0 +1,45 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Mtf\Util\Command\Cli; + +use Magento\Mtf\Util\Command\Cli; + +/** + * Handle set configuration for test execution. + */ +class Config extends Cli +{ + /** + * Parameter for reindex command. + */ + const PARAM_CONFIG_SET = 'config:set'; + + /** + * Set configuration. + * + * @param string $path + * @param string $value + * @param string|null $scope + * @param string|null $scopeCode + * @return void + */ + public function setConfig($path, $value, $scope = null, $scopeCode = null) + { + $configurationString = ''; + + if ($scope !== null) { + $configurationString.= sprintf('--scope=%s ', $scope); + } + + if ($scopeCode !== null) { + $configurationString.= sprintf('--scope-code=%s ', $scopeCode); + } + $configurationString.= sprintf('%s %s', $path, $value); + + parent::execute(Config::PARAM_CONFIG_SET . ' ' . $configurationString); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/TestCase/OnePageCheckoutDeclinedTest.xml b/dev/tests/functional/tests/app/Magento/Authorizenet/Test/TestCase/OnePageCheckoutDeclinedTest.xml index 1c589afcc1e20..00c1a1557e05b 100644 --- a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/TestCase/OnePageCheckoutDeclinedTest.xml +++ b/dev/tests/functional/tests/app/Magento/Authorizenet/Test/TestCase/OnePageCheckoutDeclinedTest.xml @@ -17,7 +17,7 @@ <data name="payment/method" xsi:type="string">authorizenet_directpost</data> <data name="creditCard/dataset" xsi:type="string">visa_default</data> <data name="configData" xsi:type="string">authorizenet, authorizenet_wrong_credentials</data> - <data name="expectedErrorMessage" xsi:type="string">An error occurred on the server. Please try to place the order again.</data> + <data name="expectedErrorMessage" xsi:type="string">A server error stopped your order from being placed. Please try to place your order again.</data> <data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S2</data> <constraint name="Magento\Checkout\Test\Constraint\AssertCheckoutErrorMessage" /> </variation> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAttributeSetForm.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAttributeSetForm.php index 87ae650d7dc18..1facc65617906 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAttributeSetForm.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAttributeSetForm.php @@ -43,7 +43,7 @@ public function processAssert( \PHPUnit_Framework_Assert::assertEquals( $filterAttribute['set_name'], $productSetEdit->getAttributeSetEditBlock()->getAttributeSetName(), - 'Attribute Set not found' + 'The attribute set wasn\'t found.' . "\nExpected: " . $filterAttribute['set_name'] . "\nActual: " . $productSetEdit->getAttributeSetEditBlock()->getAttributeSetName() ); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAttributeSetNotInGrid.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAttributeSetNotInGrid.php index 945014371631d..0e465f218ccf8 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAttributeSetNotInGrid.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAttributeSetNotInGrid.php @@ -36,7 +36,8 @@ public function processAssert(CatalogProductSetIndex $productSetPage, CatalogAtt $productSetPage->open(); \PHPUnit_Framework_Assert::assertFalse( $productSetPage->getGrid()->isRowVisible($filterAttributeSet), - 'An attribute set named "' . $filterAttributeSet['set_name'] . '" is present in Attribute Set grid.' + 'A "' . $filterAttributeSet['set_name'] . + '" attribute set name already exists. Create a new name and try again.' ); } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAttributeSetOnProductForm.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAttributeSetOnProductForm.php index 64187b048f3d8..2a6ed4de08fb8 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAttributeSetOnProductForm.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAttributeSetOnProductForm.php @@ -66,7 +66,7 @@ public function processAssert( \PHPUnit_Framework_Assert::assertEquals( $attributeSet->getAttributeSetName(), $formAttributeSet, - 'Attribute Set not found on Product form.' + 'The attribute set wasn\'t found on product form.' . "\nExpected: " . $attributeSet->getAttributeSetName() . "\nActual: " . $formAttributeSet ); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductAttributeIsUnique.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductAttributeIsUnique.php index 1e417263abed8..688d2821e95f0 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductAttributeIsUnique.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductAttributeIsUnique.php @@ -25,7 +25,7 @@ class AssertProductAttributeIsUnique extends AbstractConstraint /** * Expected message. */ - const UNIQUE_MESSAGE = 'The value of attribute "%s" must be unique'; + const UNIQUE_MESSAGE = 'The value of the "%s" attribute isn\'t unique. Set a unique value and try again.'; /** * Fixture factory. diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchEmptyTerm.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchEmptyTerm.php index bb46f914aead6..1b2238ded9c54 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchEmptyTerm.php +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchEmptyTerm.php @@ -17,7 +17,7 @@ class AssertAdvancedSearchEmptyTerm extends AbstractConstraint /** * Specify search term error message. */ - const ERROR_MESSAGE = 'Please specify at least one search term.'; + const ERROR_MESSAGE = 'Enter a search term and try again.'; /** * Assert that error message is displayed after searching without entering any search terms. diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest.xml index 386ac28f6c472..4744fa7756c4e 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest.xml @@ -117,7 +117,7 @@ <constraint name="Magento\CatalogSearch\Test\Constraint\AssertAdvancedSearchNoResult" /> </variation> <variation name="AdvancedSearchEntityTestVariation15" summary="Do Advanced Search without entering data" ticketId="MAGETWO-14859"> - <data name="issue" xsi:type="string">MAGETWO-18537: "Please specify at least one search term." error message is missed in Advanced Search</data> + <data name="issue" xsi:type="string">MAGETWO-18537: "Enter a search term and try again." error message is missed in Advanced Search</data> <data name="productSearch/data/name" xsi:type="string" /> <constraint name="Magento\CatalogSearch\Test\Constraint\AssertAdvancedSearchEmptyTerm" /> </variation> diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SearchEntityResultsTest.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SearchEntityResultsTest.xml index d99ee5e234e4d..9a6a66091d427 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SearchEntityResultsTest.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SearchEntityResultsTest.xml @@ -102,7 +102,7 @@ <variation name="SearchEntityResultsTestVariation18" summary="Search Configurable Product with Enabled and Disabled Children." ticketId="MAGETWO-69181"> <data name="catalogSearch/data/query_text/value" xsi:type="string">configurableProduct::one_simple_product_not_visible_individually::name</data> <constraint name="Magento\CatalogSearch\Test\Constraint\AssertCatalogSearchResult" /> - <constraint name="Magento\CatalogSearch\Test\Constraint\AssertConfigurableWithDisabledOtpionCatalogSearchNoResult" /> + <constraint name="Magento\CatalogSearch\Test\Constraint\AssertConfigurableWithDisabledOptionCatalogSearchNoResult" /> </variation> </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertChangePasswordFailMessage.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertChangePasswordFailMessage.php index 1cc0a94f8812b..361a9d697e430 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertChangePasswordFailMessage.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertChangePasswordFailMessage.php @@ -18,7 +18,7 @@ class AssertChangePasswordFailMessage extends AbstractConstraint /** * Fail message */ - const FAIL_MESSAGE = 'The password doesn\'t match this account.'; + const FAIL_MESSAGE = "The password doesn't match this account. Verify the password and try again."; /** * Assert that fail message is present diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerBackendDuplicateErrorMessage.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerBackendDuplicateErrorMessage.php index d4658cd2206c4..805f4d923385a 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerBackendDuplicateErrorMessage.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerBackendDuplicateErrorMessage.php @@ -17,7 +17,7 @@ class AssertCustomerBackendDuplicateErrorMessage extends AbstractConstraint /** * Error save message text. */ - const ERROR_SAVE_MESSAGE = 'A customer with the same email already exists in an associated website.'; + const ERROR_SAVE_MESSAGE = 'A customer with the same email address already exists in an associated website.'; /** * Asserts that error message is displayed while creating customer with the same email. diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerLoginErrorMessage.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerLoginErrorMessage.php index 9cc30b25d37e7..d28faa7ff6fa7 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerLoginErrorMessage.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerLoginErrorMessage.php @@ -17,7 +17,8 @@ class AssertCustomerLoginErrorMessage extends AbstractConstraint /** * Customer login error message. */ - const ERROR_MESSAGE = 'You did not sign in correctly or your account is temporarily disabled.'; + const ERROR_MESSAGE = + 'The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later.'; /** * Assert that customer login error message is displayed. diff --git a/dev/tests/functional/tests/app/Magento/Integration/Test/Constraint/AssertIncorrectUserPassword.php b/dev/tests/functional/tests/app/Magento/Integration/Test/Constraint/AssertIncorrectUserPassword.php index d6308752e0df5..dbdd8f0c3708a 100644 --- a/dev/tests/functional/tests/app/Magento/Integration/Test/Constraint/AssertIncorrectUserPassword.php +++ b/dev/tests/functional/tests/app/Magento/Integration/Test/Constraint/AssertIncorrectUserPassword.php @@ -15,7 +15,7 @@ */ class AssertIncorrectUserPassword extends AbstractConstraint { - const ERROR_MESSAGE = "You have entered an invalid password for current user."; + const ERROR_MESSAGE = "The password entered for the current user is invalid. Verify the password and try again."; /** * Assert that an error message is displayed on the Integration page in case current user password is incorrect. diff --git a/dev/tests/functional/tests/app/Magento/Integration/Test/Constraint/AssertIntegrationNameDuplicationErrorMessage.php b/dev/tests/functional/tests/app/Magento/Integration/Test/Constraint/AssertIntegrationNameDuplicationErrorMessage.php index e07572d3aee40..d947e842830c8 100644 --- a/dev/tests/functional/tests/app/Magento/Integration/Test/Constraint/AssertIntegrationNameDuplicationErrorMessage.php +++ b/dev/tests/functional/tests/app/Magento/Integration/Test/Constraint/AssertIntegrationNameDuplicationErrorMessage.php @@ -15,7 +15,7 @@ */ class AssertIntegrationNameDuplicationErrorMessage extends AbstractConstraint { - const ERROR_DUPLICATE_INTEGRATION_NAME = "Integration with name '%s' exists."; + const ERROR_DUPLICATE_INTEGRATION_NAME = 'The integration with name "%s" exists.'; /** * Assert error message is displayed in message block. diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutDeclinedTest.xml b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutDeclinedTest.xml index 7a4a1863c4ae6..d4f75f483d725 100644 --- a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutDeclinedTest.xml +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutDeclinedTest.xml @@ -18,7 +18,7 @@ <data name="payment/method" xsi:type="string">payflowpro</data> <data name="creditCard/dataset" xsi:type="string">visa_default</data> <data name="configData" xsi:type="string">payflowpro, payflowpro_avs_street_does_not_match</data> - <data name="expectedErrorMessage" xsi:type="string">An error occurred on the server. Please try to place the order again.</data> + <data name="expectedErrorMessage" xsi:type="string">A server error stopped your order from being placed. Please try to place your order again.</data> <constraint name="Magento\Checkout\Test\Constraint\AssertCheckoutErrorMessage" /> </variation> <variation name="OnePageCheckoutDeclinedTestWithAVSZIP" summary="Place order via Payflow Pro with AVS ZIP verification fail" ticketId="MAGETWO-37483"> @@ -30,7 +30,7 @@ <data name="shipping/shipping_method" xsi:type="string">Fixed</data> <data name="payment/method" xsi:type="string">payflowpro</data> <data name="creditCard/dataset" xsi:type="string">visa_default</data> - <data name="expectedErrorMessage" xsi:type="string">An error occurred on the server. Please try to place the order again.</data> + <data name="expectedErrorMessage" xsi:type="string">A server error stopped your order from being placed. Please try to place your order again.</data> <data name="configData" xsi:type="string">payflowpro, payflowpro_use_avs_zip</data> <data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S1</data> <constraint name="Magento\Checkout\Test\Constraint\AssertCheckoutErrorMessage" /> @@ -46,7 +46,7 @@ <data name="payment/method" xsi:type="string">payflowpro</data> <data name="creditCard/dataset" xsi:type="string">visa_cvv_mismatch</data> <data name="configData" xsi:type="string">payflowpro, payflowpro_avs_security_code_does_not_match</data> - <data name="expectedErrorMessage" xsi:type="string">An error occurred on the server. Please try to place the order again.</data> + <data name="expectedErrorMessage" xsi:type="string">A server error stopped your order from being placed. Please try to place your order again.</data> <constraint name="Magento\Checkout\Test\Constraint\AssertCheckoutErrorMessage" /> </variation> </testCase> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Handler/OrderInjectable/Webapi.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Handler/OrderInjectable/Webapi.php index 508ea13b419ca..073fb0967144c 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Handler/OrderInjectable/Webapi.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Handler/OrderInjectable/Webapi.php @@ -171,7 +171,7 @@ protected function setCoupon(OrderInjectable $order) $this->webapiTransport->close(); if ($response !== true) { $this->eventManager->dispatchEvent(['webapi_failed'], [$response]); - throw new \Exception('Could not apply coupon code!'); + throw new \Exception("The coupon code couldn't be applied. Verify the coupon code and try again."); } } @@ -243,7 +243,7 @@ protected function setShippingInformation(OrderInjectable $order) $this->webapiTransport->close(); if (!isset($response['payment_methods'], $response['totals'])) { $this->eventManager->dispatchEvent(['webapi_failed'], [$response]); - throw new \Exception('Could not set shipping method to quote!'); + throw new \Exception("The shipping method can't be set to quote."); } } diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/Constraint/AssertCustomerIsLocked.php b/dev/tests/functional/tests/app/Magento/Security/Test/Constraint/AssertCustomerIsLocked.php index 4badb10085b17..ab9c001a3d65b 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/Constraint/AssertCustomerIsLocked.php +++ b/dev/tests/functional/tests/app/Magento/Security/Test/Constraint/AssertCustomerIsLocked.php @@ -15,7 +15,7 @@ class AssertCustomerIsLocked extends AbstractConstraint { const CUSTOMER_LOCKED_MESSAGE = - 'You did not sign in correctly or your account is temporarily disabled.'; + 'The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later.'; /** * Assert that customer locked message is present on customer login page. diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/Constraint/AssertCustomerResetPasswordFailed.php b/dev/tests/functional/tests/app/Magento/Security/Test/Constraint/AssertCustomerResetPasswordFailed.php index 3089f4b830568..914e9d88d15a1 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/Constraint/AssertCustomerResetPasswordFailed.php +++ b/dev/tests/functional/tests/app/Magento/Security/Test/Constraint/AssertCustomerResetPasswordFailed.php @@ -15,7 +15,8 @@ class AssertCustomerResetPasswordFailed extends AbstractConstraint { const TOO_MANY_RESET_REQUESTS_MESSAGE = - 'Too many password reset requests. Please wait and try again or contact hello@example.com.'; + 'We received too many requests for password resets. ' + . 'Please wait and try again later or contact hello@example.com.'; /** * Assert that customer forgot password message is present on customer account forgot password page. diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/Constraint/AssertUserIsLocked.php b/dev/tests/functional/tests/app/Magento/Security/Test/Constraint/AssertUserIsLocked.php index c302c9bdf35ec..22abf3d552464 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/Constraint/AssertUserIsLocked.php +++ b/dev/tests/functional/tests/app/Magento/Security/Test/Constraint/AssertUserIsLocked.php @@ -14,7 +14,8 @@ */ class AssertUserIsLocked extends AbstractConstraint { - const USER_ACCOUNT_DISABLED_MESSAGE = 'account is temporarily disabled'; + const USER_ACCOUNT_DISABLED_MESSAGE = 'The account sign-in was incorrect or your account is disabled temporarily. ' + . 'Please wait and try again later.'; /** * Verify that user account has been locked. diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/Constraint/AssertUserPasswordResetFailed.php b/dev/tests/functional/tests/app/Magento/Security/Test/Constraint/AssertUserPasswordResetFailed.php index 2de3bb54f1838..7faa93c94edb0 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/Constraint/AssertUserPasswordResetFailed.php +++ b/dev/tests/functional/tests/app/Magento/Security/Test/Constraint/AssertUserPasswordResetFailed.php @@ -15,7 +15,8 @@ class AssertUserPasswordResetFailed extends AbstractConstraint { const TOO_MANY_RESET_REQUESTS_MESSAGE = - 'Too many password reset requests. Please wait and try again or contact hello@example.com.'; + 'We received too many requests for password resets. ' + . 'Please wait and try again later or contact hello@example.com.'; /** * Assert that user reset password failed message is present on user login page. diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewIntegrationTest.php b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewIntegrationTest.php index 2562f57eb8041..778b04047952d 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewIntegrationTest.php +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewIntegrationTest.php @@ -24,7 +24,8 @@ * 3. Start to create new Integration. * 4. Fill in all data according to data set (password is incorrect). * 5. Perform action 4 specified number of times. - * 6. "You have entered an invalid password for current user." appears after each attempt. + * 6. "The password entered for the current user is invalid. Verify the password and try again." appears after each + * attempt. * 7. Perform all assertions. * * @ZephyrId MAGETWO-49038 diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewRoleTest.php b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewRoleTest.php index f3dbf81ba5a14..5a62b0d599ca4 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewRoleTest.php +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewRoleTest.php @@ -24,7 +24,8 @@ * 3. Start to create new User Role. * 4. Fill in all data according to data set (password is incorrect). * 5. Perform action 4 specified number of times. - * 6. "You have entered an invalid password for current user." appears after each attempt. + * 6. "The password entered for the current user is invalid. Verify the password and try again." appears after each + * attempt. * 7. Perform all assertions. * * @ZephyrId MAGETWO-49036 diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewUserTest.php b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewUserTest.php index 81b57dd5db88d..908f07456e0d8 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewUserTest.php +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenCreatingNewUserTest.php @@ -23,7 +23,8 @@ * 3. Click on Add New User. * 4. Fill in all data according to data set (password is incorrect). * 5. Perform action 4 specified number of times. - * 6. "You have entered an invalid password for current user." appears after each attempt. + * 6. "The password entered for the current user is invalid. Verify the password and try again." appears after each + * attempt. * 7. Perform all assertions. * * @ZephyrId MAGETWO-49034 diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenEditingIntegrationTest.php b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenEditingIntegrationTest.php index d1e9c9dee9ec2..6927fa900cbdf 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenEditingIntegrationTest.php +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockAdminUserWhenEditingIntegrationTest.php @@ -25,7 +25,8 @@ * 3. Start to edit existing Integration. * 4. Fill in all data according to data set (password is incorrect). * 5. Perform action 4 specified number of times. - * 6. "You have entered an invalid password for current user." appears after each attempt. + * 6. "The password entered for the current user is invalid. Verify the password and try again." appears after each + * attempt. * 7. Perform all assertions. * * @ZephyrId MAGETWO-49039 diff --git a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnEditPageTest.php b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnEditPageTest.php index 6f690302cba2a..d86346ae9a08b 100644 --- a/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnEditPageTest.php +++ b/dev/tests/functional/tests/app/Magento/Security/Test/TestCase/LockCustomerOnEditPageTest.php @@ -26,7 +26,8 @@ * 3. Click "Change Password" link near "Contact Information". * 4. Fill form according to data set and save (current password is incorrect). * 5. Perform action for specified number of times. - * 6. "The password doesn't match this account." appears after each change password attempt. + * 6. "The password doesn't match this account. Verify the password and try again." appears after each + * change password attempt. * 7. Perform all assertions. * * @ZephyrId MAGETWO-50559 diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertIncorrectUserPassword.php b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertIncorrectUserPassword.php index 3463525a52995..4cca4361d0c6f 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertIncorrectUserPassword.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertIncorrectUserPassword.php @@ -14,7 +14,7 @@ */ class AssertIncorrectUserPassword extends AbstractConstraint { - const ERROR_MESSAGE = 'You have entered an invalid password for current user.'; + const ERROR_MESSAGE = 'The password entered for the current user is invalid. Verify the password and try again.'; /** * Asserts that invalid password message equals to expected message. diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserFailedLoginByPermissionMessage.php b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserFailedLoginByPermissionMessage.php index 749075f699dde..d13b07d3f253a 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserFailedLoginByPermissionMessage.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserFailedLoginByPermissionMessage.php @@ -15,7 +15,7 @@ */ class AssertUserFailedLoginByPermissionMessage extends AbstractConstraint { - const FAILED_LOGIN_MESSAGE = 'You need more permissions to access this.'; + const FAILED_LOGIN_MESSAGE = 'More permissions are needed to access this.'; /** * Verify incorrect credentials message while login to admin. diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserFailedLoginMessage.php b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserFailedLoginMessage.php index 8de16b494b4dc..23c291c4cc647 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserFailedLoginMessage.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserFailedLoginMessage.php @@ -15,7 +15,8 @@ */ class AssertUserFailedLoginMessage extends AbstractConstraint { - const FAILED_LOGIN_MESSAGE = 'You did not sign in correctly or your account is temporarily disabled.'; + const FAILED_LOGIN_MESSAGE = + 'The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later.'; /** * Verify incorrect credentials message while login to admin diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/LockAdminUserEntityTest.php b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/LockAdminUserEntityTest.php index 9aaac5b17a4ca..65662e5405126 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/LockAdminUserEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/LockAdminUserEntityTest.php @@ -21,7 +21,8 @@ * Steps: * 1. Open Magento admin user login page. * 2. Enter incorrect password specified number of times. - * 3. "You did not sign in correctly or your account is temporarily disabled." appears after each login attempt. + * 3. "The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later." + * appears after each login attempt. * 4. Perform all assertions. * * @group AuthN_&_AuthZ diff --git a/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/AuthTest.php b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/AuthTest.php index 7233807d079bc..ef159e6230984 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/AuthTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/AuthTest.php @@ -200,7 +200,12 @@ public function testIncorrectLogin($params) $this->getRequest()->setPostValue($params); $this->dispatch('backend/admin/auth/login'); $this->assertSessionMessages( - $this->equalTo(['You did not sign in correctly or your account is temporarily disabled.']), + $this->equalTo( + [ + 'The account sign-in was incorrect or your account is disabled temporarily. ' + . 'Please wait and try again later.' + ] + ), MessageInterface::TYPE_ERROR ); $backendUrlModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( diff --git a/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/CacheTest.php b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/CacheTest.php index 0525c68b04d14..04930661efb43 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/CacheTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/CacheTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Backend\Controller\Adminhtml; /** @@ -72,7 +73,7 @@ public function testMassActionsInvalidTypes($action) $this->getRequest()->setParams(['types' => ['invalid_type_1', 'invalid_type_2', 'config']]); $this->dispatch('backend/admin/cache/' . $action); $this->assertSessionMessages( - $this->contains("Specified cache type(s) don't exist: invalid_type_1, invalid_type_2"), + $this->contains("These cache type(s) don't exist: invalid_type_1, invalid_type_2"), \Magento\Framework\Message\MessageInterface::TYPE_ERROR ); } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/CategoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/CategoryTest.php index bfc7e33d5f771..11f49464bbd21 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/CategoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/CategoryTest.php @@ -339,7 +339,7 @@ public function testSaveActionCategoryWithDangerRequest() ); $this->dispatch('backend/catalog/category/save'); $this->assertSessionMessages( - $this->equalTo(['The value of attribute "Name" must be set']), + $this->equalTo(['The "Name" attribute value is empty. Set the attribute and try again.']), \Magento\Framework\Message\MessageInterface::TYPE_ERROR ); } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/ProductTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/ProductTest.php index e1b5b9e0a2c8c..3e67095edcea9 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/ProductTest.php @@ -15,7 +15,7 @@ public function testSaveActionWithDangerRequest() $this->getRequest()->setPostValue(['product' => ['entity_id' => 15]]); $this->dispatch('backend/catalog/product/save'); $this->assertSessionMessages( - $this->equalTo(['Unable to save product']), + $this->equalTo(['The product was unable to be saved. Please try again.']), \Magento\Framework\Message\MessageInterface::TYPE_ERROR ); $this->assertRedirect($this->stringContains('/backend/catalog/product/new')); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Gallery/CreateHandlerTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Gallery/CreateHandlerTest.php index 0ce6f057ece46..7421402455b28 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Gallery/CreateHandlerTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Gallery/CreateHandlerTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Model\Product\Gallery; use Magento\Framework\Exception\FileSystemException; @@ -84,7 +85,7 @@ public function testExecuteWithIllegalFilename($imageFileName) try { $this->createHandler->execute($product); } catch (FileSystemException $exception) { - $this->assertContains('doesn\'t exist or not a file', $exception->getLogMessage()); + $this->assertContains(" file doesn't exist.", $exception->getLogMessage()); $this->assertNotContains('../', $exception->getLogMessage()); throw $exception; } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php index 4a8ff84ecfaa5..8c9eaf5c34ab7 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Model\Product\Option\Type\File; /** @@ -124,7 +125,6 @@ public function testOptionRequiredException() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Please specify product's required option(s). * @return void */ public function testException() @@ -141,6 +141,10 @@ public function testException() $this->objectManager->create(\Magento\Framework\DataObject::class), $this->getProductOption() ); + + $this->expectExceptionMessage( + "The product's required option(s) weren't entered. Make sure the options are entered and try again." + ); } /** @@ -215,7 +219,7 @@ public function testEmptyFile() $this->expectException( \Magento\Framework\Exception\LocalizedException::class, - 'The file is empty. Please choose another one' + 'The file is empty. Select another file and try again.' ); $httpAdapterMock = $this->createPartialMock(\Zend_File_Transfer_Adapter_Http::class, ['isValid']); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorInfoTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorInfoTest.php index 001b261f9cfd5..eafe09f803166 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorInfoTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorInfoTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Model\Product\Option\Type\File; /** @@ -89,7 +90,7 @@ public function testExceptionWithoutErrors() { $this->expectException( \Magento\Framework\Exception\LocalizedException::class, - "Please specify product's required option(s)." + "The product's required option(s) weren't entered. Make sure the options are entered and try again." ); $validateMock = $this->createPartialMock(\Zend_Validate::class, ['isValid', 'getErrors']); @@ -175,7 +176,7 @@ protected function getOptionValue() $filePath = $tmpDirectory->getAbsolutePath($file); return [ - 'title' => 'test.jpg', + 'title' => 'test.jpg', 'quote_path' => $file, 'order_path' => $file, 'secret_key' => substr(md5(file_get_contents($filePath)), 0, 20), diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTypeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTypeTest.php index 936574642d093..c668e82c0bfa0 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTypeTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTypeTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Model\Product\Type; /** @@ -199,7 +200,7 @@ public function testPrepareForCartOptionsException() // fixture $this->assertContains( - 'Please specify product\'s required option(s).', + "The product's required option(s) weren't entered. Make sure the options are entered and try again.", $this->_model->prepareForCart(new \Magento\Framework\DataObject(), $product) ); } @@ -207,7 +208,7 @@ public function testPrepareForCartOptionsException() public function testGetSpecifyOptionMessage() { $this->assertEquals( - 'Please specify product\'s required option(s).', + "The product's required option(s) weren't entered. Make sure the options are entered and try again.", $this->_model->getSpecifyOptionMessage() ); } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php index 99a1e9309f6e9..8b33c962cc809 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Model; use Magento\Framework\App\Filesystem\DirectoryList; @@ -481,8 +482,10 @@ public function testValidateUniqueInputAttributeValue() $validationResult = $this->_model->validate(); $this->assertCount(1, $validationResult); + $this->assertContains( - 'The value of attribute "' . $attribute->getDefaultFrontendLabel() . '" must be unique', + 'The value of the "' . $attribute->getDefaultFrontendLabel() . + '" attribute isn\'t unique. Set a unique value and try again.', $validationResult ); } diff --git a/dev/tests/integration/testsuite/Magento/CheckoutAgreements/Model/Checkout/Plugin/GuestValidationTest.php b/dev/tests/integration/testsuite/Magento/CheckoutAgreements/Model/Checkout/Plugin/GuestValidationTest.php index aad986975c295..34e7afb3f9176 100644 --- a/dev/tests/integration/testsuite/Magento/CheckoutAgreements/Model/Checkout/Plugin/GuestValidationTest.php +++ b/dev/tests/integration/testsuite/Magento/CheckoutAgreements/Model/Checkout/Plugin/GuestValidationTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CheckoutAgreements\Model\Checkout\Plugin; /** @@ -142,7 +143,10 @@ public function testBeforeSavePaymentInformationAndPlaceOrder($agreementNames) $this->assertNotNull($orderId); } catch (\Magento\Framework\Exception\CouldNotSaveException $e) { $this->assertEquals( - __('Please agree to all the terms and conditions before placing the order.'), + __( + "The order wasn't placed. " + . "First, agree to the terms and conditions, then try placing your order again." + ), $e->getMessage() ); } diff --git a/dev/tests/integration/testsuite/Magento/Config/Console/Command/ConfigSetCommandTest.php b/dev/tests/integration/testsuite/Magento/Config/Console/Command/ConfigSetCommandTest.php index 91e8cbe1cad73..358742ae69ee8 100644 --- a/dev/tests/integration/testsuite/Magento/Config/Console/Command/ConfigSetCommandTest.php +++ b/dev/tests/integration/testsuite/Magento/Config/Console/Command/ConfigSetCommandTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Config\Console\Command; use Magento\Config\Model\Config\Backend\Admin\Custom; @@ -321,45 +322,45 @@ public function configSetValidationErrorDataProvider() [ 'test/test/test', 'value', - 'The "test/test/test" path does not exist' + 'The "test/test/test" path doesn\'t exist. Verify and try again.' ], //wrong scope or scope code [ Custom::XML_PATH_GENERAL_LOCALE_CODE, 'en_UK', - 'Enter a scope before proceeding.', + 'A scope is missing. Enter a scope and try again.', '' ], [ Custom::XML_PATH_GENERAL_LOCALE_CODE, 'en_UK', - 'Enter a scope code before proceeding.', + 'A scope code is missing. Enter a code and try again.', ScopeInterface::SCOPE_WEBSITE ], [ Custom::XML_PATH_GENERAL_LOCALE_CODE, 'en_UK', - 'Enter a scope code before proceeding.', + 'A scope code is missing. Enter a code and try again.', ScopeInterface::SCOPE_STORE ], [ Custom::XML_PATH_GENERAL_LOCALE_CODE, 'en_UK', - 'The "wrong_scope" value doesn\'t exist. Enter another value.', + 'The "wrong_scope" value doesn\'t exist. Enter another value and try again.', 'wrong_scope', 'base' ], [ Custom::XML_PATH_GENERAL_LOCALE_CODE, 'en_UK', - 'The "wrong_website_code" value doesn\'t exist. Enter another value.', + 'The "wrong_website_code" value doesn\'t exist. Enter another value and try again.', ScopeInterface::SCOPE_WEBSITE, 'wrong_website_code' ], [ Custom::XML_PATH_GENERAL_LOCALE_CODE, 'en_UK', - 'The "wrong_store_code" value doesn\'t exist. Enter another value.', + 'The "wrong_store_code" value doesn\'t exist. Enter another value and try again.', ScopeInterface::SCOPE_STORE, 'wrong_store_code' ], diff --git a/dev/tests/integration/testsuite/Magento/Config/Console/Command/ConfigShowCommandTest.php b/dev/tests/integration/testsuite/Magento/Config/Console/Command/ConfigShowCommandTest.php index 7dd27675ce286..7e78690e7b70c 100644 --- a/dev/tests/integration/testsuite/Magento/Config/Console/Command/ConfigShowCommandTest.php +++ b/dev/tests/integration/testsuite/Magento/Config/Console/Command/ConfigShowCommandTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Config\Console\Command; use Magento\Framework\App\DeploymentConfig\FileReader; @@ -269,7 +270,7 @@ public function executeDataProvider() Cli::RETURN_FAILURE, [ 'web/test/test_wrong_value' => [ - 'The "some_scope" value doesn\'t exist. Enter another value.' + 'The "some_scope" value doesn\'t exist. Enter another value and try again.' ], ] ], @@ -279,7 +280,7 @@ public function executeDataProvider() Cli::RETURN_FAILURE, [ 'web/test/test_wrong_value' => [ - 'The "scope_code" value doesn\'t exist. Enter another value.' + 'The "scope_code" value doesn\'t exist. Enter another value and try again.' ], ] ], diff --git a/dev/tests/integration/testsuite/Magento/Contact/Controller/IndexTest.php b/dev/tests/integration/testsuite/Magento/Contact/Controller/IndexTest.php index 2d76632cae0b7..a06a981a4c891 100644 --- a/dev/tests/integration/testsuite/Magento/Contact/Controller/IndexTest.php +++ b/dev/tests/integration/testsuite/Magento/Contact/Controller/IndexTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Contact\Controller; /** @@ -57,7 +58,7 @@ public static function dataInvalidPostAction() 'email' => 'user@example.com', 'hideit' => '', ], - 'expectedMessage' => "Comment is missing", + 'expectedMessage' => "Enter the comment and try again.", ], 'missing_name' => [ 'params' => [ @@ -66,7 +67,7 @@ public static function dataInvalidPostAction() 'email' => 'user@example.com', 'hideit' => '', ], - 'expectedMessage' => "Name is missing", + 'expectedMessage' => "Enter the Name and try again.", ], 'invalid_email' => [ 'params' => [ @@ -75,7 +76,7 @@ public static function dataInvalidPostAction() 'email' => 'invalidemail', 'hideit' => '', ], - 'expectedMessage' => "Invalid email address", + 'expectedMessage' => "The email address is invalid. Verify the email address and try again.", ], ]; } diff --git a/dev/tests/integration/testsuite/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency/FetchRatesTest.php b/dev/tests/integration/testsuite/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency/FetchRatesTest.php index 28f744aa4142f..ce83b7d3a6e06 100644 --- a/dev/tests/integration/testsuite/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency/FetchRatesTest.php +++ b/dev/tests/integration/testsuite/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency/FetchRatesTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\CurrencySymbol\Controller\Adminhtml\System\Currency; class FetchRatesTest extends \Magento\TestFramework\TestCase\AbstractBackendController @@ -20,7 +21,7 @@ public function testFetchRatesActionWithoutService() $this->dispatch('backend/admin/system_currency/fetchRates'); $this->assertSessionMessages( - $this->contains('Please specify a correct Import Service.'), + $this->contains('The Import Service is incorrect. Verify the service and try again.'), \Magento\Framework\Message\MessageInterface::TYPE_ERROR ); } @@ -38,7 +39,7 @@ public function testFetchRatesActionWithNonexistentService() $this->dispatch('backend/admin/system_currency/fetchRates'); $this->assertSessionMessages( - $this->contains('We can\'t initialize the import model.'), + $this->contains("The import model can't be initialized. Verify the model and try again."), \Magento\Framework\Message\MessageInterface::TYPE_ERROR ); } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Api/AddressRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Customer/Api/AddressRepositoryTest.php index 328622ca1bbbe..ebfbdfb0e7c4d 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Api/AddressRepositoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Api/AddressRepositoryTest.php @@ -207,8 +207,8 @@ public function testSaveNewInvalidAddress() $this->assertEquals('One or more input exceptions have occurred.', $exception->getMessage()); $errors = $exception->getErrors(); $this->assertCount(2, $errors); - $this->assertEquals('firstname is a required field.', $errors[0]->getLogMessage()); - $this->assertEquals('lastname is a required field.', $errors[1]->getLogMessage()); + $this->assertEquals('"firstname" is required. Enter and try again.', $errors[0]->getLogMessage()); + $this->assertEquals('"lastname" is required. Enter and try again.', $errors[1]->getLogMessage()); } } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/AccountTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/AccountTest.php index 19607e418b942..eca5cf79c0664 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/AccountTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/AccountTest.php @@ -404,7 +404,7 @@ public function testForgotPasswordPostWithBadEmailAction() $this->dispatch('customer/account/forgotPasswordPost'); $this->assertRedirect($this->stringContains('customer/account/forgotpassword')); $this->assertSessionMessages( - $this->equalTo(['Please correct the email address.']), + $this->equalTo(['The email address is incorrect. Verify the email address and try again.']), MessageInterface::TYPE_ERROR ); } @@ -635,7 +635,7 @@ public function testWrongPasswordEditPostAction() $this->assertRedirect($this->stringEndsWith('customer/account/edit/')); // Not sure if its the most secure message. Not changing the behavior for now in the new AccountManagement APIs. $this->assertSessionMessages( - $this->equalTo(['The password doesn\'t match this account.']), + $this->equalTo(["The password doesn't match this account. Verify the password and try again."]), MessageInterface::TYPE_ERROR ); } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/AddressTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/AddressTest.php index ddf23e1b6ea98..4c30adb6894e2 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/AddressTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/AddressTest.php @@ -150,8 +150,8 @@ public function testFailedFormPostAction() $this->equalTo( [ 'One or more input exceptions have occurred.', - 'street is a required field.', - 'city is a required field.', + '"street" is required. Enter and try again.', + '"city" is required. Enter and try again.', ] ), \Magento\Framework\Message\MessageInterface::TYPE_ERROR diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/CartTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/CartTest.php index f2ce433b4e931..4a75c8c85747c 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/CartTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/CartTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Customer\Controller\Adminhtml\Cart\Product\Composite; /** @@ -26,7 +27,10 @@ public function setUp() public function testConfigureActionNoCustomerId() { $this->dispatch('backend/customer/cart_product_composite_cart/configure'); - $this->assertEquals('{"error":true,"message":"No customer ID defined."}', $this->getResponse()->getBody()); + $this->assertEquals( + '{"error":true,"message":"The customer ID isn\'t defined."}', + $this->getResponse()->getBody() + ); } /** @@ -38,7 +42,7 @@ public function testConfigureActionNoQuoteId() $this->getRequest()->setParam('website_id', 1); $this->dispatch('backend/customer/cart_product_composite_cart/configure'); $this->assertEquals( - '{"error":true,"message":"Please correct the quote items and try again."}', + '{"error":true,"message":"The quote items are incorrect. Verify the quote items and try again."}', $this->getResponse()->getBody() ); } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/GroupTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/GroupTest.php index 28c8d7556270a..80b11a920e3fb 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/GroupTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/GroupTest.php @@ -168,7 +168,7 @@ public function testSaveActionCreateNewGroupWithoutCode() $this->dispatch('backend/customer/group/save'); $this->assertSessionMessages( - $this->equalTo(['code is a required field.']), + $this->equalTo(['"code" is required. Enter and try again.']), MessageInterface::TYPE_ERROR ); } @@ -244,7 +244,7 @@ public function testSaveActionNewGroupWithoutGroupCode() $this->dispatch('backend/customer/group/save'); $this->assertSessionMessages( - $this->equalTo(['code is a required field.']), + $this->equalTo(['"code" is required. Enter and try again.']), MessageInterface::TYPE_ERROR ); $this->assertSessionMessages($this->isEmpty(), MessageInterface::TYPE_SUCCESS); diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Index/MassAssignGroupTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Index/MassAssignGroupTest.php index b2ecd5bf7c3a2..ef5b4cae5ff16 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Index/MassAssignGroupTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Index/MassAssignGroupTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Customer\Controller\Adminhtml\Index; use Magento\TestFramework\Helper\Bootstrap; @@ -105,7 +106,7 @@ public function testMassAssignGroupActionNoCustomerIds() $this->getRequest()->setParam('group', 0)->setPostValue('namespace', 'customer_listing'); $this->dispatch('backend/customer/index/massAssignGroup'); $this->assertSessionMessages( - $this->equalTo(['Please select item(s).']), + $this->equalTo(['An item needs to be selected. Select and try again.']), \Magento\Framework\Message\MessageInterface::TYPE_ERROR ); } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Index/MassDeleteTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Index/MassDeleteTest.php index ace40f982e8fe..b7aefe7c31707 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Index/MassDeleteTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Index/MassDeleteTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Customer\Controller\Adminhtml\Index; use Magento\TestFramework\Helper\Bootstrap; @@ -55,7 +56,7 @@ public function testMassDeleteActionNoCustomerIds() $this->getRequest()->setPostValue('namespace', 'customer_listing'); $this->dispatch('backend/customer/index/massDelete'); $this->assertSessionMessages( - $this->equalTo(['Please select item(s).']), + $this->equalTo(['An item needs to be selected. Select and try again.']), \Magento\Framework\Message\MessageInterface::TYPE_ERROR ); } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Index/MassSubscribeTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Index/MassSubscribeTest.php index d09688e9cda79..d9880b2dc741a 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Index/MassSubscribeTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Index/MassSubscribeTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Customer\Controller\Adminhtml\Index; use Magento\Newsletter\Model\Subscriber; @@ -75,7 +76,7 @@ public function testMassSubscriberActionNoSelection() $this->assertRedirect($this->stringStartsWith($this->baseControllerUrl)); $this->assertSessionMessages( - $this->equalTo(['Please select item(s).']), + $this->equalTo(['An item needs to be selected. Select and try again.']), \Magento\Framework\Message\MessageInterface::TYPE_ERROR ); } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php index dca24e92f0040..81e68a9875642 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Customer\Controller\Adminhtml; use Magento\Customer\Api\AccountManagementInterface; @@ -484,7 +485,7 @@ public function testSaveActionCoreException() * Check that error message is set */ $this->assertSessionMessages( - $this->equalTo(['A customer with the same email already exists in an associated website.']), + $this->equalTo(['A customer with the same email address already exists in an associated website.']), \Magento\Framework\Message\MessageInterface::TYPE_ERROR ); $this->assertEquals( diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Section/LoadTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Section/LoadTest.php index 97c5fe0b5b064..3e086a89f8140 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Section/LoadTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Section/LoadTest.php @@ -11,7 +11,7 @@ class LoadTest extends \Magento\TestFramework\TestCase\AbstractController public function testLoadInvalidSection() { $expected = [ - 'message' => '"section<invalid" section source is not supported', + 'message' => 'The "section<invalid" section source isn't supported.', ]; $this->dispatch('/customer/section/load/?sections=section<invalid&update_section_id=false&_=147066166394'); self::assertEquals(json_encode($expected), $this->getResponse()->getBody()); diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php index 865a190f077b2..f5b6fdc93d32f 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php @@ -179,7 +179,7 @@ public function testChangePassword() * @magentoDataFixture Magento/Customer/_files/customer.php * * @expectedException \Magento\Framework\Exception\InvalidEmailOrPasswordException - * @expectedExceptionMessage The password doesn't match this account. + * @expectedExceptionMessage The password doesn't match this account. Verify the password and try again. */ public function testChangePasswordWrongPassword() { @@ -301,9 +301,9 @@ public function testValidateResetPasswordLinkTokenInvalid() $this->accountManagement->validateResetPasswordLinkToken(1, $invalidToken); $this->fail('Expected exception not thrown.'); } catch (InputException $ie) { - $this->assertEquals('%fieldName is a required field.', $ie->getRawMessage()); - $this->assertEquals('resetPasswordLinkToken is a required field.', $ie->getMessage()); - $this->assertEquals('resetPasswordLinkToken is a required field.', $ie->getLogMessage()); + $this->assertEquals('"%fieldName" is required. Enter and try again.', $ie->getRawMessage()); + $this->assertEquals('"resetPasswordLinkToken" is required. Enter and try again.', $ie->getMessage()); + $this->assertEquals('"resetPasswordLinkToken" is required. Enter and try again.', $ie->getLogMessage()); $this->assertEmpty($ie->getErrors()); } } @@ -350,9 +350,9 @@ public function testValidateResetPasswordLinkTokenNull() $this->accountManagement->validateResetPasswordLinkToken(1, null); $this->fail('Expected exception not thrown.'); } catch (InputException $ie) { - $this->assertEquals('%fieldName is a required field.', $ie->getRawMessage()); - $this->assertEquals('resetPasswordLinkToken is a required field.', $ie->getMessage()); - $this->assertEquals('resetPasswordLinkToken is a required field.', $ie->getLogMessage()); + $this->assertEquals('"%fieldName" is required. Enter and try again.', $ie->getRawMessage()); + $this->assertEquals('"resetPasswordLinkToken" is required. Enter and try again.', $ie->getMessage()); + $this->assertEquals('"resetPasswordLinkToken" is required. Enter and try again.', $ie->getLogMessage()); $this->assertEmpty($ie->getErrors()); } } @@ -449,7 +449,7 @@ public function testResetPasswordTokenExpired() $this->accountManagement->resetPassword('customer@example.com', $resetToken, $password); $this->fail('Expected exception not thrown.'); } catch (ExpiredException $e) { - $this->assertEquals('Reset password token expired.', $e->getMessage()); + $this->assertEquals('The password token is expired. Reset and try again.', $e->getMessage()); } } @@ -468,9 +468,9 @@ public function testResetPasswordTokenInvalid() $this->accountManagement->resetPassword('customer@example.com', $invalidToken, $password); $this->fail('Expected exception not thrown.'); } catch (InputException $ie) { - $this->assertEquals('%fieldName is a required field.', $ie->getRawMessage()); - $this->assertEquals('resetPasswordLinkToken is a required field.', $ie->getMessage()); - $this->assertEquals('resetPasswordLinkToken is a required field.', $ie->getLogMessage()); + $this->assertEquals('"%fieldName" is required. Enter and try again.', $ie->getRawMessage()); + $this->assertEquals('"resetPasswordLinkToken" is required. Enter and try again.', $ie->getMessage()); + $this->assertEquals('"resetPasswordLinkToken" is required. Enter and try again.', $ie->getLogMessage()); $this->assertEmpty($ie->getErrors()); } } @@ -576,7 +576,7 @@ public function testCreateCustomerException() $this->accountManagement->createAccount($customerEntity); $this->fail('Expected exception not thrown'); } catch (InputException $ie) { - $this->assertEquals('Please enter a customer email.', $ie->getMessage()); + $this->assertEquals('The customer email is missing. Enter and try again.', $ie->getMessage()); } } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/AddressRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/AddressRepositoryTest.php index 46cdf77860723..b06ddf48d9e64 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/AddressRepositoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/AddressRepositoryTest.php @@ -213,8 +213,8 @@ public function testSaveNewInvalidAddress() $this->assertEquals('One or more input exceptions have occurred.', $exception->getMessage()); $errors = $exception->getErrors(); $this->assertCount(2, $errors); - $this->assertEquals('firstname is a required field.', $errors[0]->getLogMessage()); - $this->assertEquals('lastname is a required field.', $errors[1]->getLogMessage()); + $this->assertEquals('"firstname" is required. Enter and try again.', $errors[0]->getLogMessage()); + $this->assertEquals('"lastname" is required. Enter and try again.', $errors[1]->getLogMessage()); } } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Group/Grid/ServiceCollectionTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Group/Grid/ServiceCollectionTest.php index 6d0986d6a3949..c4296090a9a47 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Group/Grid/ServiceCollectionTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/Group/Grid/ServiceCollectionTest.php @@ -5,6 +5,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Customer\Model\ResourceModel\Group\Grid; class ServiceCollectionTest extends \PHPUnit\Framework\TestCase @@ -97,7 +98,7 @@ public function testSingleLikeFilter() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage When passing an array of fields there must be at least one field in the array. + * @expectedExceptionMessage The array of fields failed to pass. The array must include at one field. */ public function testAddToFilterException() { @@ -106,7 +107,7 @@ public function testAddToFilterException() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage When passing in a field array there must be a matching condition array. + * @expectedExceptionMessage The field array failed to pass. The array must have a matching condition array. */ public function testAddToFilterExceptionArrayNotSymmetric() { diff --git a/dev/tests/integration/testsuite/Magento/Framework/Communication/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Framework/Communication/ConfigTest.php index 7a13ca1a48284..8b5eb1b10b8eb 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Communication/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Communication/ConfigTest.php @@ -38,7 +38,7 @@ public function testGetTopicsNumeric() * Get topic configuration by its name * * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Invalid XML in file 0: + * @expectedExceptionMessage The XML in file "0" is invalid: Element 'topic', attribute 'schema': [facet 'pattern'] The value '55\Customer\Api\CustomerRepositoryInterface::delete' is not accepted by the pattern '[a-zA-Z]+[a-zA-Z0-9\\]+::[a-zA-Z0-9]+'. Line: 9 @@ -50,6 +50,7 @@ public function testGetTopicsNumeric() Element 'handler', attribute 'type': '55\Customer\Api\CustomerRepositoryInterface' is not a valid value of the atomic type 'serviceTypeType'. Line: 10 + Verify the XML and try again. * */ // @codingStandardsIgnoreEnd diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/LayoutDirectivesTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/LayoutDirectivesTest.php index 7040407cedef7..fde592aec9917 100755 --- a/dev/tests/integration/testsuite/Magento/Framework/View/LayoutDirectivesTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/LayoutDirectivesTest.php @@ -5,6 +5,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\View; use Magento\Framework\App\State; @@ -81,13 +82,16 @@ public function testRenderElement() /** * @expectedException \OutOfBoundsException - * @expectedExceptionMessage No element found with ID 'nonexisting_element' * @magentoAppIsolation enabled */ public function testRenderNonExistentElementShouldThrowException() { $layout = $this->_getLayoutModel('render.xml'); $this->assertEmpty($layout->renderElement('nonexisting_element')); + + $this->expectExceptionMessage( + 'The element with the "nonexisting_element" ID wasn\'t found. Verify the ID and try again.' + ); } /** diff --git a/dev/tests/integration/testsuite/Magento/GiftMessage/Model/OrderItemRepositoryTest.php b/dev/tests/integration/testsuite/Magento/GiftMessage/Model/OrderItemRepositoryTest.php index e81b9b38054d0..7238ae56a2136 100644 --- a/dev/tests/integration/testsuite/Magento/GiftMessage/Model/OrderItemRepositoryTest.php +++ b/dev/tests/integration/testsuite/Magento/GiftMessage/Model/OrderItemRepositoryTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\GiftMessage\Model; class OrderItemRepositoryTest extends \PHPUnit\Framework\TestCase @@ -60,7 +61,7 @@ public function testGet() * @magentoDataFixture Magento/GiftMessage/_files/order_with_message.php * @magentoConfigFixture default_store sales/gift_options/allow_items 1 * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage There is no item with provided id in the order + * @expectedExceptionMessage No item with the provided ID was found in the Order. Verify the ID and try again. */ public function testGetNoProvidedItemId() { @@ -105,7 +106,7 @@ public function testSave() * @magentoDataFixture Magento/Sales/_files/order.php * @magentoConfigFixture default_store sales/gift_options/allow_items 0 * @expectedException \Magento\Framework\Exception\CouldNotSaveException - * @expectedExceptionMessage Gift Message is not available + * @expectedExceptionMessage The gift message isn't available. */ public function testSaveMessageIsNotAvailable() { @@ -123,7 +124,7 @@ public function testSaveMessageIsNotAvailable() * @magentoDataFixture Magento/GiftMessage/_files/virtual_order.php * @magentoConfigFixture default_store sales/gift_options/allow_items 1 * @expectedException \Magento\Framework\Exception\State\InvalidTransitionException - * @expectedExceptionMessage Gift Messages are not applicable for virtual products + * @expectedExceptionMessage Gift messages can't be used for virtual products. */ public function testSaveMessageIsVirtual() { @@ -141,7 +142,7 @@ public function testSaveMessageIsVirtual() * @magentoDataFixture Magento/GiftMessage/_files/empty_order.php * @magentoConfigFixture default_store sales/gift_options/allow_items 1 * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage There is no item with provided id in the order + * @expectedExceptionMessage No item with the provided ID was found in the Order. Verify the ID and try again. */ public function testSaveMessageNoProvidedItemId() { diff --git a/dev/tests/integration/testsuite/Magento/GiftMessage/Model/OrderRepositoryTest.php b/dev/tests/integration/testsuite/Magento/GiftMessage/Model/OrderRepositoryTest.php index 21b017a87b917..332570b57aca5 100644 --- a/dev/tests/integration/testsuite/Magento/GiftMessage/Model/OrderRepositoryTest.php +++ b/dev/tests/integration/testsuite/Magento/GiftMessage/Model/OrderRepositoryTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\GiftMessage\Model; class OrderRepositoryTest extends \PHPUnit\Framework\TestCase @@ -77,7 +78,7 @@ public function testSave() * @magentoDataFixture Magento/Sales/_files/order.php * @magentoConfigFixture default_store sales/gift_options/allow_order 0 * @expectedException \Magento\Framework\Exception\CouldNotSaveException - * @expectedExceptionMessage Gift Message is not available + * @expectedExceptionMessage The gift message isn't available. */ public function testSaveMessageIsNotAvailable() { @@ -92,7 +93,7 @@ public function testSaveMessageIsNotAvailable() * @magentoDataFixture Magento/GiftMessage/_files/virtual_order.php * @magentoConfigFixture default_store sales/gift_options/allow_order 1 * @expectedException \Magento\Framework\Exception\State\InvalidTransitionException - * @expectedExceptionMessage Gift Messages are not applicable for virtual products + * @expectedExceptionMessage Gift messages can't be used for virtual products. */ public function testSaveMessageIsVirtual() { @@ -107,7 +108,6 @@ public function testSaveMessageIsVirtual() * @magentoDataFixture Magento/GiftMessage/_files/empty_order.php * @magentoConfigFixture default_store sales/gift_options/allow_order 1 * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Gift Messages are not applicable for empty order */ public function testSaveMessageIsEmpty() { @@ -116,13 +116,17 @@ public function testSaveMessageIsEmpty() /** @var \Magento\GiftMessage\Api\Data\MessageInterface $message */ $this->giftMessageOrderRepository->save($order->getEntityId(), $this->message); + + $this->expectExceptionMessage( + "Gift messages can't be used for an empty order. Create an order, add an item, and try again." + ); } /** * @magentoDataFixture Magento/GiftMessage/_files/empty_order.php * @magentoConfigFixture default_store sales/gift_options/allow_order 1 * @expectedException \Magento\Framework\Exception\NoSuchEntityException - * @expectedExceptionMessage There is no order with provided id + * @expectedExceptionMessage No order exists with this ID. Verify your information and try again. */ public function testSaveMessageNoProvidedItemId() { diff --git a/dev/tests/integration/testsuite/Magento/Integration/Model/AdminTokenServiceTest.php b/dev/tests/integration/testsuite/Magento/Integration/Model/AdminTokenServiceTest.php index 96900b595bf64..369d71ddbff9b 100644 --- a/dev/tests/integration/testsuite/Magento/Integration/Model/AdminTokenServiceTest.php +++ b/dev/tests/integration/testsuite/Magento/Integration/Model/AdminTokenServiceTest.php @@ -73,13 +73,17 @@ public function testCreateAdminAccessTokenEmptyOrNullCredentials($username, $pas /** * @expectedException \Magento\Framework\Exception\AuthenticationException - * @expectedExceptionMessage You did not sign in correctly or your account is temporarily disabled. */ public function testCreateAdminAccessTokenInvalidCustomer() { $adminUserName = 'invalid'; $password = 'invalid'; $this->tokenService->createAdminAccessToken($adminUserName, $password); + + $this->expectExceptionMessage( + 'The account sign-in was incorrect or your account is disabled temporarily. ' + . 'Please wait and try again later.' + ); } /** @@ -105,7 +109,7 @@ private function assertInputExceptionMessages($e) $this->assertEquals('One or more input exceptions have occurred.', $e->getMessage()); $errors = $e->getErrors(); $this->assertCount(2, $errors); - $this->assertEquals('username is a required field.', $errors[0]->getLogMessage()); - $this->assertEquals('password is a required field.', $errors[1]->getLogMessage()); + $this->assertEquals('"username" is required. Enter and try again.', $errors[0]->getLogMessage()); + $this->assertEquals('"password" is required. Enter and try again.', $errors[1]->getLogMessage()); } } diff --git a/dev/tests/integration/testsuite/Magento/Integration/Model/CustomerTokenServiceTest.php b/dev/tests/integration/testsuite/Magento/Integration/Model/CustomerTokenServiceTest.php index 740b1aa424556..6c4268db6db46 100644 --- a/dev/tests/integration/testsuite/Magento/Integration/Model/CustomerTokenServiceTest.php +++ b/dev/tests/integration/testsuite/Magento/Integration/Model/CustomerTokenServiceTest.php @@ -73,13 +73,17 @@ public function testCreateCustomerAccessTokenEmptyOrNullCredentials($username, $ /** * @expectedException \Magento\Framework\Exception\AuthenticationException - * @expectedExceptionMessage You did not sign in correctly or your account is temporarily disabled. */ public function testCreateCustomerAccessTokenInvalidCustomer() { $customerUserName = 'invalid'; $password = 'invalid'; $this->tokenService->createCustomerAccessToken($customerUserName, $password); + + $this->expectExceptionMessage( + 'The account sign-in was incorrect or your account is disabled temporarily. ' + . 'Please wait and try again later.' + ); } /** @@ -105,7 +109,7 @@ private function assertInputExceptionMessages($e) $this->assertEquals('One or more input exceptions have occurred.', $e->getMessage()); $errors = $e->getErrors(); $this->assertCount(2, $errors); - $this->assertEquals('username is a required field.', $errors[0]->getLogMessage()); - $this->assertEquals('password is a required field.', $errors[1]->getLogMessage()); + $this->assertEquals('"username" is required. Enter and try again.', $errors[0]->getLogMessage()); + $this->assertEquals('"password" is required. Enter and try again.', $errors[1]->getLogMessage()); } } diff --git a/dev/tests/integration/testsuite/Magento/Security/Model/SecurityManagerTest.php b/dev/tests/integration/testsuite/Magento/Security/Model/SecurityManagerTest.php index 4f4ee94290fc4..5f0249e9e581e 100644 --- a/dev/tests/integration/testsuite/Magento/Security/Model/SecurityManagerTest.php +++ b/dev/tests/integration/testsuite/Magento/Security/Model/SecurityManagerTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Security\Model; use Magento\Customer\Api\AccountManagementInterface; @@ -104,7 +105,6 @@ protected function getPasswordResetRequestEventCollection() * @magentoConfigFixture current_store customer/password/min_time_between_password_reset_requests 0 * @magentoConfigFixture current_store contact/email/recipient_email hi@example.com * @expectedException \Magento\Framework\Exception\SecurityViolationException - * @expectedExceptionMessage Too many password reset requests. Please wait and try again or contact hi@example.com. * @magentoDbIsolation enabled */ public function testPerformSecurityCheckLimitNumber() @@ -114,7 +114,6 @@ public function testPerformSecurityCheckLimitNumber() $longIp = 127001; $accountReference = 'customer@example.com'; - $i = 0; try { for ($i = 0; $i < $attempts; $i++) { $this->securityManager->performSecurityCheck($requestType, $accountReference, $longIp); @@ -125,6 +124,11 @@ public function testPerformSecurityCheckLimitNumber() __($e->getMessage()) ); } + + $this->expectExceptionMessage( + 'We received too many requests for password resets. ' + . 'Please wait and try again later or contact hi@example.com.' + ); } /** @@ -135,7 +139,6 @@ public function testPerformSecurityCheckLimitNumber() * @magentoConfigFixture current_store customer/password/min_time_between_password_reset_requests 1 * @magentoConfigFixture current_store contact/email/recipient_email hi@example.com * @expectedException \Magento\Framework\Exception\SecurityViolationException - * @expectedExceptionMessage Too many password reset requests. Please wait and try again or contact hi@example.com. * @magentoDbIsolation enabled */ public function testPerformSecurityCheckLimitTime() @@ -145,7 +148,6 @@ public function testPerformSecurityCheckLimitTime() $longIp = 127001; $accountReference = 'customer@example.com'; - $i = 0; try { for ($i = 0; $i < $attempts; $i++) { $this->securityManager->performSecurityCheck($requestType, $accountReference, $longIp); @@ -158,5 +160,10 @@ public function testPerformSecurityCheckLimitTime() } $this->fail('Something went wrong. Please check method execution logic.'); + + $this->expectExceptionMessage( + 'We received too many requests for password resets. ' + . 'Please wait and try again later or contact hi@example.com.' + ); } } diff --git a/dev/tests/integration/testsuite/Magento/Tax/Controller/Adminhtml/RateTest.php b/dev/tests/integration/testsuite/Magento/Tax/Controller/Adminhtml/RateTest.php index 91a845f151eaf..c2f7b498e63e3 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/Controller/Adminhtml/RateTest.php +++ b/dev/tests/integration/testsuite/Magento/Tax/Controller/Adminhtml/RateTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Tax\Controller\Adminhtml; /** @@ -109,7 +110,7 @@ public function ajaxSaveActionDataInvalidDataProvider() { $expectedData = [ 'success' => false, - 'error_message' => 'Make sure all required information is valid.', + 'error_message' => 'The required information is invalid. Verify the information and try again.', ]; return [ [ diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/Calculation/RateRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/Calculation/RateRepositoryTest.php index 07545754ca1b4..46b77032704eb 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/Model/Calculation/RateRepositoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Tax/Model/Calculation/RateRepositoryTest.php @@ -289,9 +289,9 @@ public function createDataProvider() 'zip_to' => 'to', ], 'error' => [ - 'country_id is a required field.', - 'percentage_rate is a required field.', - 'code is a required field.', + '"country_id" is required. Enter and try again.', + '"percentage_rate" is required. Enter and try again.', + '"code" is required. Enter and try again.', 'Invalid value of "from" provided for the zip_from field.', 'Invalid value of "to" provided for the zip_to field.', ], @@ -303,9 +303,9 @@ public function createDataProvider() 'zip_to' => '', ], 'error' => [ - 'country_id is a required field.', - 'percentage_rate is a required field.', - 'code is a required field.', + '"country_id" is required. Enter and try again.', + '"percentage_rate" is required. Enter and try again.', + '"code" is required. Enter and try again.', 'Invalid value of "" provided for the zip_from field.', 'Invalid value of "" provided for the zip_to field.', ], @@ -313,10 +313,10 @@ public function createDataProvider() 'empty' => [ [], 'error' => [ - 'country_id is a required field.', - 'percentage_rate is a required field.', - 'code is a required field.', - 'postcode is a required field.', + '"country_id" is required. Enter and try again.', + '"percentage_rate" is required. Enter and try again.', + '"code" is required. Enter and try again.', + '"postcode" is required. Enter and try again.', ], ], 'zipRangeAndPostcode' => [ @@ -327,9 +327,9 @@ public function createDataProvider() 'zip_to' => 78780, ], 'error' => [ - 'country_id is a required field.', - 'percentage_rate is a required field.', - 'code is a required field.', + '"country_id" is required. Enter and try again.', + '"percentage_rate" is required. Enter and try again.', + '"code" is required. Enter and try again.', ], ], 'higherRange' => [ @@ -339,9 +339,9 @@ public function createDataProvider() 'zip_to' => 78780, ], 'error' => [ - 'country_id is a required field.', - 'percentage_rate is a required field.', - 'code is a required field.', + '"country_id" is required. Enter and try again.', + '"percentage_rate" is required. Enter and try again.', + '"code" is required. Enter and try again.', 'Range To should be equal or greater than Range From.', ], ], @@ -349,37 +349,37 @@ public function createDataProvider() ['tax_country_id' => 'XX'], 'error' => [ 'Invalid value of "XX" provided for the country_id field.', - 'percentage_rate is a required field.', - 'code is a required field.', - 'postcode is a required field.', + '"percentage_rate" is required. Enter and try again.', + '"code" is required. Enter and try again.', + '"postcode" is required. Enter and try again.', ], ], 'invalidCountry2' => [ ['tax_country_id' => ' '], 'error' => [ - 'country_id is a required field.', - 'percentage_rate is a required field.', - 'code is a required field.', - 'postcode is a required field.', + '"country_id" is required. Enter and try again.', + '"percentage_rate" is required. Enter and try again.', + '"code" is required. Enter and try again.', + '"postcode" is required. Enter and try again.', ], ], 'invalidRegion1' => [ ['tax_region_id' => '-'], 'error' => [ - 'country_id is a required field.', + '"country_id" is required. Enter and try again.', 'Invalid value of "-" provided for the region_id field.', - 'percentage_rate is a required field.', - 'code is a required field.', - 'postcode is a required field.', + '"percentage_rate" is required. Enter and try again.', + '"code" is required. Enter and try again.', + '"postcode" is required. Enter and try again.', ], ], 'spaceRegion' => [ ['tax_region_id' => ' '], 'error' => [ - 'country_id is a required field.', - 'percentage_rate is a required field.', - 'code is a required field.', - 'postcode is a required field.', + '"country_id" is required. Enter and try again.', + '"percentage_rate" is required. Enter and try again.', + '"code" is required. Enter and try again.', + '"postcode" is required. Enter and try again.', ], ], 'emptyPercentageRate' => [ @@ -393,7 +393,7 @@ public function createDataProvider() 'zip_to' => 78780, ], 'error' => [ - 'percentage_rate is a required field.', + '"percentage_rate" is required. Enter and try again.', ], ] diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/RepositoryTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/RepositoryTest.php index 14a74c8ad12cd..0340ede79edaf 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/RepositoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/RepositoryTest.php @@ -91,8 +91,8 @@ public function testSaveThrowsExceptionIfGivenDataIsInvalid() $this->taxClassRepository->save($taxClassDataObject); } catch (InputException $e) { $errors = $e->getErrors(); - $this->assertEquals('class_name is a required field.', $errors[0]->getMessage()); - $this->assertEquals('class_type is a required field.', $errors[1]->getMessage()); + $this->assertEquals('"class_name" is required. Enter and try again.', $errors[0]->getMessage()); + $this->assertEquals('"class_type" is required. Enter and try again.', $errors[1]->getMessage()); } } diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxRuleRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxRuleRepositoryTest.php index 14dd0b7d9bb11..cb45e1971ecab 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxRuleRepositoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxRuleRepositoryTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Tax\Model; use Magento\Framework\Api\Filter; @@ -277,7 +278,7 @@ public function testSaveUpdatesExistingTaxRule() /** * @magentoDbIsolation enabled * @expectedException \Magento\Framework\Exception\CouldNotSaveException - * @expectedExceptionMessage code is a required field + * @expectedExceptionMessage "code" is required. Enter and try again. */ public function testSaveThrowsExceptionIsRequiredFieldsAreMissing() { diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/Config/ValidatorTest.php b/dev/tests/integration/testsuite/Magento/Theme/Model/Config/ValidatorTest.php index 5f3a1a1706d62..7e54d4f74c9e1 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/Config/ValidatorTest.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/Config/ValidatorTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Theme\Model\Config; use Magento\Email\Model\Template; @@ -56,7 +57,6 @@ protected function setUp() /** * @magentoDataFixture Magento/Email/Model/_files/email_template.php * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage The email_header_template contains an incorrect configuration. The template has a */ public function testValidateHasRecursiveReference() { @@ -95,6 +95,11 @@ public function testValidateHasRecursiveReference() $designElementMock->expects($this->once())->method('getValue')->willReturn($this->templateModel->getId()); $this->model->validate($designConfigMock); + + $this->expectExceptionMessage( + 'The "email_header_template" template contains an incorrect configuration, with a reference to itself. ' + . 'Remove or change the reference, then try again.' + ); } /** diff --git a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/UserTest.php b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/UserTest.php index cfed67b9ddbdb..995ec5f6bed85 100644 --- a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/UserTest.php +++ b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/UserTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\User\Controller\Adminhtml; use Magento\TestFramework\Bootstrap; @@ -82,7 +83,11 @@ public function testSaveActionMissingCurrentAdminPassword() ] ); $this->dispatch('backend/admin/user/save'); - $this->assertSessionMessages($this->equalTo(['You have entered an invalid password for current user.'])); + $this->assertSessionMessages( + $this->equalTo( + ['The password entered for the current user is invalid. Verify the password and try again.'] + ) + ); $this->assertRedirect($this->stringContains('backend/admin/user/edit')); } diff --git a/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php b/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php index c0fe917f104db..8b85339afd789 100644 --- a/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php +++ b/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php @@ -316,11 +316,11 @@ public function testHasAssigned2Role() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage User Name is a required field. - * @expectedExceptionMessage First Name is a required field. - * @expectedExceptionMessage Last Name is a required field. + * @expectedExceptionMessage "User Name" is required. Enter and try again. + * @expectedExceptionMessage "First Name" is required. Enter and try again. + * @expectedExceptionMessage "Last Name" is required. Enter and try again. * @expectedExceptionMessage Please enter a valid email. - * @expectedExceptionMessage Password is required field. + * @expectedExceptionMessage "Password" is required. Enter and try again. * @magentoDbIsolation enabled */ public function testBeforeSaveRequiredFieldsValidation() @@ -498,13 +498,16 @@ public function testPerformIdentityCheck() * * @magentoDataFixture Magento/User/_files/user_with_role.php * @expectedException \Magento\Framework\Exception\AuthenticationException - * @expectedExceptionMessage You have entered an invalid password for current user. */ public function testPerformIdentityCheckWrongPassword() { $this->_model->loadByUsername('adminUser'); $passwordString = 'wrongPassword'; $this->_model->performIdentityCheck($passwordString); + + $this->expectExceptionMessage( + 'The password entered for the current user is invalid. Verify the password and try again.' + ); } /** @@ -512,11 +515,15 @@ public function testPerformIdentityCheckWrongPassword() * * @magentoDataFixture Magento/User/_files/locked_users.php * @expectedException \Magento\Framework\Exception\State\UserLockedException - * @expectedExceptionMessage You did not sign in correctly or your account is temporarily disabled. */ public function testPerformIdentityCheckLockExpires() { $this->_model->loadByUsername('adminUser2'); $this->_model->performIdentityCheck(\Magento\TestFramework\Bootstrap::ADMIN_PASSWORD); + + $this->expectExceptionMessage( + 'The account sign-in was incorrect or your account is disabled temporarily. ' + . 'Please wait and try again later.' + ); } } diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/view/shipping.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/view/shipping.test.js index be27e16a13786..5f14bc28f7995 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/view/shipping.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/view/shipping.test.js @@ -162,7 +162,9 @@ define(['squire', 'ko', 'jquery', 'jquery/validate'], function (Squire, ko, $) { }; expect(obj.validateShippingInformation()).toBeFalsy(); - expect(obj.errorValidationMessage()).toBe('Please specify a shipping method.'); + expect(obj.errorValidationMessage()).toBe( + 'The shipping method is missing. Select the shipping method and try again.' + ); spyOn(mocks['Magento_Checkout/js/model/quote'], 'shippingMethod').and.returnValue(true); spyOn(mocks['Magento_Customer/js/model/customer'], 'isLoggedIn').and.returnValue(true); expect(obj.validateShippingInformation()).toBeFalsy(); diff --git a/lib/internal/Magento/Framework/Api/AbstractServiceCollection.php b/lib/internal/Magento/Framework/Api/AbstractServiceCollection.php index c5d72b59e12ac..7771c77b51697 100644 --- a/lib/internal/Magento/Framework/Api/AbstractServiceCollection.php +++ b/lib/internal/Magento/Framework/Api/AbstractServiceCollection.php @@ -111,12 +111,14 @@ public function addFieldToFilter($field, $condition) { if (is_array($field) && is_array($condition) && count($field) != count($condition)) { throw new LocalizedException( - new \Magento\Framework\Phrase('When passing in a field array there must be a matching condition array.') + new \Magento\Framework\Phrase( + 'The field array failed to pass. The array must have a matching condition array.' + ) ); } elseif (is_array($field) && !count($field) > 0) { throw new LocalizedException( new \Magento\Framework\Phrase( - 'When passing an array of fields there must be at least one field in the array.' + 'The array of fields failed to pass. The array must include at one field.' ) ); } diff --git a/lib/internal/Magento/Framework/Api/ImageProcessor.php b/lib/internal/Magento/Framework/Api/ImageProcessor.php index e2c5f8c4083b9..beadb51bc7796 100644 --- a/lib/internal/Magento/Framework/Api/ImageProcessor.php +++ b/lib/internal/Magento/Framework/Api/ImageProcessor.php @@ -139,7 +139,7 @@ public function save( public function processImageContent($entityType, $imageContent) { if (!$this->contentValidator->isValid($imageContent)) { - throw new InputException(new Phrase('The image content is not valid.')); + throw new InputException(new Phrase('The image content is invalid. Verify the content and try again.')); } $fileContent = @base64_decode($imageContent->getBase64EncodedData(), true); diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Api/ImageProcessorTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/Api/ImageProcessorTest.php index 84dee31b73015..183313cd8d05d 100644 --- a/lib/internal/Magento/Framework/Api/Test/Unit/Api/ImageProcessorTest.php +++ b/lib/internal/Magento/Framework/Api/Test/Unit/Api/ImageProcessorTest.php @@ -119,7 +119,7 @@ public function testSaveWithNoImageData() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage The image content is not valid. + * @expectedExceptionMessage The image content is invalid. Verify the content and try again. */ public function testSaveInputException() { diff --git a/lib/internal/Magento/Framework/App/ActionFactory.php b/lib/internal/Magento/Framework/App/ActionFactory.php index f929c38b75219..94f5ef36eb9c9 100644 --- a/lib/internal/Magento/Framework/App/ActionFactory.php +++ b/lib/internal/Magento/Framework/App/ActionFactory.php @@ -5,6 +5,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\App; /** @@ -35,7 +36,9 @@ public function __construct(\Magento\Framework\ObjectManagerInterface $objectMan public function create($actionName) { if (!is_subclass_of($actionName, \Magento\Framework\App\ActionInterface::class)) { - throw new \InvalidArgumentException('Invalid action name provided'); + throw new \InvalidArgumentException( + 'The action name provided is invalid. Verify the action name and try again.' + ); } return $this->_objectManager->create($actionName); } diff --git a/lib/internal/Magento/Framework/App/Config/Initial/Reader.php b/lib/internal/Magento/Framework/App/Config/Initial/Reader.php index c8caefc42c071..161d8a8da702d 100644 --- a/lib/internal/Magento/Framework/App/Config/Initial/Reader.php +++ b/lib/internal/Magento/Framework/App/Config/Initial/Reader.php @@ -105,7 +105,10 @@ public function read() } } catch (\Magento\Framework\Config\Dom\ValidationException $e) { throw new \Magento\Framework\Exception\LocalizedException( - new \Magento\Framework\Phrase("Invalid XML in file %1:\n%2", [$file, $e->getMessage()]) + new \Magento\Framework\Phrase( + 'The XML in file "%1" is invalid:' . "\n%2\nVerify the XML and try again.", + [$file, $e->getMessage()] + ) ); } } diff --git a/lib/internal/Magento/Framework/App/Config/Scope/Validator.php b/lib/internal/Magento/Framework/App/Config/Scope/Validator.php index 694ba70e1e1b0..9c0f60286e093 100644 --- a/lib/internal/Magento/Framework/App/Config/Scope/Validator.php +++ b/lib/internal/Magento/Framework/App/Config/Scope/Validator.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\App\Config\Scope; use InvalidArgumentException; @@ -49,7 +50,7 @@ public function isValid($scope, $scopeCode = null) } if (empty($scope)) { - throw new LocalizedException(new Phrase('Enter a scope before proceeding.')); + throw new LocalizedException(new Phrase('A scope is missing. Enter a scope and try again.')); } $this->validateScopeCode($scopeCode); @@ -58,10 +59,12 @@ public function isValid($scope, $scopeCode = null) $scopeResolver = $this->scopeResolverPool->get($scope); $scopeResolver->getScope($scopeCode)->getId(); } catch (InvalidArgumentException $e) { - throw new LocalizedException(new Phrase('The "%1" value doesn\'t exist. Enter another value.', [$scope])); + throw new LocalizedException( + new Phrase('The "%1" value doesn\'t exist. Enter another value and try again.', [$scope]) + ); } catch (NoSuchEntityException $e) { throw new LocalizedException( - new Phrase('The "%1" value doesn\'t exist. Enter another value.', [$scopeCode]) + new Phrase('The "%1" value doesn\'t exist. Enter another value and try again.', [$scopeCode]) ); } @@ -79,7 +82,7 @@ public function isValid($scope, $scopeCode = null) private function validateScopeCode($scopeCode) { if (empty($scopeCode)) { - throw new LocalizedException(new Phrase('Enter a scope code before proceeding.')); + throw new LocalizedException(new Phrase('A scope code is missing. Enter a code and try again.')); } if (!preg_match('/^[a-z]+[a-z0-9_]*$/', $scopeCode)) { diff --git a/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php b/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php index 06a66a2b3f873..ff7077213c5c3 100644 --- a/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php +++ b/lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php @@ -9,7 +9,9 @@ use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\Config\File\ConfigFilePool; use Magento\Framework\Exception\FileSystemException; +use Magento\Framework\Exception\RuntimeException; use Magento\Framework\Filesystem\DriverPool; +use Magento\Framework\Phrase; /** * Deployment configuration reader. @@ -87,6 +89,7 @@ public function getFiles() * @param string $fileKey The file key (deprecated) * @return array * @throws FileSystemException If file can not be read + * @throws RuntimeException If file is invalid * @throws \Exception If file key is not correct * @see FileReader */ @@ -99,6 +102,9 @@ public function load($fileKey = null) $filePath = $path . '/' . $this->configFilePool->getPath($fileKey); if ($fileDriver->isExists($filePath)) { $result = include $filePath; + if (!is_array($result)) { + throw new RuntimeException(new Phrase("Invalid configuration file: '%1'", [$filePath])); + } } } else { $configFiles = $this->configFilePool->getPaths(); @@ -108,11 +114,14 @@ public function load($fileKey = null) $configFile = $path . '/' . $this->configFilePool->getPath($fileKey); if ($fileDriver->isExists($configFile)) { $fileData = include $configFile; + if (!is_array($fileData)) { + throw new RuntimeException(new Phrase("Invalid configuration file: '%1'", [$configFile])); + } } else { continue; } $allFilesData[$configFile] = $fileData; - if (is_array($fileData) && count($fileData) > 0) { + if ($fileData) { $result = array_replace_recursive($result, $fileData); } } diff --git a/lib/internal/Magento/Framework/App/DeploymentConfig/Writer.php b/lib/internal/Magento/Framework/App/DeploymentConfig/Writer.php index 3ff7a0c9539be..1722ca4fe2577 100644 --- a/lib/internal/Magento/Framework/App/DeploymentConfig/Writer.php +++ b/lib/internal/Magento/Framework/App/DeploymentConfig/Writer.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\App\DeploymentConfig; use Magento\Framework\App\DeploymentConfig; @@ -14,6 +15,7 @@ /** * Deployment configuration writer to files: env.php, config.php. + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Writer { @@ -144,7 +146,7 @@ public function saveConfig(array $data, $override = false, $pool = null, array $ $this->filesystem->getDirectoryWrite(DirectoryList::CONFIG)->writeFile($writeFilePath, $contents); } catch (FileSystemException $e) { throw new FileSystemException( - new Phrase('Deployment config file %1 is not writable.', [$paths[$fileKey]]) + new Phrase('The "%1" deployment config file isn\'t writable.', [$paths[$fileKey]]) ); } if (function_exists('opcache_invalidate')) { diff --git a/lib/internal/Magento/Framework/App/Language/Dictionary.php b/lib/internal/Magento/Framework/App/Language/Dictionary.php index 02ee6ca2c9579..294490a665cbe 100644 --- a/lib/internal/Magento/Framework/App/Language/Dictionary.php +++ b/lib/internal/Magento/Framework/App/Language/Dictionary.php @@ -85,7 +85,7 @@ public function getDictionary($languageCode) } catch (\Magento\Framework\Config\Dom\ValidationException $e) { throw new \Magento\Framework\Exception\LocalizedException( new \Magento\Framework\Phrase( - "Invalid XML in file %1:\n%2", + 'The XML in file "%1" is invalid:' . "\n%2\nVerify the XML and try again.", [$path . '/language.xml', $e->getMessage()] ), $e diff --git a/lib/internal/Magento/Framework/App/Response/HeaderManager.php b/lib/internal/Magento/Framework/App/Response/HeaderManager.php index 1c2721b862ad1..8b127d5f111a7 100644 --- a/lib/internal/Magento/Framework/App/Response/HeaderManager.php +++ b/lib/internal/Magento/Framework/App/Response/HeaderManager.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\App\Response; use Magento\Framework\App\Response\HeaderProvider\HeaderProviderInterface; @@ -24,7 +25,7 @@ public function __construct($headerProviderList) { foreach ($headerProviderList as $header) { if (!($header instanceof HeaderProviderInterface)) { - throw new LocalizedException(new Phrase('Invalid header provider')); + throw new LocalizedException(new Phrase('The header provider is invalid. Verify and try again.')); } } $this->headerProviders = $headerProviderList; diff --git a/lib/internal/Magento/Framework/App/Scope/Validator.php b/lib/internal/Magento/Framework/App/Scope/Validator.php index 242277ed98e8f..62839e634983e 100644 --- a/lib/internal/Magento/Framework/App/Scope/Validator.php +++ b/lib/internal/Magento/Framework/App/Scope/Validator.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\App\Scope; use InvalidArgumentException; @@ -47,7 +48,7 @@ public function isValid($scope, $scopeCode = null) } if (empty($scope)) { - throw new LocalizedException(new Phrase('Enter a scope before proceeding.')); + throw new LocalizedException(new Phrase('A scope is missing. Enter a scope and try again.')); } $this->validateScopeCode($scopeCode); @@ -56,10 +57,12 @@ public function isValid($scope, $scopeCode = null) $scopeResolver = $this->scopeResolverPool->get($scope); $scopeResolver->getScope($scopeCode)->getId(); } catch (InvalidArgumentException $e) { - throw new LocalizedException(new Phrase('The "%1" value doesn\'t exist. Enter another value.', [$scope])); + throw new LocalizedException( + new Phrase('The "%1" value doesn\'t exist. Enter another value and try again.', [$scope]) + ); } catch (NoSuchEntityException $e) { throw new LocalizedException( - new Phrase('The "%1" value doesn\'t exist. Enter another value.', [$scopeCode]) + new Phrase('The "%1" value doesn\'t exist. Enter another value and try again.', [$scopeCode]) ); } @@ -77,7 +80,7 @@ public function isValid($scope, $scopeCode = null) private function validateScopeCode($scopeCode) { if (empty($scopeCode)) { - throw new LocalizedException(new Phrase('Enter a scope code before proceeding.')); + throw new LocalizedException(new Phrase('A scope code is missing. Enter a code and try again.')); } if (!preg_match('/^[a-z]+[a-z0-9_]*$/', $scopeCode)) { diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/ReaderTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/ReaderTest.php index 56589b20dcd0c..5a504cf6367af 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/ReaderTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/ReaderTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\App\Test\Unit\Config\Initial; use Magento\Framework\Filesystem; @@ -132,7 +133,7 @@ function ($arguments) use ($validationStateMock) { /** * @covers \Magento\Framework\App\Config\Initial\Reader::read * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessageRegExp /Invalid XML in file (.*?)/ + * @expectedExceptionMessage Verify the XML and try again. */ public function testReadInvalidConfig() { diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/Scope/ValidatorTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/Scope/ValidatorTest.php index f0863a81b7999..1e72017dcf7a8 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Config/Scope/ValidatorTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/Scope/ValidatorTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\App\Test\Unit\Config\Scope; use Magento\Framework\App\Config\ScopeConfigInterface; @@ -81,7 +82,7 @@ public function testNotEmptyScopeCodeForDefaultScope() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Enter a scope before proceeding. + * @expectedExceptionMessage A scope is missing. Enter a scope and try again. */ public function testEmptyScope() { @@ -90,7 +91,7 @@ public function testEmptyScope() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Enter a scope code before proceeding. + * @expectedExceptionMessage A scope code is missing. Enter a code and try again. */ public function testEmptyScopeCode() { @@ -108,7 +109,7 @@ public function testWrongScopeCodeFormat() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage The "not_default_scope" value doesn't exist. Enter another value. + * @expectedExceptionMessage The "not_default_scope" value doesn't exist. Enter another value and try again. */ public function testScopeNotExist() { @@ -123,7 +124,7 @@ public function testScopeNotExist() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage The "not_exist_scope_code" value doesn't exist. Enter another value. + * @expectedExceptionMessage The "not_exist_scope_code" value doesn't exist. Enter another value and try again. */ public function testScopeCodeNotExist() { diff --git a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/WriterTest.php b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/WriterTest.php index d4783cd36a051..31d0ca96f1af7 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/WriterTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/WriterTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\App\Test\Unit\DeploymentConfig; use Magento\Framework\App\DeploymentConfig; @@ -243,7 +244,7 @@ public function testSaveConfigOverride() /** * @expectedException \Magento\Framework\Exception\FileSystemException - * @expectedExceptionMessage Deployment config file env.php is not writable. + * @expectedExceptionMessage The "env.php" deployment config file isn't writable. */ public function testSaveConfigException() { diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Scope/ValidatorTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Scope/ValidatorTest.php index b9df13c67a863..5c28899b4d405 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Scope/ValidatorTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Scope/ValidatorTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\App\Test\Unit\Scope; use Magento\Framework\App\Config\ScopeConfigInterface; @@ -76,7 +77,7 @@ public function testNotEmptyScopeCodeForDefaultScope() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Enter a scope before proceeding. + * @expectedExceptionMessage A scope is missing. Enter a scope and try again. */ public function testEmptyScope() { @@ -85,7 +86,7 @@ public function testEmptyScope() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Enter a scope code before proceeding. + * @expectedExceptionMessage A scope code is missing. Enter a code and try again. */ public function testEmptyScopeCode() { @@ -103,7 +104,7 @@ public function testWrongScopeCodeFormat() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage The "not_default_scope" value doesn't exist. Enter another value. + * @expectedExceptionMessage The "not_default_scope" value doesn't exist. Enter another value and try again. */ public function testScopeNotExist() { @@ -118,7 +119,7 @@ public function testScopeNotExist() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage The "not_exist_scope_code" value doesn't exist. Enter another value. + * @expectedExceptionMessage The "not_exist_scope_code" value doesn't exist. Enter another value and try again. */ public function testScopeCodeNotExist() { diff --git a/lib/internal/Magento/Framework/Archive/Helper/File.php b/lib/internal/Magento/Framework/Archive/Helper/File.php index 60959a658e3f8..5d2a405578c8c 100644 --- a/lib/internal/Magento/Framework/Archive/Helper/File.php +++ b/lib/internal/Magento/Framework/Archive/Helper/File.php @@ -96,7 +96,7 @@ public function open($mode = 'w+', $chmod = null) if (!is_writable($this->_fileLocation)) { throw new LocalizedException( new \Magento\Framework\Phrase( - 'Permission denied to write to %1', + 'You don\'t have permissions to write to the "%1" file.', [$this->_fileLocation] ) ); @@ -105,7 +105,7 @@ public function open($mode = 'w+', $chmod = null) if (is_file($this->_filePath) && !is_writable($this->_filePath)) { throw new LocalizedException( new \Magento\Framework\Phrase( - "Can't open file %1 for writing. Permission denied.", + 'You don\'t have the permissions to open the "%1" file for writing access.', [$this->_fileName] ) ); @@ -115,13 +115,19 @@ public function open($mode = 'w+', $chmod = null) if ($this->_isReadableMode($mode) && (!is_file($this->_filePath) || !is_readable($this->_filePath))) { if (!is_file($this->_filePath)) { throw new LocalizedException( - new \Magento\Framework\Phrase('File %1 does not exist', [$this->_filePath]) + new \Magento\Framework\Phrase( + 'The "%1" file doesn\'t exist. Verify the file and try again.', + [$this->_filePath] + ) ); } if (!is_readable($this->_filePath)) { throw new LocalizedException( - new \Magento\Framework\Phrase('Permission denied to read file %1', [$this->_filePath]) + new \Magento\Framework\Phrase( + 'You don\'t have permissions to read the "%1" file.', + [$this->_filePath] + ) ); } } @@ -200,7 +206,7 @@ protected function _open($mode) if (false === $this->_fileHandler) { throw new LocalizedException( - new \Magento\Framework\Phrase('Failed to open file %1', [$this->_filePath]) + new \Magento\Framework\Phrase('The "%1" file failed to open.', [$this->_filePath]) ); } } @@ -218,7 +224,7 @@ protected function _write($data) if (false === $result) { throw new LocalizedException( - new \Magento\Framework\Phrase('Failed to write data to %1', [$this->_filePath]) + new \Magento\Framework\Phrase('The data failed to write to "%1".', [$this->_filePath]) ); } } diff --git a/lib/internal/Magento/Framework/Archive/Helper/File/Bz.php b/lib/internal/Magento/Framework/Archive/Helper/File/Bz.php index a3623d2b05c9f..d84cf25c54137 100644 --- a/lib/internal/Magento/Framework/Archive/Helper/File/Bz.php +++ b/lib/internal/Magento/Framework/Archive/Helper/File/Bz.php @@ -24,7 +24,7 @@ protected function _open($mode) if (false === $this->_fileHandler) { throw new \Magento\Framework\Exception\LocalizedException( - new \Magento\Framework\Phrase('Failed to open file %1', [$this->_filePath]) + new \Magento\Framework\Phrase('The "%1" file failed to open.', [$this->_filePath]) ); } } @@ -38,7 +38,7 @@ protected function _write($data) if (false === $result) { throw new \Magento\Framework\Exception\LocalizedException( - new \Magento\Framework\Phrase('Failed to write data to %1', [$this->_filePath]) + new \Magento\Framework\Phrase('The data failed to write to "%1".', [$this->_filePath]) ); } } diff --git a/lib/internal/Magento/Framework/Archive/Helper/File/Gz.php b/lib/internal/Magento/Framework/Archive/Helper/File/Gz.php index db5038963c4f3..5204bcae9ae32 100644 --- a/lib/internal/Magento/Framework/Archive/Helper/File/Gz.php +++ b/lib/internal/Magento/Framework/Archive/Helper/File/Gz.php @@ -24,7 +24,7 @@ protected function _open($mode) if (false === $this->_fileHandler) { throw new \Magento\Framework\Exception\LocalizedException( - new \Magento\Framework\Phrase('Failed to open file %1', [$this->_filePath]) + new \Magento\Framework\Phrase('The "%1" file failed to open.', [$this->_filePath]) ); } } @@ -38,7 +38,7 @@ protected function _write($data) if (empty($result) && !empty($data)) { throw new \Magento\Framework\Exception\LocalizedException( - new \Magento\Framework\Phrase('Failed to write data to %1', [$this->_filePath]) + new \Magento\Framework\Phrase('The data failed to write to "%1".', [$this->_filePath]) ); } } diff --git a/lib/internal/Magento/Framework/Backup/Filesystem/Rollback/Fs.php b/lib/internal/Magento/Framework/Backup/Filesystem/Rollback/Fs.php index 19109001b02c1..14531deda45bb 100644 --- a/lib/internal/Magento/Framework/Backup/Filesystem/Rollback/Fs.php +++ b/lib/internal/Magento/Framework/Backup/Filesystem/Rollback/Fs.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Backup\Filesystem\Rollback; use Magento\Framework\App\ObjectManager; @@ -66,7 +67,7 @@ public function run() } throw new NotEnoughPermissions( - new Phrase('Unable to make rollback because not all files are writable') + new Phrase("The rollback can't be executed because not all files are writable.") ); } diff --git a/lib/internal/Magento/Framework/Communication/Config/ConfigParser.php b/lib/internal/Magento/Framework/Communication/Config/ConfigParser.php index 350ac247a560c..5456d3c717ad8 100644 --- a/lib/internal/Magento/Framework/Communication/Config/ConfigParser.php +++ b/lib/internal/Magento/Framework/Communication/Config/ConfigParser.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Communication\Config; use Magento\Framework\Exception\LocalizedException; @@ -30,7 +31,7 @@ public function parseServiceMethod($serviceMethod) if (!isset($matches[1]) || !isset($matches[2])) { throw new LocalizedException( new Phrase( - 'Service method "%serviceMethod" must match the following pattern: "%pattern"', + 'The "%serviceMethod" service method must match the "%pattern" pattern.', ['serviceMethod' => $serviceMethod, 'pattern' => $pattern] ) ); diff --git a/lib/internal/Magento/Framework/Config/AbstractXml.php b/lib/internal/Magento/Framework/Config/AbstractXml.php index a8d0eff6bce74..caead98147bf5 100644 --- a/lib/internal/Magento/Framework/Config/AbstractXml.php +++ b/lib/internal/Magento/Framework/Config/AbstractXml.php @@ -89,7 +89,10 @@ protected function _merge($configFiles) $this->_getDomConfigModel()->merge($content); } catch (\Magento\Framework\Config\Dom\ValidationException $e) { throw new \Magento\Framework\Exception\LocalizedException( - new \Magento\Framework\Phrase("Invalid XML in file %1:\n%2", [$key, $e->getMessage()]) + new \Magento\Framework\Phrase( + 'The XML in file "%1" is invalid:' . "\n%2\nVerify the XML and try again.", + [$key, $e->getMessage()] + ) ); } } diff --git a/lib/internal/Magento/Framework/Config/Reader/Filesystem.php b/lib/internal/Magento/Framework/Config/Reader/Filesystem.php index 744649ad45fa3..e2008b95c3b61 100644 --- a/lib/internal/Magento/Framework/Config/Reader/Filesystem.php +++ b/lib/internal/Magento/Framework/Config/Reader/Filesystem.php @@ -6,6 +6,7 @@ * See COPYING.txt for license details. * */ + namespace Magento\Framework\Config\Reader; /** @@ -152,7 +153,10 @@ protected function _readFiles($fileList) } } catch (\Magento\Framework\Config\Dom\ValidationException $e) { throw new \Magento\Framework\Exception\LocalizedException( - new \Magento\Framework\Phrase("Invalid XML in file %1:\n%2", [$key, $e->getMessage()]) + new \Magento\Framework\Phrase( + 'The XML in file "%1" is invalid:' . "\n%2\nVerify the XML and try again.", + [$key, $e->getMessage()] + ) ); } } diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/Reader/FilesystemTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/Reader/FilesystemTest.php index bd1aaa7ca791f..d48b9be427628 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/Reader/FilesystemTest.php +++ b/lib/internal/Magento/Framework/Config/Test/Unit/Reader/FilesystemTest.php @@ -119,7 +119,7 @@ public function testReadWithInvalidDom() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Invalid XML in file + * @expectedExceptionMessage The XML in file "0" is invalid: */ public function testReadWithInvalidXml() { diff --git a/lib/internal/Magento/Framework/Console/QuestionPerformer/YesNo.php b/lib/internal/Magento/Framework/Console/QuestionPerformer/YesNo.php index 1e9ae60472563..b46612df59296 100644 --- a/lib/internal/Magento/Framework/Console/QuestionPerformer/YesNo.php +++ b/lib/internal/Magento/Framework/Console/QuestionPerformer/YesNo.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Console\QuestionPerformer; use Magento\Framework\Exception\LocalizedException; @@ -81,7 +82,7 @@ private function getConfirmationQuestion(array $messages) $question->setValidator(function ($answer) { if (!in_array(strtolower($answer), ['yes', 'y', 'no', 'n'])) { throw new LocalizedException( - new Phrase('Please type [y]es or [n]o') + new Phrase('A [y]es or [n]o selection needs to be made. Select and try again.') ); } diff --git a/lib/internal/Magento/Framework/Convert/ConvertArray.php b/lib/internal/Magento/Framework/Convert/ConvertArray.php index 089c25a0da771..1cd377c7d2cc8 100644 --- a/lib/internal/Magento/Framework/Convert/ConvertArray.php +++ b/lib/internal/Magento/Framework/Convert/ConvertArray.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Convert; use Magento\Framework\Exception\LocalizedException; @@ -24,7 +25,11 @@ class ConvertArray public function assocToXml(array $array, $rootName = '_') { if (empty($rootName) || is_numeric($rootName)) { - throw new LocalizedException(new \Magento\Framework\Phrase('Root element must not be empty or numeric')); + throw new LocalizedException( + new \Magento\Framework\Phrase( + "The root element can't be empty or use numbers. Change the element and try again." + ) + ); } $xmlStr = <<<XML @@ -34,7 +39,9 @@ public function assocToXml(array $array, $rootName = '_') $xml = new \SimpleXMLElement($xmlStr); foreach (array_keys($array) as $key) { if (is_numeric($key)) { - throw new LocalizedException(new \Magento\Framework\Phrase('Array root keys must not be numeric.')); + throw new LocalizedException( + new \Magento\Framework\Phrase('An error occurred. Use non-numeric array root keys and try again.') + ); } } return self::_assocToXml($array, $rootName, $xml); @@ -77,7 +84,8 @@ private function _assocToXml(array $array, $rootName, \SimpleXMLElement $xml) if ($key === $rootName) { throw new LocalizedException( new \Magento\Framework\Phrase( - 'Associative key must not be the same as its parent associative key.' + "An associative key can't be the same as its parent associative key. " + . "Verify and try again." ) ); } @@ -94,7 +102,9 @@ private function _assocToXml(array $array, $rootName, \SimpleXMLElement $xml) } if ($hasNumericKey && $hasStringKey) { throw new LocalizedException( - new \Magento\Framework\Phrase('Associative and numeric keys must not be mixed at one level.') + new \Magento\Framework\Phrase( + "Associative and numeric keys can't be mixed at one level. Verify and try again." + ) ); } return $xml; diff --git a/lib/internal/Magento/Framework/Convert/Test/Unit/ConvertArrayTest.php b/lib/internal/Magento/Framework/Convert/Test/Unit/ConvertArrayTest.php index 70414b2802c8a..d80e2b7e50015 100644 --- a/lib/internal/Magento/Framework/Convert/Test/Unit/ConvertArrayTest.php +++ b/lib/internal/Magento/Framework/Convert/Test/Unit/ConvertArrayTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Convert\Test\Unit; use \Magento\Framework\Convert\ConvertArray; @@ -34,7 +35,7 @@ public function testAssocToXml() /** * @expectedException \Exception - * @expectedExceptionMessage Associative and numeric keys must not be mixed at one level. + * @expectedExceptionMessage Associative and numeric keys can't be mixed at one level. Verify and try again. */ public function testAssocToXmlExceptionByKey() { diff --git a/lib/internal/Magento/Framework/Crontab/CrontabManager.php b/lib/internal/Magento/Framework/Crontab/CrontabManager.php index 94e2027abd135..6049b7fba6d44 100644 --- a/lib/internal/Magento/Framework/Crontab/CrontabManager.php +++ b/lib/internal/Magento/Framework/Crontab/CrontabManager.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Crontab; use Magento\Framework\App\Filesystem\DirectoryList; @@ -86,7 +87,7 @@ public function getTasks() public function saveTasks(array $tasks) { if (!$tasks) { - throw new LocalizedException(new Phrase('List of tasks is empty')); + throw new LocalizedException(new Phrase('The list of tasks is empty. Add tasks and try again.')); } $this->checkSupportedOs(); @@ -99,7 +100,7 @@ public function saveTasks(array $tasks) } if (empty($task['command'])) { - throw new LocalizedException(new Phrase('Command should not be empty')); + throw new LocalizedException(new Phrase("The command shouldn't be empty. Enter and try again.")); } $tasks[$key]['command'] = str_replace( diff --git a/lib/internal/Magento/Framework/Crontab/Test/Unit/CrontabManagerTest.php b/lib/internal/Magento/Framework/Crontab/Test/Unit/CrontabManagerTest.php index 5f7984c085ac7..b160eb0a7f95e 100644 --- a/lib/internal/Magento/Framework/Crontab/Test/Unit/CrontabManagerTest.php +++ b/lib/internal/Magento/Framework/Crontab/Test/Unit/CrontabManagerTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Crontab\Test\Unit; use Magento\Framework\Crontab\CrontabManager; @@ -192,7 +193,7 @@ public function removeTasksDataProvider() /** * @return void * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage List of tasks is empty + * @expectedExceptionMessage The list of tasks is empty. Add tasks and try again. */ public function testSaveTasksWithEmptyTasksList() { @@ -219,7 +220,7 @@ public function testSaveTasksWithEmptyTasksList() /** * @return void * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Command should not be empty + * @expectedExceptionMessage The command shouldn't be empty. Enter and try again. */ public function testSaveTasksWithoutCommand() { diff --git a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php index 7dc88c4369858..97377c94ca91a 100644 --- a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php +++ b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\DB\Adapter\Pdo; use Magento\Framework\App\ObjectManager; @@ -581,7 +582,9 @@ protected function _query($sql, $bind = []) public function query($sql, $bind = []) { if (strpos(rtrim($sql, " \t\n\r\0;"), ';') !== false && count($this->_splitMultiQuery($sql)) > 1) { - throw new \Magento\Framework\Exception\LocalizedException(new Phrase('Cannot execute multiple queries')); + throw new \Magento\Framework\Exception\LocalizedException( + new Phrase("Multiple queries can't be executed. Run a single query and try again.") + ); } return $this->_query($sql, $bind); } diff --git a/lib/internal/Magento/Framework/DB/Query/Generator.php b/lib/internal/Magento/Framework/DB/Query/Generator.php index 1d903b05b8f75..0538aec760bd7 100644 --- a/lib/internal/Magento/Framework/DB/Query/Generator.php +++ b/lib/internal/Magento/Framework/DB/Query/Generator.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\DB\Query; use Magento\Framework\Exception\LocalizedException; @@ -75,7 +76,9 @@ public function generate( $fromSelect = $select->getPart(\Magento\Framework\DB\Select::FROM); if (empty($fromSelect)) { throw new LocalizedException( - new \Magento\Framework\Phrase('Select object must have correct "FROM" part') + new \Magento\Framework\Phrase( + 'The select object must have the correct "FROM" part. Verify and try again.' + ) ); } @@ -143,7 +146,9 @@ public function generateByRange( $fromSelect = $select->getPart(\Magento\Framework\DB\Select::FROM); if (empty($fromSelect)) { throw new LocalizedException( - new \Magento\Framework\Phrase('Select object must have correct "FROM" part') + new \Magento\Framework\Phrase( + 'The select object must have the correct "FROM" part. Verify and try again.' + ) ); } diff --git a/lib/internal/Magento/Framework/DB/Test/Unit/Adapter/Pdo/MysqlTest.php b/lib/internal/Magento/Framework/DB/Test/Unit/Adapter/Pdo/MysqlTest.php index c86f097520462..10a8fdb3a8361 100644 --- a/lib/internal/Magento/Framework/DB/Test/Unit/Adapter/Pdo/MysqlTest.php +++ b/lib/internal/Magento/Framework/DB/Test/Unit/Adapter/Pdo/MysqlTest.php @@ -220,7 +220,7 @@ public function testCheckDdlTransaction($ddlQuery) /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Cannot execute multiple queries + * @expectedExceptionMessage Multiple queries can't be executed. Run a single query and try again. */ public function testMultipleQueryException() { diff --git a/lib/internal/Magento/Framework/DB/Test/Unit/Tree/NodeTest.php b/lib/internal/Magento/Framework/DB/Test/Unit/Tree/NodeTest.php index 8d3623d485b89..69cd2be4d20a4 100644 --- a/lib/internal/Magento/Framework/DB/Test/Unit/Tree/NodeTest.php +++ b/lib/internal/Magento/Framework/DB/Test/Unit/Tree/NodeTest.php @@ -5,6 +5,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\DB\Test\Unit\Tree; class NodeTest extends \PHPUnit\Framework\TestCase @@ -93,21 +94,21 @@ public function constructorDataProvider() 'node_data' => null, 'keys' => null, ], \Magento\Framework\Exception\LocalizedException::class, - 'Empty array of node information', + 'The node information is empty. Enter the information and try again.', ], [ [ 'node_data' => null, 'keys' => true, ], \Magento\Framework\Exception\LocalizedException::class, - 'Empty array of node information' + 'The node information is empty. Enter the information and try again.' ], [ [ 'node_data' => true, 'keys' => null, ], \Magento\Framework\Exception\LocalizedException::class, - 'Empty keys array' + 'Enter the encryption key and try again.' ] ]; } diff --git a/lib/internal/Magento/Framework/DB/Tree.php b/lib/internal/Magento/Framework/DB/Tree.php index e96b5e123f8dd..a162640e5aa50 100644 --- a/lib/internal/Magento/Framework/DB/Tree.php +++ b/lib/internal/Magento/Framework/DB/Tree.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\DB; use Magento\Framework\DB\Tree\Node; @@ -103,7 +104,9 @@ public function __construct($config = []) $conn->setAttribute(\PDO::ATTR_EMULATE_PREPARES, true); } } else { - throw new LocalizedException(new Phrase('db object is not set in config')); + throw new LocalizedException( + new Phrase('The "db object" isn\'t set in config. Set the "db object" and try again.') + ); } if (!empty($config['table'])) { diff --git a/lib/internal/Magento/Framework/DB/Tree/Node.php b/lib/internal/Magento/Framework/DB/Tree/Node.php index a11faecb851eb..8088718be5e73 100644 --- a/lib/internal/Magento/Framework/DB/Tree/Node.php +++ b/lib/internal/Magento/Framework/DB/Tree/Node.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\DB\Tree; use Magento\Framework\Exception\LocalizedException; @@ -65,10 +66,14 @@ class Node public function __construct($nodeData, $keys) { if (empty($nodeData)) { - throw new LocalizedException(new \Magento\Framework\Phrase('Empty array of node information')); + throw new LocalizedException( + new \Magento\Framework\Phrase('The node information is empty. Enter the information and try again.') + ); } if (empty($keys)) { - throw new LocalizedException(new \Magento\Framework\Phrase('Empty keys array')); + throw new LocalizedException( + new \Magento\Framework\Phrase("The encryption key can't be empty. Enter the key and try again.") + ); } $this->id = $nodeData[$keys['id']]; diff --git a/lib/internal/Magento/Framework/Data/Form.php b/lib/internal/Magento/Framework/Data/Form.php index fbec614dc3c96..abeda0c17542e 100644 --- a/lib/internal/Magento/Framework/Data/Form.php +++ b/lib/internal/Magento/Framework/Data/Form.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Data; use Magento\Framework\Data\Form\Element\AbstractElement; @@ -175,7 +176,9 @@ public function addElementToCollection($element) public function checkElementId($elementId) { if ($this->_elementIdExists($elementId)) { - throw new \InvalidArgumentException('Element with id "' . $elementId . '" already exists'); + throw new \InvalidArgumentException( + 'An element with a "' . $elementId . '" ID already exists.' + ); } return true; } diff --git a/lib/internal/Magento/Framework/Data/Form/Element/Editor.php b/lib/internal/Magento/Framework/Data/Form/Element/Editor.php index 73e05f6eaa5d1..f2368beadc51a 100644 --- a/lib/internal/Magento/Framework/Data/Form/Element/Editor.php +++ b/lib/internal/Magento/Framework/Data/Form/Element/Editor.php @@ -172,54 +172,7 @@ public function getElementHtml() ' >' . $this->getEscapedValue() . '</textarea>' . - $js . - ' - <script type="text/javascript"> - //<![CDATA[ - window.tinyMCE_GZ = window.tinyMCE_GZ || {}; - window.tinyMCE_GZ.loaded = true; - require([ - "jquery", - "mage/translate", - "mage/adminhtml/events", - "mage/adminhtml/wysiwyg/tiny_mce/setup", - "mage/adminhtml/wysiwyg/widget" - ], function(jQuery){' . - "\n" . - ' (function($) {$.mage.translate.add(' . - $this->serializer->serialize( - $this->getButtonTranslations() - ) . - ')})(jQuery);' . - "\n" . - $jsSetupObject . - ' = new wysiwygSetup("' . - $this->getHtmlId() . - '", ' . - $this->getJsonConfig() . - ');' . - $forceLoad . - ' - editorFormValidationHandler = ' . - $jsSetupObject . - '.onFormValidation.bind(' . - $jsSetupObject . - '); - Event.observe("toggle' . - $this->getHtmlId() . - '", "click", ' . - $jsSetupObject . - '.toggle.bind(' . - $jsSetupObject . - ')); - varienGlobalEvents.attachEventHandler("formSubmit", editorFormValidationHandler); - varienGlobalEvents.clearEventHandlers("open_browser_callback"); - varienGlobalEvents.attachEventHandler("open_browser_callback", ' . - $jsSetupObject . - '.openFileBrowser); - //]]> - }); - </script>'; + $js . $this->getInlineJs($jsSetupObject, $forceLoad); $html = $this->_wrapIntoContainer($html); $html .= $this->getAfterElementHtml(); @@ -516,4 +469,63 @@ protected function isToggleButtonVisible() { return !$this->getConfig()->hasData('toggle_button') || $this->getConfig('toggle_button'); } + + /** + * Returns inline js to initialize wysiwyg adapter + * + * @param string $jsSetupObject + * @param string $forceLoad + * @return string + */ + protected function getInlineJs($jsSetupObject, $forceLoad) + { + $jsString = ' + <script type="text/javascript"> + //<![CDATA[ + window.tinyMCE_GZ = window.tinyMCE_GZ || {}; + window.tinyMCE_GZ.loaded = true; + require([ + "jquery", + "mage/translate", + "mage/adminhtml/events", + "mage/adminhtml/wysiwyg/tiny_mce/setup", + "mage/adminhtml/wysiwyg/widget" + ], function(jQuery){' . + "\n" . + ' (function($) {$.mage.translate.add(' . + $this->serializer->serialize( + $this->getButtonTranslations() + ) . + ')})(jQuery);' . + "\n" . + $jsSetupObject . + ' = new wysiwygSetup("' . + $this->getHtmlId() . + '", ' . + $this->getJsonConfig() . + ');' . + $forceLoad . + ' + editorFormValidationHandler = ' . + $jsSetupObject . + '.onFormValidation.bind(' . + $jsSetupObject . + '); + Event.observe("toggle' . + $this->getHtmlId() . + '", "click", ' . + $jsSetupObject . + '.toggle.bind(' . + $jsSetupObject . + ')); + varienGlobalEvents.attachEventHandler("formSubmit", editorFormValidationHandler); + varienGlobalEvents.clearEventHandlers("open_browser_callback"); + varienGlobalEvents.attachEventHandler("open_browser_callback", ' . + $jsSetupObject . + '.openFileBrowser); + //]]> + }); + </script>'; + return $jsString; + } } diff --git a/lib/internal/Magento/Framework/Data/Structure.php b/lib/internal/Magento/Framework/Data/Structure.php index 9d540e8a49f08..f2c45fa160cc2 100644 --- a/lib/internal/Magento/Framework/Data/Structure.php +++ b/lib/internal/Magento/Framework/Data/Structure.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Data; use Magento\Framework\Exception\LocalizedException; @@ -63,7 +64,7 @@ public function importElements(array $elements) if ($group !== array_flip($group)) { throw new LocalizedException( new \Magento\Framework\Phrase( - "Invalid format of group '%1': %2", + '"%2" is an invalid format of "%1" group. Verify the format and try again.', [$groupName, var_export($group, 1)] ) ); @@ -94,7 +95,8 @@ protected function _assertParentRelation($elementId) if (empty($this->_elements[$parentId][self::CHILDREN][$elementId])) { throw new LocalizedException( new \Magento\Framework\Phrase( - "Broken parent-child relation: the '%1' is not in the nested set of '%2'.", + 'The "%1" is not in the nested set of "%2", causing the parent-child relation to break. ' + . 'Verify and try again.', [$elementId, $parentId] ) ); @@ -107,7 +109,10 @@ protected function _assertParentRelation($elementId) $this->_assertArray($children); if ($children !== array_flip(array_flip($children))) { throw new LocalizedException( - new \Magento\Framework\Phrase('Invalid format of children: %1', [var_export($children, 1)]) + new \Magento\Framework\Phrase( + 'The "%1" format of children is invalid. Verify and try again.', + [var_export($children, 1)] + ) ); } foreach (array_keys($children) as $childId) { @@ -118,7 +123,8 @@ protected function _assertParentRelation($elementId) ) { throw new LocalizedException( new \Magento\Framework\Phrase( - "Broken parent-child relation: the '%1' is supposed to have '%2' as parent.", + 'The "%1" doesn\'t have "%2" as parent, causing the parent-child relation to break. ' + . 'Verify and try again.', [$childId, $elementId] ) ); @@ -149,7 +155,7 @@ public function createElement($elementId, array $data) { if (isset($this->_elements[$elementId])) { throw new LocalizedException( - new \Magento\Framework\Phrase("Element with ID '%1' already exists.", [$elementId]) + new \Magento\Framework\Phrase('An element with a "%1" ID already exists.', [$elementId]) ); } $this->_elements[$elementId] = []; @@ -225,7 +231,7 @@ public function setAttribute($elementId, $attribute, $value) // break is intentionally omitted case self::CHILDREN: case self::GROUPS: - throw new \InvalidArgumentException("Attribute '{$attribute}' is reserved and cannot be set."); + throw new \InvalidArgumentException("The '{$attribute}' attribute is reserved and can't be set."); default: $this->_elements[$elementId][$attribute] = $value; } @@ -261,7 +267,7 @@ public function renameElement($oldId, $newId) $this->_assertElementExists($oldId); if (!$newId || isset($this->_elements[$newId])) { throw new LocalizedException( - new \Magento\Framework\Phrase("Element with ID '%1' is already defined.", [$newId]) + new \Magento\Framework\Phrase('An element with a "%1" ID is already defined.', [$newId]) ); } @@ -303,13 +309,17 @@ public function setAsChild($elementId, $parentId, $alias = '', $position = null) { if ($elementId == $parentId) { throw new LocalizedException( - new \Magento\Framework\Phrase("The '%1' cannot be set as child to itself.", [$elementId]) + new \Magento\Framework\Phrase( + 'The "%1" was incorrectly set as a child to itself. Resolve the issue and try again.', + [$elementId] + ) ); } if ($this->_isParentRecursively($elementId, $parentId)) { throw new LocalizedException( new \Magento\Framework\Phrase( - "The '%1' is a parent of '%2' recursively, therefore '%3' cannot be set as child to it.", + 'The "%3" cannot be set as child to "%1" because "%1" is a parent of "%2" recursively. ' + . 'Resolve the issue and try again.', [$elementId, $parentId, $elementId] ) ); @@ -542,7 +552,10 @@ protected function _getChildOffset($parentId, $childId) $index = array_search($childId, array_keys($this->getChildren($parentId))); if (false === $index) { throw new LocalizedException( - new \Magento\Framework\Phrase("The '%1' is not a child of '%2'.", [$childId, $parentId]) + new \Magento\Framework\Phrase( + 'The "%1" is not a child of "%2". Resolve the issue and try again.', + [$childId, $parentId] + ) ); } return $index; @@ -595,7 +608,7 @@ protected function _insertChild($targetParentId, $elementId, $offset, $alias) if (!empty($this->_elements[$elementId][self::PARENT])) { throw new LocalizedException( new \Magento\Framework\Phrase( - "The element '%1' already has a parent: '%2'", + 'The element "%1" can\'t have a parent because "%2" is already the parent of "%1".', [$elementId, $this->_elements[$elementId][self::PARENT]] ) ); @@ -604,13 +617,16 @@ protected function _insertChild($targetParentId, $elementId, $offset, $alias) $children = $this->getChildren($targetParentId); if (isset($children[$elementId])) { throw new LocalizedException( - new \Magento\Framework\Phrase("The element '%1' already a child of '%2'", [$elementId, $targetParentId]) + new \Magento\Framework\Phrase( + 'The element "%1" is already a child of "%2".', + [$elementId, $targetParentId] + ) ); } if (false !== array_search($alias, $children)) { throw new LocalizedException( new \Magento\Framework\Phrase( - "The element '%1' already has a child with alias '%2'", + 'The element "%1" can\'t have a child because "%1" already has a child with alias "%2".', [$targetParentId, $alias] ) ); @@ -638,7 +654,9 @@ protected function _insertChild($targetParentId, $elementId, $offset, $alias) private function _assertElementExists($elementId) { if (!isset($this->_elements[$elementId])) { - throw new \OutOfBoundsException("No element found with ID '{$elementId}'."); + throw new \OutOfBoundsException( + 'The element with the "' . $elementId . '" ID wasn\'t found. Verify the ID and try again.' + ); } } diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/FormTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/FormTest.php index 89aff747238a1..fdda09d1462b1 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/FormTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/FormTest.php @@ -104,7 +104,7 @@ public function testSettersGetters() /** * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Element with id "1" already exists + * @expectedExceptionMessage An element with a "1" ID already exists. */ public function testElementExistsException() { diff --git a/lib/internal/Magento/Framework/Exception/AuthenticationException.php b/lib/internal/Magento/Framework/Exception/AuthenticationException.php index fc097dc5562bd..9b20dea99ccf9 100644 --- a/lib/internal/Magento/Framework/Exception/AuthenticationException.php +++ b/lib/internal/Magento/Framework/Exception/AuthenticationException.php @@ -15,5 +15,5 @@ class AuthenticationException extends LocalizedException /** * @deprecated */ - const AUTHENTICATION_ERROR = 'An authentication error occurred.'; + const AUTHENTICATION_ERROR = 'An authentication error occurred. Verify and try again.'; } diff --git a/lib/internal/Magento/Framework/Exception/AuthorizationException.php b/lib/internal/Magento/Framework/Exception/AuthorizationException.php index 79bf95b22bccf..ed310117d6717 100644 --- a/lib/internal/Magento/Framework/Exception/AuthorizationException.php +++ b/lib/internal/Magento/Framework/Exception/AuthorizationException.php @@ -5,6 +5,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Exception; /** @@ -15,5 +16,5 @@ class AuthorizationException extends LocalizedException /** * @deprecated */ - const NOT_AUTHORIZED = 'Consumer is not authorized to access %resources'; + const NOT_AUTHORIZED = "The consumer isn't authorized to access %resources."; } diff --git a/lib/internal/Magento/Framework/Exception/InputException.php b/lib/internal/Magento/Framework/Exception/InputException.php index b332c88d42f71..7b1815dc0d1bb 100644 --- a/lib/internal/Magento/Framework/Exception/InputException.php +++ b/lib/internal/Magento/Framework/Exception/InputException.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Exception; use Magento\Framework\Phrase; @@ -42,7 +43,7 @@ class InputException extends AbstractAggregateException /** * @deprecated */ - const REQUIRED_FIELD = '%fieldName is a required field.'; + const REQUIRED_FIELD = '"%fieldName" is required. Enter and try again.'; /** * Initialize the input exception. @@ -87,7 +88,7 @@ public static function invalidFieldValue($fieldName, $fieldValue, \Exception $ca public static function requiredField($fieldName) { return new self( - new Phrase('%fieldName is a required field.', ['fieldName' => $fieldName]) + new Phrase('"%fieldName" is required. Enter and try again.', ['fieldName' => $fieldName]) ); } } diff --git a/lib/internal/Magento/Framework/Exception/SerializationException.php b/lib/internal/Magento/Framework/Exception/SerializationException.php index 27d0bc0c4371a..bae56b487975c 100644 --- a/lib/internal/Magento/Framework/Exception/SerializationException.php +++ b/lib/internal/Magento/Framework/Exception/SerializationException.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Exception; use Magento\Framework\Phrase; @@ -22,7 +23,7 @@ class SerializationException extends LocalizedException /** * @deprecated */ - const TYPE_MISMATCH = 'Invalid type for value: "%value". Expected Type: "%type".'; + const TYPE_MISMATCH = 'The "%value" value\'s type is invalid. The "%type" type was expected. Verify and try again.'; /** * @param \Magento\Framework\Phrase $phrase diff --git a/lib/internal/Magento/Framework/Exception/Test/Unit/AuthenticationExceptionTest.php b/lib/internal/Magento/Framework/Exception/Test/Unit/AuthenticationExceptionTest.php index f728a0deacc7e..d0b8744c34ff1 100644 --- a/lib/internal/Magento/Framework/Exception/Test/Unit/AuthenticationExceptionTest.php +++ b/lib/internal/Magento/Framework/Exception/Test/Unit/AuthenticationExceptionTest.php @@ -21,10 +21,13 @@ public function testConstructor() { $authenticationException = new AuthenticationException( new Phrase( - 'An authentication error occurred.', + 'An authentication error occurred. Verify and try again.', ['consumer_id' => 1, 'resources' => 'record2'] ) ); - $this->assertSame('An authentication error occurred.', $authenticationException->getMessage()); + $this->assertSame( + 'An authentication error occurred. Verify and try again.', + $authenticationException->getMessage() + ); } } diff --git a/lib/internal/Magento/Framework/Exception/Test/Unit/AuthorizationExceptionTest.php b/lib/internal/Magento/Framework/Exception/Test/Unit/AuthorizationExceptionTest.php index 9b96587c8d195..667d97f20aa9e 100644 --- a/lib/internal/Magento/Framework/Exception/Test/Unit/AuthorizationExceptionTest.php +++ b/lib/internal/Magento/Framework/Exception/Test/Unit/AuthorizationExceptionTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Exception\Test\Unit; use \Magento\Framework\Exception\AuthorizationException; @@ -17,10 +18,10 @@ public function testConstructor() { $authorizationException = new AuthorizationException( new Phrase( - 'Consumer is not authorized to access %resources', + 'The consumer isn\'t authorized to access %resources.', ['consumer_id' => 1, 'resources' => 'record2'] ) ); - $this->assertSame('Consumer is not authorized to access record2', $authorizationException->getMessage()); + $this->assertSame("The consumer isn't authorized to access record2.", $authorizationException->getMessage()); } } diff --git a/lib/internal/Magento/Framework/Exception/Test/Unit/InputExceptionTest.php b/lib/internal/Magento/Framework/Exception/Test/Unit/InputExceptionTest.php index edc66f2231025..44cbd7226da49 100644 --- a/lib/internal/Magento/Framework/Exception/Test/Unit/InputExceptionTest.php +++ b/lib/internal/Magento/Framework/Exception/Test/Unit/InputExceptionTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Exception\Test\Unit; use \Magento\Framework\Exception\InputException; @@ -75,7 +76,9 @@ public function testAddError() $inputException->getLogMessage() ); - $inputException->addError(new Phrase('%fieldName is a required field.', ['fieldName' => 'name'])); + $inputException->addError( + new Phrase('"%fieldName" is required. Enter and try again.', ['fieldName' => 'name']) + ); $this->assertTrue($inputException->wasErrorAdded()); $this->assertCount(2, $inputException->getErrors()); @@ -102,9 +105,9 @@ public function testAddError() $errors[0]->getLogMessage() ); - $this->assertEquals('%fieldName is a required field.', $errors[1]->getRawMessage()); - $this->assertEquals('name is a required field.', $errors[1]->getMessage()); - $this->assertEquals('name is a required field.', $errors[1]->getLogMessage()); + $this->assertEquals('"%fieldName" is required. Enter and try again.', $errors[1]->getRawMessage()); + $this->assertEquals('"name" is required. Enter and try again.', $errors[1]->getMessage()); + $this->assertEquals('"name" is required. Enter and try again.', $errors[1]->getLogMessage()); } /** diff --git a/lib/internal/Magento/Framework/Filesystem/Directory/Write.php b/lib/internal/Magento/Framework/Filesystem/Directory/Write.php index 4566f61b15572..900d8423b31d8 100644 --- a/lib/internal/Magento/Framework/Filesystem/Directory/Write.php +++ b/lib/internal/Magento/Framework/Filesystem/Directory/Write.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Filesystem\Directory; use Magento\Framework\Exception\FileSystemException; @@ -51,7 +52,7 @@ protected function assertWritable($path) $path = (!$this->driver->isFile($path)) ? $this->getAbsolutePath($this->path, $path) : $this->getAbsolutePath($path); - throw new FileSystemException(new \Magento\Framework\Phrase('The path "%1" is not writable', [$path])); + throw new FileSystemException(new \Magento\Framework\Phrase('The path "%1" is not writable.', [$path])); } } @@ -68,7 +69,7 @@ protected function assertIsFile($path) $absolutePath = $this->driver->getAbsolutePath($this->path, $path); if (!$this->driver->isFile($absolutePath)) { throw new FileSystemException( - new \Magento\Framework\Phrase('The file "%1" doesn\'t exist or not a file', [$absolutePath]) + new \Magento\Framework\Phrase('The "%1" file doesn\'t exist.', [$absolutePath]) ); } } diff --git a/lib/internal/Magento/Framework/Filesystem/Driver/File.php b/lib/internal/Magento/Framework/Filesystem/Driver/File.php index 519ca21deadb2..181fc1adb1558 100644 --- a/lib/internal/Magento/Framework/Filesystem/Driver/File.php +++ b/lib/internal/Magento/Framework/Filesystem/Driver/File.php @@ -5,6 +5,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Filesystem\Driver; use Magento\Framework\Exception\FileSystemException; @@ -50,7 +51,7 @@ public function isExists($path) $result = @file_exists($this->getScheme() . $path); if ($result === null) { throw new FileSystemException( - new \Magento\Framework\Phrase('Error occurred during execution %1', [$this->getWarningMessage()]) + new \Magento\Framework\Phrase('An error occurred during "%1" execution.', [$this->getWarningMessage()]) ); } return $result; @@ -88,7 +89,7 @@ public function isReadable($path) $result = @is_readable($this->getScheme() . $path); if ($result === null) { throw new FileSystemException( - new \Magento\Framework\Phrase('Error occurred during execution %1', [$this->getWarningMessage()]) + new \Magento\Framework\Phrase('An error occurred during "%1" execution.', [$this->getWarningMessage()]) ); } return $result; @@ -107,7 +108,7 @@ public function isFile($path) $result = @is_file($this->getScheme() . $path); if ($result === null) { throw new FileSystemException( - new \Magento\Framework\Phrase('Error occurred during execution %1', [$this->getWarningMessage()]) + new \Magento\Framework\Phrase('An error occurred during "%1" execution.', [$this->getWarningMessage()]) ); } return $result; @@ -126,7 +127,7 @@ public function isDirectory($path) $result = @is_dir($this->getScheme() . $path); if ($result === null) { throw new FileSystemException( - new \Magento\Framework\Phrase('Error occurred during execution %1', [$this->getWarningMessage()]) + new \Magento\Framework\Phrase('An error occurred during "%1" execution.', [$this->getWarningMessage()]) ); } return $result; @@ -148,7 +149,7 @@ public function fileGetContents($path, $flag = null, $context = null) if (false === $result) { throw new FileSystemException( new \Magento\Framework\Phrase( - 'Cannot read contents from file "%1" %2', + 'The contents from the "%1" file can\'t be read. %2', [$path, $this->getWarningMessage()] ) ); @@ -169,7 +170,7 @@ public function isWritable($path) $result = @is_writable($this->getScheme() . $path); if ($result === null) { throw new FileSystemException( - new \Magento\Framework\Phrase('Error occurred during execution %1', [$this->getWarningMessage()]) + new \Magento\Framework\Phrase('An error occurred during "%1" execution.', [$this->getWarningMessage()]) ); } return $result; @@ -356,7 +357,7 @@ public function symlink($source, $destination, DriverInterface $targetDriver = n if (!$result) { throw new FileSystemException( new \Magento\Framework\Phrase( - 'Cannot create a symlink for "%1" and place it to "%2" %3', + 'A symlink for "%1" can\'t be created and placed to "%2". %3', [ $source, $destination, @@ -380,7 +381,10 @@ public function deleteFile($path) $result = @unlink($this->getScheme() . $path); if (!$result) { throw new FileSystemException( - new \Magento\Framework\Phrase('The file "%1" cannot be deleted %2', [$path, $this->getWarningMessage()]) + new \Magento\Framework\Phrase( + 'The "%1" file can\'t be deleted. %2', + [$path, $this->getWarningMessage()] + ) ); } return $result; @@ -431,7 +435,7 @@ public function changePermissions($path, $permissions) if (!$result) { throw new FileSystemException( new \Magento\Framework\Phrase( - 'Cannot change permissions for path "%1" %2', + 'The permissions can\'t be changed for the "%1" path. %2.', [$path, $this->getWarningMessage()] ) ); @@ -459,7 +463,7 @@ public function changePermissionsRecursively($path, $dirPermissions, $filePermis if (!$result) { throw new FileSystemException( new \Magento\Framework\Phrase( - 'Cannot change permissions for path "%1" %2', + 'The permissions can\'t be changed for the "%1" path. %2.', [$path, $this->getWarningMessage()] ) ); @@ -481,7 +485,7 @@ public function changePermissionsRecursively($path, $dirPermissions, $filePermis if (!$result) { throw new FileSystemException( new \Magento\Framework\Phrase( - 'Cannot change permissions for path "%1" %2', + 'The permissions can\'t be changed for the "%1" path. %2.', [$path, $this->getWarningMessage()] ) ); @@ -508,7 +512,7 @@ public function touch($path, $modificationTime = null) if (!$result) { throw new FileSystemException( new \Magento\Framework\Phrase( - 'The file or directory "%1" cannot be touched %2', + 'The "%1" file or directory can\'t be touched. %2', [$path, $this->getWarningMessage()] ) ); @@ -531,7 +535,7 @@ public function filePutContents($path, $content, $mode = null) if (!$result) { throw new FileSystemException( new \Magento\Framework\Phrase( - 'The specified "%1" file could not be written %2', + 'The specified "%1" file couldn\'t be written. %2', [$path, $this->getWarningMessage()] ) ); @@ -613,7 +617,10 @@ public function fileGetCsv($resource, $length = 0, $delimiter = ',', $enclosure $result = @fgetcsv($resource, $length, $delimiter, $enclosure, $escape); if ($result === null) { throw new FileSystemException( - new \Magento\Framework\Phrase('Wrong CSV handle %1', [$this->getWarningMessage()]) + new \Magento\Framework\Phrase( + 'The "%1" CSV handle is incorrect. Verify the handle and try again.', + [$this->getWarningMessage()] + ) ); } return $result; @@ -631,7 +638,7 @@ public function fileTell($resource) $result = @ftell($resource); if ($result === null) { throw new FileSystemException( - new \Magento\Framework\Phrase('Error occurred during execution %1', [$this->getWarningMessage()]) + new \Magento\Framework\Phrase('An error occurred during "%1" execution.', [$this->getWarningMessage()]) ); } return $result; @@ -652,7 +659,7 @@ public function fileSeek($resource, $offset, $whence = SEEK_SET) if ($result === -1) { throw new FileSystemException( new \Magento\Framework\Phrase( - 'Error occurred during execution of fileSeek %1', + 'An error occurred during "%1" fileSeek execution.', [$this->getWarningMessage()] ) ); @@ -684,7 +691,7 @@ public function fileClose($resource) if (!$result) { throw new FileSystemException( new \Magento\Framework\Phrase( - 'Error occurred during execution of fileClose %1', + 'An error occurred during "%1" fileClose execution.', [$this->getWarningMessage()] ) ); @@ -710,7 +717,7 @@ public function fileWrite($resource, $data) } if (false === $fwrite) { $this->fileSystemException( - 'Error occurred during execution of fileWrite %1', + 'An error occurred during "%1" fileWrite execution.', [$this->getWarningMessage()] ); } @@ -763,7 +770,7 @@ public function filePutCsv($resource, array $data, $delimiter = ',', $enclosure if (!$result) { throw new FileSystemException( new \Magento\Framework\Phrase( - 'Error occurred during execution of filePutCsv %1', + 'An error occurred during "%1" filePutCsv execution.', [$this->getWarningMessage()] ) ); @@ -784,7 +791,7 @@ public function fileFlush($resource) if (!$result) { throw new FileSystemException( new \Magento\Framework\Phrase( - 'Error occurred during execution of fileFlush %1', + 'An error occurred during "%1" fileFlush execution.', [$this->getWarningMessage()] ) ); @@ -806,7 +813,7 @@ public function fileLock($resource, $lockMode = LOCK_EX) if (!$result) { throw new FileSystemException( new \Magento\Framework\Phrase( - 'Error occurred during execution of fileLock %1', + 'An error occurred during "%1" fileLock execution.', [$this->getWarningMessage()] ) ); @@ -827,7 +834,7 @@ public function fileUnlock($resource) if (!$result) { throw new FileSystemException( new \Magento\Framework\Phrase( - 'Error occurred during execution of fileUnlock %1', + 'An error occurred during "%1" fileUnlock execution.', [$this->getWarningMessage()] ) ); diff --git a/lib/internal/Magento/Framework/Filesystem/Driver/Http.php b/lib/internal/Magento/Framework/Filesystem/Driver/Http.php index 09d5372291a0a..236585fa61384 100644 --- a/lib/internal/Magento/Framework/Filesystem/Driver/Http.php +++ b/lib/internal/Magento/Framework/Filesystem/Driver/Http.php @@ -5,6 +5,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Filesystem\Driver; use Magento\Framework\Exception\FileSystemException; @@ -91,7 +92,7 @@ public function fileGetContents($path, $flags = null, $context = null) if (false === $result) { throw new FileSystemException( new \Magento\Framework\Phrase( - 'Cannot read contents from file "%1" %2', + 'The contents from the "%1" file can\'t be read. %2', [$path, $this->getWarningMessage()] ) ); @@ -115,7 +116,7 @@ public function filePutContents($path, $content, $mode = null, $context = null) if (!$result) { throw new FileSystemException( new \Magento\Framework\Phrase( - 'The specified "%1" file could not be written %2', + 'The specified "%1" file couldn\'t be written. %2', [$path, $this->getWarningMessage()] ) ); @@ -137,7 +138,9 @@ public function fileOpen($path, $mode) $urlProp = $this->parseUrl($this->getScheme() . $path); if (false === $urlProp) { - throw new FileSystemException(new \Magento\Framework\Phrase('Please correct the download URL.')); + throw new FileSystemException( + new \Magento\Framework\Phrase('The download URL is incorrect. Verify and try again.') + ); } $hostname = $urlProp['host']; diff --git a/lib/internal/Magento/Framework/Filesystem/File/Read.php b/lib/internal/Magento/Framework/Filesystem/File/Read.php index e475bea31c380..f48e50b7d693d 100644 --- a/lib/internal/Magento/Framework/Filesystem/File/Read.php +++ b/lib/internal/Magento/Framework/Filesystem/File/Read.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Filesystem\File; use Magento\Framework\Filesystem\DriverInterface; @@ -72,7 +73,9 @@ protected function open() protected function assertValid() { if (!$this->driver->isExists($this->path)) { - throw new FileSystemException(new \Magento\Framework\Phrase('The file "%1" doesn\'t exist', [$this->path])); + throw new FileSystemException( + new \Magento\Framework\Phrase('The "%1" file doesn\'t exist.', [$this->path]) + ); } return true; } diff --git a/lib/internal/Magento/Framework/Filesystem/File/Write.php b/lib/internal/Magento/Framework/Filesystem/File/Write.php index 03f8b38a6e930..ea2f3a93d66c0 100644 --- a/lib/internal/Magento/Framework/Filesystem/File/Write.php +++ b/lib/internal/Magento/Framework/Filesystem/File/Write.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Filesystem\File; use Magento\Framework\Filesystem\DriverInterface; @@ -33,7 +34,9 @@ protected function assertValid() { $fileExists = $this->driver->isExists($this->path); if (!$fileExists && preg_match('/r/', $this->mode)) { - throw new FileSystemException(new \Magento\Framework\Phrase('The file "%1" doesn\'t exist', [$this->path])); + throw new FileSystemException( + new \Magento\Framework\Phrase('The "%1" file doesn\'t exist.', [$this->path]) + ); } elseif ($fileExists && preg_match('/x/', $this->mode)) { throw new FileSystemException(new \Magento\Framework\Phrase('The file "%1" already exists', [$this->path])); } diff --git a/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php b/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php index 2a1938df4d687..1aa9d61f8865a 100644 --- a/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php +++ b/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Filesystem\Io; use Magento\Framework\Filesystem\DriverInterface; @@ -78,7 +79,7 @@ public function open(array $args = []) { if (empty($args['host'])) { $this->_error = self::ERROR_EMPTY_HOST; - throw new LocalizedException(new Phrase('Empty host specified')); + throw new LocalizedException(new Phrase('The specified host is empty. Set the host and try again.')); } if (empty($args['port'])) { @@ -111,20 +112,22 @@ public function open(array $args = []) } if (!$this->_conn) { $this->_error = self::ERROR_INVALID_CONNECTION; - throw new LocalizedException(new Phrase('Could not establish FTP connection, invalid host or port')); + throw new LocalizedException( + new Phrase("The FTP connection couldn't be established because of an invalid host or port.") + ); } if (!@ftp_login($this->_conn, $this->_config['user'], $this->_config['password'])) { $this->_error = self::ERROR_INVALID_LOGIN; $this->close(); - throw new LocalizedException(new Phrase('Invalid user name or password')); + throw new LocalizedException(new Phrase('The username or password is invalid. Verify both and try again.')); } if (!empty($this->_config['path'])) { if (!@ftp_chdir($this->_conn, $this->_config['path'])) { $this->_error = self::ERROR_INVALID_PATH; $this->close(); - throw new LocalizedException(new Phrase('Invalid path')); + throw new LocalizedException(new Phrase('The path is invalid. Verify and try again.')); } } @@ -132,7 +135,7 @@ public function open(array $args = []) if (!@ftp_pasv($this->_conn, true)) { $this->_error = self::ERROR_INVALID_MODE; $this->close(); - throw new LocalizedException(new Phrase('Invalid file transfer mode')); + throw new LocalizedException(new Phrase('The file transfer mode is invalid. Verify and try again.')); } } diff --git a/lib/internal/Magento/Framework/Filesystem/Test/Unit/Driver/HttpTest.php b/lib/internal/Magento/Framework/Filesystem/Test/Unit/Driver/HttpTest.php index 51a994dc73ff5..f5ad5b22bdd58 100644 --- a/lib/internal/Magento/Framework/Filesystem/Test/Unit/Driver/HttpTest.php +++ b/lib/internal/Magento/Framework/Filesystem/Test/Unit/Driver/HttpTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Filesystem\Test\Unit\Driver; use \Magento\Framework\Filesystem\Driver\Http; @@ -130,7 +131,7 @@ public function testFilePutContentsFail() /** * @expectedException \Magento\Framework\Exception\FileSystemException - * @expectedExceptionMessage Please correct the download URL. + * @expectedExceptionMessage The download URL is incorrect. Verify and try again. */ public function testFileOpenInvalidUrl() { diff --git a/lib/internal/Magento/Framework/Model/Entity/RepositoryFactory.php b/lib/internal/Magento/Framework/Model/Entity/RepositoryFactory.php index 341ff9226555f..f439c14b6ece0 100644 --- a/lib/internal/Magento/Framework/Model/Entity/RepositoryFactory.php +++ b/lib/internal/Magento/Framework/Model/Entity/RepositoryFactory.php @@ -50,7 +50,8 @@ public function __construct( public function create($entityType) { if (!isset($this->entities[$entityType])) { - $message = sprintf('Repository for entity type %s is not declared', $entityType); + $message = + sprintf('The repository for the "%s" entity type isn\'t declared. Verify and try again.', $entityType); throw new NotFoundException(new \Magento\Framework\Phrase($message)); } return $this->objectManager->get($this->entities[$entityType]); diff --git a/lib/internal/Magento/Framework/Model/Entity/ScopeResolver.php b/lib/internal/Magento/Framework/Model/Entity/ScopeResolver.php index ff7e359447cd8..f965fe65d3cda 100644 --- a/lib/internal/Magento/Framework/Model/Entity/ScopeResolver.php +++ b/lib/internal/Magento/Framework/Model/Entity/ScopeResolver.php @@ -53,7 +53,13 @@ public function getEntityContext($entityType, $entityData = []) foreach ($metadata->getEntityContext() as $contextProviderClass) { $contextProvider = $this->objectManager->get($contextProviderClass); if (!$contextProvider instanceof ScopeProviderInterface) { - throw new ConfigurationMismatchException(new Phrase('Wrong configuration for type %1', [$entityType])); + throw new ConfigurationMismatchException( + new Phrase( + 'The configuration for the "%1" type is incorrect. ' + . 'Verify the type and configuration and try again.', + [$entityType] + ) + ); } $entityContext[] = $contextProvider->getContext($entityType, $entityData); } diff --git a/lib/internal/Magento/Framework/Model/ResourceModel/Iterator.php b/lib/internal/Magento/Framework/Model/ResourceModel/Iterator.php index a61835133b39f..694c230657965 100644 --- a/lib/internal/Magento/Framework/Model/ResourceModel/Iterator.php +++ b/lib/internal/Magento/Framework/Model/ResourceModel/Iterator.php @@ -62,11 +62,13 @@ protected function _getStatement($query, AdapterInterface $connection = null) if (is_string($query)) { if (!$connection instanceof AdapterInterface) { - throw new LocalizedException(new Phrase('Invalid connection')); + throw new LocalizedException( + new Phrase('The connection is invalid. Verify the connection and try again.') + ); } return $connection->query($query); } - throw new LocalizedException(new Phrase('Invalid query')); + throw new LocalizedException(new Phrase('The query is invalid. Verify the query and try again.')); } } diff --git a/lib/internal/Magento/Framework/Mview/Test/Unit/View/ChangelogTest.php b/lib/internal/Magento/Framework/Mview/Test/Unit/View/ChangelogTest.php index e278de0fff914..1bcf48d8b0a5e 100644 --- a/lib/internal/Magento/Framework/Mview/Test/Unit/View/ChangelogTest.php +++ b/lib/internal/Magento/Framework/Mview/Test/Unit/View/ChangelogTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Mview\Test\Unit\View; class ChangelogTest extends \PHPUnit\Framework\TestCase @@ -45,7 +46,7 @@ public function testInstanceOf() /** * @expectedException \Exception - * @expectedExceptionMessage Write DB connection is not available + * @expectedExceptionMessage The write connection to the database isn't available. Please try again later. */ public function testCheckConnectionException() { diff --git a/lib/internal/Magento/Framework/Mview/View/Changelog.php b/lib/internal/Magento/Framework/Mview/View/Changelog.php index 91caf66228360..cdb36a67a1cc4 100644 --- a/lib/internal/Magento/Framework/Mview/View/Changelog.php +++ b/lib/internal/Magento/Framework/Mview/View/Changelog.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Mview\View; use Magento\Framework\App\ResourceConnection; @@ -58,7 +59,7 @@ public function __construct(\Magento\Framework\App\ResourceConnection $resource) protected function checkConnection() { if (!$this->connection) { - throw new \Exception('Write DB connection is not available'); + throw new \Exception("The write connection to the database isn't available. Please try again later."); } } diff --git a/lib/internal/Magento/Framework/Oauth/Oauth.php b/lib/internal/Magento/Framework/Oauth/Oauth.php index 247b0d4a53009..5e48fb5ed30f9 100644 --- a/lib/internal/Magento/Framework/Oauth/Oauth.php +++ b/lib/internal/Magento/Framework/Oauth/Oauth.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Oauth; use Magento\Framework\Encryption\Helper\Security; @@ -198,7 +199,7 @@ protected function _validateSignature($params, $consumerSecret, $httpMethod, $re ); if (!Security::compareStrings($calculatedSign, $params['oauth_signature'])) { - throw new Exception(new Phrase('Invalid signature')); + throw new Exception(new Phrase('The signatire is invalid. Verify and try again.')); } } @@ -213,7 +214,7 @@ protected function _validateVersionParam($version) { // validate version if specified if ('1.0' != $version) { - throw new OauthInputException(new Phrase('OAuth version %1 is not supported', [$version])); + throw new OauthInputException(new Phrase('The "%1" Oauth version isn\'t supported.', [$version])); } } @@ -250,7 +251,7 @@ protected function _validateProtocolParams($protocolParams, $requiredParams = [] $protocolParams['oauth_token'] ) ) { - throw new OauthInputException(new Phrase('Token is not the correct length')); + throw new OauthInputException(new Phrase('The token length is invalid. Check the length and try again.')); } // Validate signature method. @@ -284,7 +285,9 @@ protected function _checkRequiredParams($protocolParams, $requiredParams) $exception = new OauthInputException(); foreach ($requiredParams as $param) { if (!isset($protocolParams[$param])) { - $exception->addError(new Phrase('%fieldName is a required field.', ['fieldName' => $param])); + $exception->addError( + new Phrase('"%fieldName" is required. Enter and try again.', ['fieldName' => $param]) + ); } } if ($exception->wasErrorAdded()) { diff --git a/lib/internal/Magento/Framework/Oauth/Test/Unit/OauthInputExceptionTest.php b/lib/internal/Magento/Framework/Oauth/Test/Unit/OauthInputExceptionTest.php index 72bf2fe7a6129..f67fd37c49662 100644 --- a/lib/internal/Magento/Framework/Oauth/Test/Unit/OauthInputExceptionTest.php +++ b/lib/internal/Magento/Framework/Oauth/Test/Unit/OauthInputExceptionTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Oauth\Test\Unit; use \Magento\Framework\Oauth\OauthInputException; @@ -17,12 +18,14 @@ public function testGetAggregatedErrorMessage() { $exception = new OauthInputException(); foreach (['field1', 'field2'] as $param) { - $exception->addError(new Phrase('%fieldName is a required field.', ['fieldName' => $param])); + $exception->addError( + new Phrase('"%fieldName" is required. Enter and try again.', ['fieldName' => $param]) + ); } $exception->addError(new Phrase('Message with period.')); $this->assertEquals( - 'field1 is a required field, field2 is a required field, Message with period', + '"field1" is required. Enter and try again, "field2" is required. Enter and try again, Message with period', $exception->getAggregatedErrorMessage() ); } diff --git a/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Repository.php b/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Repository.php index b1cdb53288216..362cbb2e887c7 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Repository.php +++ b/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Repository.php @@ -226,14 +226,18 @@ protected function _getGetMethod() /** @var ParameterReflection $parameterReflection */ $parameterReflection = $methodReflection->getParameters()[0]; $body = "if (!\$id) {\n" - . " throw new \\" . InputException::class . "(new \\Magento\\Framework\\Phrase('ID required'));\n" + . " throw new \\" . InputException::class . "(\n" + . " new \\Magento\\Framework\\Phrase('An ID is needed. Set the ID and try again.')\n" + . " );\n" . "}\n" . "if (!isset(\$this->registry[\$id])) {\n" . " \$entity = \$this->" . $this->_getSourcePersistorPropertyName() . "->loadEntity(\$id);\n" . " if (!\$entity->getId()) {\n" . " throw new \\" . NoSuchEntityException::class . "(\n" - . " new \\Magento\\Framework\\Phrase('Requested entity doesn\\'t exist')\n" + . " new \\Magento\\Framework\\Phrase(\n" + . " 'The entity that was requested doesn\'t exist. Verify the entity and try again.'\n" + . " )\n" . " );\n" . " }\n" . " \$this->registry[\$id] = \$entity;\n" diff --git a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Code/Generator/_files/SampleRepository.txt b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Code/Generator/_files/SampleRepository.txt index 222d5c7ffc6d1..5cc2e35598b89 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Code/Generator/_files/SampleRepository.txt +++ b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Code/Generator/_files/SampleRepository.txt @@ -71,13 +71,17 @@ class SampleRepository implements SampleRepositoryInterface public function get($id) { if (!$id) { - throw new \Magento\Framework\Exception\InputException(new \Magento\Framework\Phrase('ID required')); + throw new \Magento\Framework\Exception\InputException( + new \Magento\Framework\Phrase('An ID is needed. Set the ID and try again.') + ); } if (!isset($this->registry[$id])) { $entity = $this->sampleInterfacePersistor->loadEntity($id); if (!$entity->getId()) { throw new \Magento\Framework\Exception\NoSuchEntityException( - new \Magento\Framework\Phrase('Requested entity doesn\'t exist') + new \Magento\Framework\Phrase( + 'The entity that was requested doesn\'t exist. Verify the entity and try again.' + ) ); } $this->registry[$id] = $entity; diff --git a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Code/Generator/_files/TSampleRepository.txt b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Code/Generator/_files/TSampleRepository.txt index e4067e70670a4..bb2da3499c14d 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Code/Generator/_files/TSampleRepository.txt +++ b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Code/Generator/_files/TSampleRepository.txt @@ -71,13 +71,17 @@ class TSampleRepository implements TSampleRepositoryInterface public function get(int $id) : \Magento\Framework\ObjectManager\Code\Generator\TSampleInterface { if (!$id) { - throw new \Magento\Framework\Exception\InputException(new \Magento\Framework\Phrase('ID required')); + throw new \Magento\Framework\Exception\InputException( + new \Magento\Framework\Phrase('An ID is needed. Set the ID and try again.') + ); } if (!isset($this->registry[$id])) { $entity = $this->tSampleInterfacePersistor->loadEntity($id); if (!$entity->getId()) { throw new \Magento\Framework\Exception\NoSuchEntityException( - new \Magento\Framework\Phrase('Requested entity doesn\'t exist') + new \Magento\Framework\Phrase( + 'The entity that was requested doesn\'t exist. Verify the entity and try again.' + ) ); } $this->registry[$id] = $entity; diff --git a/lib/internal/Magento/Framework/Reflection/AttributeTypeResolver.php b/lib/internal/Magento/Framework/Reflection/AttributeTypeResolver.php index f851dbcbc87f2..8af8088ccdb65 100644 --- a/lib/internal/Magento/Framework/Reflection/AttributeTypeResolver.php +++ b/lib/internal/Magento/Framework/Reflection/AttributeTypeResolver.php @@ -48,7 +48,10 @@ public function resolveObjectType($attributeCode, $value, $context) $output = $this->typeProcessor->getArrayItemType($type); if (!(class_exists($output) || interface_exists($output))) { throw new \LogicException( - sprintf('Class "%s" does not exist. Please note that namespace must be specified.', $type) + sprintf( + 'The "%s" class doesn\'t exist and the namespace must be specified. Verify and try again.', + $type + ) ); } } diff --git a/lib/internal/Magento/Framework/Reflection/Test/Unit/AttributeTypeResolverTest.php b/lib/internal/Magento/Framework/Reflection/Test/Unit/AttributeTypeResolverTest.php index f1e1368cafd0b..1f6fa25a51f22 100644 --- a/lib/internal/Magento/Framework/Reflection/Test/Unit/AttributeTypeResolverTest.php +++ b/lib/internal/Magento/Framework/Reflection/Test/Unit/AttributeTypeResolverTest.php @@ -84,7 +84,6 @@ public function testResolveObjectTypeWithConfiguredAttribute() /** * @expectedException \LogicException - * @expectedExceptionMessage Class "\Some\Class" does not exist. Please note that namespace must be specified. */ public function testResolveObjectTypeWithConfiguredAttributeAndNonExistedClass() { @@ -106,5 +105,9 @@ public function testResolveObjectTypeWithConfiguredAttributeAndNonExistedClass() $this->configMock->expects($this->once())->method('get')->willReturn($config); $this->model->resolveObjectType($code, $value, $context); + + $this->expectExceptionMessage( + 'The "\Some\Class" class doesn\'t exist and the namespace must be specified. Verify and try again.' + ); } } diff --git a/lib/internal/Magento/Framework/Reflection/Test/Unit/TypeProcessorTest.php b/lib/internal/Magento/Framework/Reflection/Test/Unit/TypeProcessorTest.php index 9ee4d148d2fb5..4b5cd49dc2fe4 100644 --- a/lib/internal/Magento/Framework/Reflection/Test/Unit/TypeProcessorTest.php +++ b/lib/internal/Magento/Framework/Reflection/Test/Unit/TypeProcessorTest.php @@ -55,7 +55,7 @@ public function testSetTypesData() /** * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Data type "NonExistentType" is not declared. + * @expectedExceptionMessage The "NonExistentType" data type isn't declared. Verify the type and try again. */ public function testGetTypeDataInvalidArgumentException() { @@ -160,7 +160,7 @@ public function testTranslateTypeName() /** * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid parameter type "\Magento\TestModule3\V1\Parameter[]". + * @expectedExceptionMessage The "\Magento\TestModule3\V1\Parameter[]" parameter type is invalid. Verify the parameter and try again. */ public function testTranslateTypeNameInvalidArgumentException() { @@ -213,7 +213,9 @@ public function testProcessSimpleTypeStringArrayToIntArray() public function testProcessSimpleTypeException($value, $type) { $this->expectException( - SerializationException::class, 'Invalid type for value: "' . $value . '". Expected Type: "' . $type . '"' + SerializationException::class, + 'The "' + . $value . '" value\'s type is invalid. The "' . $type . '" type was expected. Verify and try again.' ); $this->_typeProcessor->processSimpleAndAnyType($value, $type); } @@ -228,7 +230,7 @@ public static function processSimpleTypeExceptionProvider() /** * @expectedException \Magento\Framework\Exception\SerializationException - * @expectedExceptionMessage Invalid type for value: "integer". Expected Type: "int[]". + * @expectedExceptionMessage The "integer" value's type is invalid. The "int[]" type was expected. Verify and try again. */ public function testProcessSimpleTypeInvalidType() { diff --git a/lib/internal/Magento/Framework/Reflection/TypeProcessor.php b/lib/internal/Magento/Framework/Reflection/TypeProcessor.php index 74c1bc95b208b..80285853b43c6 100644 --- a/lib/internal/Magento/Framework/Reflection/TypeProcessor.php +++ b/lib/internal/Magento/Framework/Reflection/TypeProcessor.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Reflection; use Magento\Framework\Exception\SerializationException; @@ -99,7 +100,9 @@ public function setTypesData($typesData) public function getTypeData($typeName) { if (!isset($this->_types[$typeName])) { - throw new \InvalidArgumentException(sprintf('Data type "%s" is not declared.', $typeName)); + throw new \InvalidArgumentException( + sprintf('The "%s" data type isn\'t declared. Verify the type and try again.', $typeName) + ); } return $this->_types[$typeName]; } @@ -137,7 +140,10 @@ public function register($type) $typeSimple = $this->getArrayItemType($type); if (!(class_exists($typeSimple) || interface_exists($typeSimple))) { throw new \LogicException( - sprintf('Class "%s" does not exist. Please note that namespace must be specified.', $type) + sprintf( + 'The "%s" class doesn\'t exist and the namespace must be specified. Verify and try again.', + $type + ) ); } $complexTypeName = $this->translateTypeName($type); @@ -167,7 +173,7 @@ protected function _processComplexType($class) } else { if (!(class_exists($class) || interface_exists($class))) { throw new \InvalidArgumentException( - sprintf('Could not load the "%s" class as parameter type.', $class) + sprintf('The "%s" class couldn\'t load as a parameter type.', $class) ); } $reflection = new ClassReflection($class); @@ -425,7 +431,9 @@ public function translateTypeName($class) return ucfirst($moduleNamespace . $moduleName . implode('', $typeNameParts)); } - throw new \InvalidArgumentException(sprintf('Invalid parameter type "%s".', $class)); + throw new \InvalidArgumentException( + sprintf('The "%s" parameter type is invalid. Verify the parameter and try again.', $class) + ); } /** @@ -464,7 +472,8 @@ public function processSimpleAndAnyType($value, $type) if ($value !== null && !settype($value[$key], $arrayItemType)) { throw new SerializationException( new Phrase( - 'Invalid type for value: "%value". Expected Type: "%type".', + 'The "%value" value\'s type is invalid. The "%type" type was expected. ' + . 'Verify and try again.', ['value' => $value, 'type' => $type] ) ); @@ -476,7 +485,7 @@ public function processSimpleAndAnyType($value, $type) if ($value !== null && !$this->isTypeAny($type) && !$this->setType($value, $type)) { throw new SerializationException( new Phrase( - 'Invalid type for value: "%value". Expected Type: "%type".', + 'The "%value" value\'s type is invalid. The "%type" type was expected. Verify and try again.', ['value' => (string)$value, 'type' => $type] ) ); @@ -484,7 +493,7 @@ public function processSimpleAndAnyType($value, $type) } elseif (!$this->isTypeAny($type)) { throw new SerializationException( new Phrase( - 'Invalid type for value: "%value". Expected Type: "%type".', + 'The "%value" value\'s type is invalid. The "%type" type was expected. Verify and try again.', ['value' => gettype($value), 'type' => $type] ) ); diff --git a/lib/internal/Magento/Framework/Search/Dynamic/Algorithm/Repository.php b/lib/internal/Magento/Framework/Search/Dynamic/Algorithm/Repository.php index 3a964db113ef0..c2d7e4025b3b3 100644 --- a/lib/internal/Magento/Framework/Search/Dynamic/Algorithm/Repository.php +++ b/lib/internal/Magento/Framework/Search/Dynamic/Algorithm/Repository.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Search\Dynamic\Algorithm; use Magento\Framework\Exception\LocalizedException; @@ -53,7 +54,7 @@ public function get($algorithmType, array $data = []) if (!isset($this->instances[$algorithmType])) { if (!isset($this->algorithms[$algorithmType])) { throw new LocalizedException( - new \Magento\Framework\Phrase('%1 was not found in algorithms', [$algorithmType]) + new \Magento\Framework\Phrase("The %1 value wasn't found in the algorithms.", [$algorithmType]) ); } diff --git a/lib/internal/Magento/Framework/Search/Request/Cleaner.php b/lib/internal/Magento/Framework/Search/Request/Cleaner.php index 984065d1e2a2c..c015f90751a23 100644 --- a/lib/internal/Magento/Framework/Search/Request/Cleaner.php +++ b/lib/internal/Magento/Framework/Search/Request/Cleaner.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Search\Request; use Magento\Framework\Exception\StateException; @@ -60,7 +61,9 @@ public function clean(array $requestData) $this->clear(); if (empty($requestData['queries']) && empty($requestData['filters'])) { - throw new EmptyRequestDataException(new Phrase('Request query and filters are not set')); + throw new EmptyRequestDataException( + new Phrase("The request query and filters aren't set. Verify the query and filters and try again.") + ); } return $requestData; @@ -82,7 +85,7 @@ private function cleanQuery($queryName) throw new \Exception('Query ' . $queryName . ' does not exist'); } elseif (in_array($queryName, $this->mappedQueries)) { throw new StateException( - new Phrase('Cycle found. Query %1 already used in request hierarchy', [$queryName]) + new Phrase('A cycle was found. The "%1" query is already used in the request hierarchy.', [$queryName]) ); } $this->mappedQueries[] = $queryName; @@ -163,7 +166,10 @@ private function cleanFilter($filterName) throw new \Exception('Filter ' . $filterName . ' does not exist'); } elseif (in_array($filterName, $this->mappedFilters)) { throw new StateException( - new Phrase('Cycle found. Filter %1 already used in request hierarchy', [$filterName]) + new Phrase( + 'A cycle was found. The "%1" filter is already used in the request hierarchy.', + [$filterName] + ) ); } $this->mappedFilters[] = $filterName; diff --git a/lib/internal/Magento/Framework/Search/Request/Mapper.php b/lib/internal/Magento/Framework/Search/Request/Mapper.php index 797d38ac7d39b..7586444d4b197 100644 --- a/lib/internal/Magento/Framework/Search/Request/Mapper.php +++ b/lib/internal/Magento/Framework/Search/Request/Mapper.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Search\Request; use Magento\Framework\Exception\StateException; @@ -114,7 +115,7 @@ private function mapQuery($queryName) throw new \Exception('Query ' . $queryName . ' does not exist'); } elseif (in_array($queryName, $this->mappedQueries)) { throw new StateException( - new Phrase('Cycle found. Query %1 already used in request hierarchy', [$queryName]) + new Phrase('A cycle was found. The "%1" query is already used in the request hierarchy.', [$queryName]) ); } $this->mappedQueries[] = $queryName; @@ -183,7 +184,10 @@ private function mapFilter($filterName) throw new \Exception('Filter ' . $filterName . ' does not exist'); } elseif (in_array($filterName, $this->mappedFilters)) { throw new StateException( - new Phrase('Cycle found. Filter %1 already used in request hierarchy', [$filterName]) + new Phrase( + 'A cycle was found. The "%1" filter is already used in the request hierarchy.', + [$filterName] + ) ); } $this->mappedFilters[] = $filterName; @@ -351,7 +355,7 @@ public function getBuckets() ); break; default: - throw new StateException(new Phrase('Invalid bucket type')); + throw new StateException(new Phrase('The bucket type is invalid. Verify and try again.')); break; } $buckets[] = $bucket; diff --git a/lib/internal/Magento/Framework/Search/Test/Unit/Request/CleanerTest.php b/lib/internal/Magento/Framework/Search/Test/Unit/Request/CleanerTest.php index 42667b4e171c0..6902dfc70d2c6 100644 --- a/lib/internal/Magento/Framework/Search/Test/Unit/Request/CleanerTest.php +++ b/lib/internal/Magento/Framework/Search/Test/Unit/Request/CleanerTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Search\Test\Unit\Request; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; @@ -259,7 +260,7 @@ public function testCleanFilterType() /** * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Cycle found. Query filtered_query already used in request hierarchy + * @expectedExceptionMessage A cycle was found. The "filtered_query" query is already used in the request hierarchy. */ public function testCleanQueryCycle() { @@ -338,7 +339,7 @@ public function testCleanQueryNotExists() /** * @expectedException \Magento\Framework\Search\Request\EmptyRequestDataException - * @expectedExceptionMessage Request query and filters are not set + * @expectedExceptionMessage The request query and filters aren't set. Verify the query and filters and try again. */ public function testCleanEmptyQueryAndFilter() { diff --git a/lib/internal/Magento/Framework/Session/SaveHandler/DbTable.php b/lib/internal/Magento/Framework/Session/SaveHandler/DbTable.php index 67ae707860640..6f5937e08455d 100644 --- a/lib/internal/Magento/Framework/Session/SaveHandler/DbTable.php +++ b/lib/internal/Magento/Framework/Session/SaveHandler/DbTable.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Session\SaveHandler; use Magento\Framework\App\ResourceConnection; @@ -49,10 +50,14 @@ public function __construct(\Magento\Framework\App\ResourceConnection $resource) protected function checkConnection() { if (!$this->connection) { - throw new SessionException(new Phrase('Write DB connection is not available')); + throw new SessionException( + new Phrase("The write connection to the database isn't available. Please try again later.") + ); } if (!$this->connection->isTableExists($this->_sessionTable)) { - throw new SessionException(new Phrase('DB storage table does not exist')); + throw new SessionException( + new Phrase("The database storage table doesn't exist. Verify the table and try again.") + ); } } diff --git a/lib/internal/Magento/Framework/Session/Test/Unit/SaveHandler/DbTableTest.php b/lib/internal/Magento/Framework/Session/Test/Unit/SaveHandler/DbTableTest.php index 90b1ee2113472..659c8ab8e389a 100644 --- a/lib/internal/Magento/Framework/Session/Test/Unit/SaveHandler/DbTableTest.php +++ b/lib/internal/Magento/Framework/Session/Test/Unit/SaveHandler/DbTableTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Session\Test\Unit\SaveHandler; class DbTableTest extends \PHPUnit\Framework\TestCase @@ -88,7 +89,7 @@ public function testCheckConnection() /** * @expectedException \Magento\Framework\Exception\SessionException - * @expectedExceptionMessage Write DB connection is not available + * @expectedExceptionMessage The write connection to the database isn't available. Please try again later. */ public function testCheckConnectionNoConnection() { @@ -105,7 +106,7 @@ public function testCheckConnectionNoConnection() /** * @expectedException \Magento\Framework\Exception\SessionException - * @expectedExceptionMessage DB storage table does not exist + * @expectedExceptionMessage The database storage table doesn't exist. Verify the table and try again. */ public function testCheckConnectionNoTable() { diff --git a/lib/internal/Magento/Framework/Session/Validator.php b/lib/internal/Magento/Framework/Session/Validator.php index 65d3150cdbb59..a132d8644a3c6 100644 --- a/lib/internal/Magento/Framework/Session/Validator.php +++ b/lib/internal/Magento/Framework/Session/Validator.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Session; use Magento\Framework\Exception\SessionException; @@ -110,7 +111,7 @@ protected function _validate() ) { throw new SessionException( new Phrase( - 'Invalid session %1 value.', + 'The "%1" session value is invalid. Verify and try again.', [self::VALIDATOR_REMOTE_ADDR_KEY] ) ); @@ -122,7 +123,7 @@ protected function _validate() ) { throw new SessionException( new Phrase( - 'Invalid session %1 value.', + 'The "%1" session value is invalid. Verify and try again.', [self::VALIDATOR_HTTP_VIA_KEY] ) ); @@ -137,7 +138,7 @@ protected function _validate() ) { throw new SessionException( new Phrase( - 'Invalid session %1 value.', + 'The "%1" session value is invalid. Verify and try again.', [self::VALIDATOR_HTTP_X_FORWARDED_FOR_KEY] ) ); @@ -154,7 +155,7 @@ protected function _validate() } throw new SessionException( new Phrase( - 'Invalid session %1 value.', + 'The "%1" session value is invalid. Verify and try again.', [self::VALIDATOR_HTTP_USER_AGENT_KEY] ) ); diff --git a/lib/internal/Magento/Framework/Setup/BackupRollback.php b/lib/internal/Magento/Framework/Setup/BackupRollback.php index 53e347ae01de7..6736875368d57 100644 --- a/lib/internal/Magento/Framework/Setup/BackupRollback.php +++ b/lib/internal/Magento/Framework/Setup/BackupRollback.php @@ -147,10 +147,10 @@ public function codeBackup($time, $type = Factory::TYPE_FILESYSTEM) public function codeRollback($rollbackFile, $type = Factory::TYPE_FILESYSTEM, $keepSourceFile = false) { if (preg_match('/[0-9]_(filesystem)_(code|media)\.(tgz)$/', $rollbackFile) !== 1) { - throw new LocalizedException(new Phrase('Invalid rollback file.')); + throw new LocalizedException(new Phrase('The rollback file is invalid. Verify the file and try again.')); } if (!$this->file->isExists($this->backupsDir . '/' . $rollbackFile)) { - throw new LocalizedException(new Phrase('The rollback file does not exist.')); + throw new LocalizedException(new Phrase("The rollback file doesn't exist. Verify the file and try again.")); } /** @var \Magento\Framework\Backup\Filesystem $fsRollback */ $fsRollback = $this->objectManager->create(\Magento\Framework\Backup\Filesystem::class); @@ -172,7 +172,7 @@ public function codeRollback($rollbackFile, $type = Factory::TYPE_FILESYSTEM, $k ); if (!$filesInfo['writable']) { throw new NotEnoughPermissions( - new Phrase('Unable to make rollback because not all files are writable') + new Phrase("The rollback can't be executed because not all files are writable.") ); } $fsRollback->setRootDir($this->directoryList->getRoot()); @@ -225,10 +225,10 @@ public function dbBackup($time) public function dbRollback($rollbackFile, $keepSourceFile = false) { if (preg_match('/[0-9]_(db)(.*?).(sql)$/', $rollbackFile) !== 1) { - throw new LocalizedException(new Phrase('Invalid rollback file.')); + throw new LocalizedException(new Phrase('The rollback file is invalid. Verify the file and try again.')); } if (!$this->file->isExists($this->backupsDir . '/' . $rollbackFile)) { - throw new LocalizedException(new Phrase('The rollback file does not exist.')); + throw new LocalizedException(new Phrase("The rollback file doesn't exist. Verify the file and try again.")); } /** @var \Magento\Framework\Backup\Db $dbRollback */ $dbRollback = $this->objectManager->create(\Magento\Framework\Backup\Db::class); diff --git a/lib/internal/Magento/Framework/Setup/Test/Unit/BackupRollbackTest.php b/lib/internal/Magento/Framework/Setup/Test/Unit/BackupRollbackTest.php index 5105b0dffdebf..abe05e45248bf 100644 --- a/lib/internal/Magento/Framework/Setup/Test/Unit/BackupRollbackTest.php +++ b/lib/internal/Magento/Framework/Setup/Test/Unit/BackupRollbackTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Setup\Test\Unit; use Magento\Framework\Backup\Factory; @@ -138,7 +139,7 @@ public function testCodeRollback() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage The rollback file does not exist. + * @expectedExceptionMessage The rollback file doesn't exist. Verify the file and try again. */ public function testCodeRollbackWithInvalidFilePath() { @@ -150,7 +151,7 @@ public function testCodeRollbackWithInvalidFilePath() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Invalid rollback file. + * @expectedExceptionMessage The rollback file is invalid. Verify the file and try again. */ public function testCodeRollbackWithInvalidFileType() { diff --git a/lib/internal/Magento/Framework/Shell.php b/lib/internal/Magento/Framework/Shell.php index 02b3f114d41f1..9a70bec54811f 100644 --- a/lib/internal/Magento/Framework/Shell.php +++ b/lib/internal/Magento/Framework/Shell.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework; use Magento\Framework\Shell\CommandRendererInterface; @@ -51,7 +52,7 @@ public function execute($command, array $arguments = []) $disabled = explode(',', str_replace(' ', ',', ini_get('disable_functions'))); if (in_array('exec', $disabled)) { - throw new Exception\LocalizedException(new \Magento\Framework\Phrase("exec function is disabled.")); + throw new Exception\LocalizedException(new \Magento\Framework\Phrase('The exec function is disabled.')); } exec($command, $output, $exitCode); diff --git a/lib/internal/Magento/Framework/Shell/Driver.php b/lib/internal/Magento/Framework/Shell/Driver.php index 8a2cd2e5bb57d..f905b5a441ba3 100644 --- a/lib/internal/Magento/Framework/Shell/Driver.php +++ b/lib/internal/Magento/Framework/Shell/Driver.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Shell; use Magento\Framework\Exception\LocalizedException; @@ -37,7 +38,7 @@ public function execute($command, $arguments) { $disabled = explode(',', str_replace(' ', ',', ini_get('disable_functions'))); if (in_array('exec', $disabled)) { - throw new LocalizedException(new \Magento\Framework\Phrase("exec function is disabled.")); + throw new LocalizedException(new \Magento\Framework\Phrase('The exec function is disabled.')); } $command = $this->commandRenderer->render($command, $arguments); diff --git a/lib/internal/Magento/Framework/Stdlib/Cookie/PhpCookieManager.php b/lib/internal/Magento/Framework/Stdlib/Cookie/PhpCookieManager.php index 618c70b760d09..de5503c144647 100644 --- a/lib/internal/Magento/Framework/Stdlib/Cookie/PhpCookieManager.php +++ b/lib/internal/Magento/Framework/Stdlib/Cookie/PhpCookieManager.php @@ -152,11 +152,11 @@ protected function setCookie($name, $value, array $metadataArray) $params['name'] = $name; if ($value == '') { throw new FailureToSendException( - new Phrase('Unable to delete the cookie with cookieName = %name', $params) + new Phrase('The cookie with "%name" cookieName couldn\'t be deleted.', $params) ); } else { throw new FailureToSendException( - new Phrase('Unable to send the cookie with cookieName = %name', $params) + new Phrase('The cookie with "%name" cookieName couldn\'t be sent. Please try again later.', $params) ); } } diff --git a/lib/internal/Magento/Framework/Stdlib/DateTime/DateTimeFormatter.php b/lib/internal/Magento/Framework/Stdlib/DateTime/DateTimeFormatter.php index 19a960568d9fc..24772955859d6 100644 --- a/lib/internal/Magento/Framework/Stdlib/DateTime/DateTimeFormatter.php +++ b/lib/internal/Magento/Framework/Stdlib/DateTime/DateTimeFormatter.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Stdlib\DateTime; use Magento\Framework\Exception\LocalizedException; @@ -82,7 +83,9 @@ protected function doFormatObject($object, $format = null, $locale = null) $dateFormat = $timeFormat = \IntlDateFormatter::MEDIUM; $pattern = $format; } else { - throw new LocalizedException(new Phrase('Format type is invalid')); + throw new LocalizedException( + new Phrase('The format type is invalid. Verify the format type and try again.') + ); } $timezone = $object->getTimezone(); diff --git a/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php b/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php index aedabc936e391..879332f148e31 100644 --- a/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php +++ b/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Stdlib\DateTime; use Magento\Framework\App\Config\ScopeConfigInterface; @@ -318,7 +319,10 @@ public function convertConfigTimeToUtc($date, $format = 'Y-m-d H:i:s') } else { if ($date->getTimezone()->getName() !== $this->getConfigTimezone()) { throw new LocalizedException( - new Phrase('DateTime object timezone must be the same as config - %1', $this->getConfigTimezone()) + new Phrase( + 'The DateTime object timezone needs to be the same as the "%1" timezone in config.', + $this->getConfigTimezone() + ) ); } } diff --git a/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone/Validator.php b/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone/Validator.php index aef2bfb808842..43cc83a702f6c 100644 --- a/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone/Validator.php +++ b/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone/Validator.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Stdlib\DateTime\Timezone; use Magento\Framework\Exception\ValidatorException; @@ -53,7 +54,10 @@ public function validate($timestamp, $toDate) if ($transitionYear > $this->_yearMaxValue || $transitionYear < $this->_yearMinValue) { throw new ValidatorException( - new Phrase('Transition year is out of system date range.') + new Phrase( + "The transition year isn't included in the system date range. " + . "Verify the year date range and try again." + ) ); } diff --git a/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/PhpCookieManagerTest.php b/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/PhpCookieManagerTest.php index b3cb5f2aeddce..75b8eb2cec8d6 100644 --- a/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/PhpCookieManagerTest.php +++ b/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/PhpCookieManagerTest.php @@ -234,7 +234,7 @@ public function testDeleteCookieWithFailureToSendException() } catch (FailureToSendException $fse) { $this->assertTrue(self::$isSetCookieInvoked); $this->assertSame( - 'Unable to delete the cookie with cookieName = exception_cookie_name', + 'The cookie with "exception_cookie_name" cookieName couldn\'t be deleted.', $fse->getMessage() ); } diff --git a/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/DateTimeFormatterTest.php b/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/DateTimeFormatterTest.php index 5012c6a47f1c5..f5c8f370fe453 100644 --- a/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/DateTimeFormatterTest.php +++ b/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/DateTimeFormatterTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Stdlib\Test\Unit\DateTime; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; @@ -118,7 +119,7 @@ public function dataProviderFormatObject() /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Format type is invalid + * @expectedExceptionMessage The format type is invalid. Verify the format type and try again. */ public function testFormatObjectIfPassedWrongFormat() { diff --git a/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/Timezone/ValidatorTest.php b/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/Timezone/ValidatorTest.php index 71638a38c55b9..4242664c44b30 100644 --- a/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/Timezone/ValidatorTest.php +++ b/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/Timezone/ValidatorTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Stdlib\Test\Unit\DateTime\Timezone; class ValidatorTest extends \PHPUnit\Framework\TestCase @@ -15,12 +16,15 @@ class ValidatorTest extends \PHPUnit\Framework\TestCase /** * @dataProvider validateWithTimestampOutOfSystemRangeDataProvider * @expectedException \Magento\Framework\Exception\ValidatorException - * @expectedExceptionMessage Transition year is out of system date range. */ public function testValidateWithTimestampOutOfSystemRangeThrowsException($range, $validateArgs) { $this->_validator = new \Magento\Framework\Stdlib\DateTime\Timezone\Validator($range['min'], $range['max']); $this->_validator->validate($validateArgs['timestamp'], $validateArgs['to_date']); + + $this->expectExceptionMessage( + "The transition year isn't included in the system date range. Verify the year date range and try again." + ); } /** diff --git a/lib/internal/Magento/Framework/Test/Unit/DB/Query/GeneratorTest.php b/lib/internal/Magento/Framework/Test/Unit/DB/Query/GeneratorTest.php index e5b5876b65f46..bcb90714f9563 100644 --- a/lib/internal/Magento/Framework/Test/Unit/DB/Query/GeneratorTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/DB/Query/GeneratorTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Test\Unit\DB\Query; use Magento\Framework\DB\Query\BatchIterator; @@ -87,7 +88,7 @@ public function testGenerate() * Test batch generation with invalid select object. * * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Select object must have correct "FROM" part + * @expectedExceptionMessage The select object must have the correct "FROM" part. Verify and try again. * @return void */ public function testGenerateWithoutFromPart() diff --git a/lib/internal/Magento/Framework/Url/ScopeResolver.php b/lib/internal/Magento/Framework/Url/ScopeResolver.php index b43f70713daed..674cb644bca5f 100644 --- a/lib/internal/Magento/Framework/Url/ScopeResolver.php +++ b/lib/internal/Magento/Framework/Url/ScopeResolver.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Url; /** @@ -40,7 +41,7 @@ public function getScope($scopeId = null) $scope = $this->scopeResolver->getScope($scopeId); if (!$scope instanceof \Magento\Framework\Url\ScopeInterface) { throw new \Magento\Framework\Exception\LocalizedException( - new \Magento\Framework\Phrase('Invalid scope object') + new \Magento\Framework\Phrase('The scope object is invalid. Verify the scope object and try again.') ); } diff --git a/lib/internal/Magento/Framework/Url/Test/Unit/ScopeResolverTest.php b/lib/internal/Magento/Framework/Url/Test/Unit/ScopeResolverTest.php index abc5a3750cb47..8b07cc553d456 100644 --- a/lib/internal/Magento/Framework/Url/Test/Unit/ScopeResolverTest.php +++ b/lib/internal/Magento/Framework/Url/Test/Unit/ScopeResolverTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Url\Test\Unit; class ScopeResolverTest extends \PHPUnit\Framework\TestCase @@ -50,7 +51,7 @@ public function testGetScope($scopeId) /** * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage Invalid scope object + * @expectedExceptionMessage The scope object is invalid. Verify the scope object and try again. */ public function testGetScopeException() { diff --git a/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlock.php b/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlock.php index 1749eb9c554e1..101eea5349e77 100644 --- a/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlock.php +++ b/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlock.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\View\Element; use Magento\Framework\Exception\LocalizedException; @@ -43,7 +44,7 @@ public function __construct($blockName = '') public function __call($method, $args) { throw new LocalizedException( - new Phrase('Block %1 throws exception and cannot be rendered.', [$this->blockName]) + new Phrase('The "%1" block threw an exception, and it can\'t be rendered.', [$this->blockName]) ); } @@ -56,7 +57,7 @@ public function __call($method, $args) public function toHtml() { throw new LocalizedException( - new Phrase('Block %1 throws exception and cannot be rendered.', [$this->blockName]) + new Phrase('The "%1" block threw an exception, and it can\'t be rendered.', [$this->blockName]) ); } } diff --git a/lib/internal/Magento/Framework/View/Element/UiComponentFactory.php b/lib/internal/Magento/Framework/View/Element/UiComponentFactory.php index 93fe88a30f065..626aebeb94269 100755 --- a/lib/internal/Magento/Framework/View/Element/UiComponentFactory.php +++ b/lib/internal/Magento/Framework/View/Element/UiComponentFactory.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\View\Element; use Magento\Framework\Config\DataInterface; @@ -265,13 +266,17 @@ protected function getBundleChildren(array $children = []) foreach ($children as $identifier => $config) { if (!isset($config['componentType'])) { throw new LocalizedException(new Phrase( - 'The configuration parameter "componentType" is a required for "%1" component.', + 'The "componentType" configuration parameter is required for the "%1" component.', $identifier )); } if (!isset($componentArguments['context'])) { - throw new LocalizedException(new \Magento\Framework\Phrase('Each UI component should have context.')); + throw new LocalizedException( + new \Magento\Framework\Phrase( + 'An error occurred with the UI component. Each component needs context. Verify and try again.' + ) + ); } $rawComponentData = $this->definitionData->get($config['componentType']); @@ -382,7 +387,7 @@ protected function mergeMetadataItem(array $bundleComponents, array $metadata, $ if (!$isMerged) { if (!isset($data['arguments']['data']['config']['componentType'])) { throw new LocalizedException(new Phrase( - 'The configuration parameter "componentType" is a required for "%1" component.', + 'The "componentType" configuration parameter is required for the "%1" component.', [$name] )); } diff --git a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/TemplateFactory.php b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/TemplateFactory.php index cd372399fcbc0..3a49cd85bb701 100644 --- a/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/TemplateFactory.php +++ b/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/TemplateFactory.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\View\TemplateEngine\Xhtml; use Magento\Framework\Phrase; @@ -54,7 +55,9 @@ public function create(array $arguments = []) $object = $this->objectManager->create($this->instanceName, $arguments); if (!($object instanceof Template)) { - throw new LocalizedException(new Phrase('This class must inherit from a class "Template"')); + throw new LocalizedException( + new Phrase('This class needs to inherit from a class "Template". Verify the class and try again.') + ); } return $object; diff --git a/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php b/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php index f1df2b0ee53f0..bcbecd37d90df 100644 --- a/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php +++ b/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php @@ -5,6 +5,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Webapi; use Magento\Framework\Webapi\ServiceTypeToEntityTypeMap; @@ -289,12 +290,21 @@ private function processCustomAttribute($customAttribute) } if (!$customAttributeCode && !isset($customAttribute[AttributeValue::VALUE])) { - throw new SerializationException(new Phrase('There is an empty custom attribute specified.')); + throw new SerializationException( + new Phrase('An empty custom attribute is specified. Enter the attribute and try again.') + ); } elseif (!$customAttributeCode) { - throw new SerializationException(new Phrase('A custom attribute is specified without an attribute code.')); + throw new SerializationException( + new Phrase( + 'A custom attribute is specified with a missing attribute code. Verify the code and try again.' + ) + ); } elseif (!array_key_exists(AttributeValue::VALUE, $customAttribute)) { throw new SerializationException( - new Phrase('Value is not set for attribute code "' . $customAttributeCode . '"') + new Phrase( + 'The "' . $customAttributeCode . + '" attribute code doesn\'t have a value set. Enter the value and try again.' + ) ); } @@ -396,7 +406,9 @@ protected function processInputError($inputError) if (!empty($inputError)) { $exception = new InputException(); foreach ($inputError as $errorParamField) { - $exception->addError(new Phrase('%fieldName is a required field.', ['fieldName' => $errorParamField])); + $exception->addError( + new Phrase('"%fieldName" is required. Enter and try again.', ['fieldName' => $errorParamField]) + ); } if ($exception->wasErrorAdded()) { throw $exception; diff --git a/lib/web/mage/validation.js b/lib/web/mage/validation.js index 8ab522a318881..a0c9f3ad795e3 100644 --- a/lib/web/mage/validation.js +++ b/lib/web/mage/validation.js @@ -1587,7 +1587,7 @@ return true; }, - $.mage.__('Password cannot be the same as email address.') + $.mage.__('The password can\'t be the same as the email address. Create a new password and try again.') ] }; diff --git a/setup/src/Magento/Setup/Fixtures/ConfigurableProductsFixture.php b/setup/src/Magento/Setup/Fixtures/ConfigurableProductsFixture.php index 420149c79e29a..938a23071feda 100644 --- a/setup/src/Magento/Setup/Fixtures/ConfigurableProductsFixture.php +++ b/setup/src/Magento/Setup/Fixtures/ConfigurableProductsFixture.php @@ -552,7 +552,7 @@ private function getConfigurableProductConfig() if (count($skuPull) !== count(array_unique($skuPull))) { throw new ValidatorException( - __('Sku pattern for configurable product must be unique per attribute set') + __("The configurable product's SKU pattern must be unique in an attribute set.") ); } @@ -591,7 +591,9 @@ private function prepareConfigurableConfig($defaultAttributeSets) } } } else { - throw new ValidatorException(__('Configurable product config is invalid')); + throw new ValidatorException( + __('The configurable product config is invalid. Verify the product and try again.') + ); } return $configurableConfigs; diff --git a/setup/src/Magento/Setup/Fixtures/ImagesFixture.php b/setup/src/Magento/Setup/Fixtures/ImagesFixture.php index 0d8cb7493ff84..84081412335ac 100644 --- a/setup/src/Magento/Setup/Fixtures/ImagesFixture.php +++ b/setup/src/Magento/Setup/Fixtures/ImagesFixture.php @@ -184,13 +184,13 @@ public function printInfo(OutputInterface $output) if (!isset($config['images-count'])) { throw new ValidatorException( - __('Please, specify amount of images to generate') + __("The amount of images to generate wasn't specified. Enter the amount and try again.") ); } if (!isset($config['images-per-product'])) { throw new ValidatorException( - __('Please, specify amount of images per product') + __("The amount of images per product wasn't specified. Enter the amount and try again.") ); } diff --git a/setup/src/Magento/Setup/Model/AdminAccount.php b/setup/src/Magento/Setup/Model/AdminAccount.php index 0fe08794f6a2a..87b113a2c4b34 100644 --- a/setup/src/Magento/Setup/Model/AdminAccount.php +++ b/setup/src/Magento/Setup/Model/AdminAccount.php @@ -165,7 +165,7 @@ public function validateUserMatches() { if (empty($this->data[self::KEY_PASSWORD])) { throw new \Exception( - 'Password is a required field.' + '"Password" is required. Enter and try again.' ); } diff --git a/setup/src/Magento/Setup/Model/FixtureGenerator/EntityGenerator.php b/setup/src/Magento/Setup/Model/FixtureGenerator/EntityGenerator.php index c52cee9f5c184..cd9fd76077fb0 100644 --- a/setup/src/Magento/Setup/Model/FixtureGenerator/EntityGenerator.php +++ b/setup/src/Magento/Setup/Model/FixtureGenerator/EntityGenerator.php @@ -335,7 +335,9 @@ function ($ddl) use ($primaryTable) { } } if (!$foreignKey) { - throw new ValidatorException(__('Cannot find entity id field for table "%1"', $table)); + throw new ValidatorException( + __('The entity ID field for the "%1" table wasn\'t found. Verify the field and try again.', $table) + ); } $this->tableToEntityIdMap[$table] = current($foreignKey)['COLUMN_NAME']; } @@ -374,7 +376,9 @@ function ($data) { } ); if (!$ddl) { - throw new ValidatorException(__('Cannot find primary key for table "%1"', $table)); + throw new ValidatorException( + __('The primary key for the "%1" table wasn\'t found. Verify the key and try again.', $table) + ); } $this->tableToEntityIdMap[$table] = current($ddl)['COLUMN_NAME']; } diff --git a/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php b/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php index 5cd9c6ad3f719..7759eb51a52ad 100644 --- a/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php +++ b/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Setup\Module\Di\Code\Reader; use Magento\Framework\App\Filesystem\DirectoryList; @@ -69,7 +70,9 @@ public function getList($path) return $this->fileResults[$realPath]; } if (!(bool)$realPath) { - throw new FileSystemException(new \Magento\Framework\Phrase('Invalid path: %1', [$path])); + throw new FileSystemException( + new \Magento\Framework\Phrase('The "%1" path is invalid. Verify the path and try again.', [$path]) + ); } $recursiveIterator = new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator($realPath, \FilesystemIterator::FOLLOW_SYMLINKS), diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/AdminUserCreateCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/AdminUserCreateCommandTest.php index d244f48d4e1ea..a80302b40a617 100644 --- a/setup/src/Magento/Setup/Test/Unit/Console/Command/AdminUserCreateCommandTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/AdminUserCreateCommandTest.php @@ -158,10 +158,13 @@ public function testValidate(array $options, array $errors) public function validateDataProvider() { return [ - [[null, 'Doe', 'admin', 'test@test.com', '123123q', '123123q'], ['First Name is a required field.']], + [ + [null, 'Doe', 'admin', 'test@test.com', '123123q', '123123q'], + ['"First Name" is required. Enter and try again.'] + ], [ ['John', null, null, 'test@test.com', '123123q', '123123q'], - ['User Name is a required field.', 'Last Name is a required field.'], + ['"User Name" is required. Enter and try again.', '"Last Name" is required. Enter and try again.'], ], [['John', 'Doe', 'admin', null, '123123q', '123123q'], ['Please enter a valid email.']], [ diff --git a/setup/src/Magento/Setup/Test/Unit/Model/AdminAccountTest.php b/setup/src/Magento/Setup/Test/Unit/Model/AdminAccountTest.php index e7b1c5ade1bcf..cf8a578fdb579 100644 --- a/setup/src/Magento/Setup/Test/Unit/Model/AdminAccountTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Model/AdminAccountTest.php @@ -365,7 +365,7 @@ public function testSaveExceptionSpecialAdminRoleNotFound() /** * @expectedException \Exception - * @expectedExceptionMessage Password is a required field + * @expectedExceptionMessage "Password" is required. Enter and try again. */ public function testSaveExceptionPasswordEmpty() {